-
Notifications
You must be signed in to change notification settings - Fork 12
/
custom_field_template.resolvers.go
29 lines (24 loc) · 1.37 KB
/
custom_field_template.resolvers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package resolver
// This file will be automatically regenerated based on the schema, any resolver implementations
// will be copied through when generating and any unknown code will be moved to the end.
// Code generated by github.com/99designs/gqlgen version v0.17.46
import (
"context"
"github.com/99designs/gqlgen/graphql"
"github.com/openline-ai/openline-customer-os/packages/server/customer-os-api/graph/model"
"github.com/openline-ai/openline-customer-os/packages/server/customer-os-api/mapper"
"github.com/openline-ai/openline-customer-os/packages/server/customer-os-api/tracing"
)
// CustomFieldTemplateCreate is the resolver for the customFieldTemplate_Create field.
func (r *mutationResolver) CustomFieldTemplateCreate(ctx context.Context, input model.CustomFieldTemplateInput) (*model.CustomFieldTemplate, error) {
ctx, span := tracing.StartGraphQLTracerSpan(ctx, "MutationResolver.CustomFieldTemplateCreate", graphql.GetOperationContext(ctx))
defer span.Finish()
tracing.SetDefaultResolverSpanTags(ctx, span)
customFieldTemplateEntity, err := r.Services.CustomFieldTemplateService.Merge(ctx, mapper.MapCustomFieldTemplateInputToEntity(input))
if err != nil {
tracing.TraceErr(span, err)
graphql.AddErrorf(ctx, "Failed to create custom field template %s", input.Name)
return nil, nil
}
return mapper.MapEntityToCustomFieldTemplate(customFieldTemplateEntity), nil
}