Skip to content

Commit

Permalink
fix(server): internal error when the project has an active webhook (#…
Browse files Browse the repository at this point in the history
…1213)

imp
  • Loading branch information
yk-eukarya authored Aug 23, 2024
1 parent ca0d518 commit f28301f
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion server/pkg/schema/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,23 @@ func NewPackage(s *Schema, meta *Schema, groupSchemas map[id.GroupID]*Schema, re
}

func (p *Package) Schema() *Schema {
if p == nil {
return nil
}
return p.schema
}

func (p *Package) MetaSchema() *Schema {
if p == nil {
return nil
}
return p.metaSchema
}

func (p *Package) GroupSchemas() List {
if p == nil {
return nil
}
return lo.FilterMap(lo.Values(p.groupSchemas), func(s *Schema, _ int) (*Schema, bool) {
if s == nil {
return nil, false
Expand All @@ -39,7 +48,7 @@ func (p *Package) GroupSchemas() List {
}

func (p *Package) GroupSchema(gid id.GroupID) *Schema {
if p.groupSchemas == nil {
if p == nil || p.groupSchemas == nil {
return nil
}
s, ok := p.groupSchemas[gid]
Expand All @@ -50,10 +59,16 @@ func (p *Package) GroupSchema(gid id.GroupID) *Schema {
}

func (p *Package) ReferencedSchemas() List {
if p == nil {
return nil
}
return p.referencedSchemas
}

func (p *Package) ReferencedSchema(fieldID id.FieldID) *Schema {
if p == nil {
return nil
}
f := p.schema.Field(fieldID)
if f == nil {
return nil
Expand All @@ -62,6 +77,9 @@ func (p *Package) ReferencedSchema(fieldID id.FieldID) *Schema {
}

func (p *Package) Field(fieldID id.FieldID) *Field {
if p == nil {
return nil
}
f := p.schema.Field(fieldID)
if f != nil {
return f
Expand All @@ -80,6 +98,9 @@ func (p *Package) Field(fieldID id.FieldID) *Field {
}

func (p *Package) FieldByIDOrKey(fID *id.FieldID, k *id.Key) *Field {
if p == nil {
return nil
}
f := p.schema.FieldByIDOrKey(fID, k)
if f != nil {
return f
Expand Down

0 comments on commit f28301f

Please sign in to comment.