fix: allow multiple hooks for same event
This commit is contained in:
@@ -281,6 +281,7 @@ type ComplexityRoot struct {
|
||||
EventName func(childComplexity int) int
|
||||
Headers func(childComplexity int) int
|
||||
ID func(childComplexity int) int
|
||||
Title func(childComplexity int) int
|
||||
UpdatedAt func(childComplexity int) int
|
||||
}
|
||||
|
||||
@@ -1854,6 +1855,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||
|
||||
return e.complexity.Webhook.ID(childComplexity), true
|
||||
|
||||
case "Webhook.title":
|
||||
if e.complexity.Webhook.Title == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.Webhook.Title(childComplexity), true
|
||||
|
||||
case "Webhook.updated_at":
|
||||
if e.complexity.Webhook.UpdatedAt == nil {
|
||||
break
|
||||
@@ -2210,6 +2218,7 @@ type GenerateJWTKeysResponse {
|
||||
|
||||
type Webhook {
|
||||
id: ID!
|
||||
title: String
|
||||
event_name: String
|
||||
endpoint: String
|
||||
enabled: Boolean
|
||||
@@ -2500,6 +2509,7 @@ input ListWebhookLogRequest {
|
||||
}
|
||||
|
||||
input AddWebhookRequest {
|
||||
title: String!
|
||||
event_name: String!
|
||||
endpoint: String!
|
||||
enabled: Boolean!
|
||||
@@ -2508,6 +2518,7 @@ input AddWebhookRequest {
|
||||
|
||||
input UpdateWebhookRequest {
|
||||
id: ID!
|
||||
title: String
|
||||
event_name: String
|
||||
endpoint: String
|
||||
enabled: Boolean
|
||||
@@ -10141,6 +10152,8 @@ func (ec *executionContext) fieldContext_Query__webhook(ctx context.Context, fie
|
||||
switch field.Name {
|
||||
case "id":
|
||||
return ec.fieldContext_Webhook_id(ctx, field)
|
||||
case "title":
|
||||
return ec.fieldContext_Webhook_title(ctx, field)
|
||||
case "event_name":
|
||||
return ec.fieldContext_Webhook_event_name(ctx, field)
|
||||
case "endpoint":
|
||||
@@ -12160,6 +12173,47 @@ func (ec *executionContext) fieldContext_Webhook_id(ctx context.Context, field g
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Webhook_title(ctx context.Context, field graphql.CollectedField, obj *model.Webhook) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Webhook_title(ctx, field)
|
||||
if err != nil {
|
||||
return graphql.Null
|
||||
}
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return obj.Title, nil
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
return graphql.Null
|
||||
}
|
||||
if resTmp == nil {
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(*string)
|
||||
fc.Result = res
|
||||
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) fieldContext_Webhook_title(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||
fc = &graphql.FieldContext{
|
||||
Object: "Webhook",
|
||||
Field: field,
|
||||
IsMethod: false,
|
||||
IsResolver: false,
|
||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||
return nil, errors.New("field of type String does not have child fields")
|
||||
},
|
||||
}
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Webhook_event_name(ctx context.Context, field graphql.CollectedField, obj *model.Webhook) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Webhook_event_name(ctx, field)
|
||||
if err != nil {
|
||||
@@ -12905,6 +12959,8 @@ func (ec *executionContext) fieldContext_Webhooks_webhooks(ctx context.Context,
|
||||
switch field.Name {
|
||||
case "id":
|
||||
return ec.fieldContext_Webhook_id(ctx, field)
|
||||
case "title":
|
||||
return ec.fieldContext_Webhook_title(ctx, field)
|
||||
case "event_name":
|
||||
return ec.fieldContext_Webhook_event_name(ctx, field)
|
||||
case "endpoint":
|
||||
@@ -14756,13 +14812,21 @@ func (ec *executionContext) unmarshalInputAddWebhookRequest(ctx context.Context,
|
||||
asMap[k] = v
|
||||
}
|
||||
|
||||
fieldsInOrder := [...]string{"event_name", "endpoint", "enabled", "headers"}
|
||||
fieldsInOrder := [...]string{"title", "event_name", "endpoint", "enabled", "headers"}
|
||||
for _, k := range fieldsInOrder {
|
||||
v, ok := asMap[k]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
switch k {
|
||||
case "title":
|
||||
var err error
|
||||
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("title"))
|
||||
it.Title, err = ec.unmarshalNString2string(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
case "event_name":
|
||||
var err error
|
||||
|
||||
@@ -16612,7 +16676,7 @@ func (ec *executionContext) unmarshalInputUpdateWebhookRequest(ctx context.Conte
|
||||
asMap[k] = v
|
||||
}
|
||||
|
||||
fieldsInOrder := [...]string{"id", "event_name", "endpoint", "enabled", "headers"}
|
||||
fieldsInOrder := [...]string{"id", "title", "event_name", "endpoint", "enabled", "headers"}
|
||||
for _, k := range fieldsInOrder {
|
||||
v, ok := asMap[k]
|
||||
if !ok {
|
||||
@@ -16627,6 +16691,14 @@ func (ec *executionContext) unmarshalInputUpdateWebhookRequest(ctx context.Conte
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
case "title":
|
||||
var err error
|
||||
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("title"))
|
||||
it.Title, err = ec.unmarshalOString2ᚖstring(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
case "event_name":
|
||||
var err error
|
||||
|
||||
@@ -18509,6 +18581,10 @@ func (ec *executionContext) _Webhook(ctx context.Context, sel ast.SelectionSet,
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
}
|
||||
case "title":
|
||||
|
||||
out.Values[i] = ec._Webhook_title(ctx, field, obj)
|
||||
|
||||
case "event_name":
|
||||
|
||||
out.Values[i] = ec._Webhook_event_name(ctx, field, obj)
|
||||
|
Reference in New Issue
Block a user