/
timeline_event.resolvers.go
31 lines (26 loc) · 1.3 KB
/
timeline_event.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
30
31
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.45
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"
"github.com/opentracing/opentracing-go/log"
)
// TimelineEvents is the resolver for the timelineEvents field.
func (r *queryResolver) TimelineEvents(ctx context.Context, ids []string) ([]model.TimelineEvent, error) {
ctx, span := tracing.StartGraphQLTracerSpan(ctx, "QueryResolver.TimelineEvents", graphql.GetOperationContext(ctx))
defer span.Finish()
tracing.SetDefaultResolverSpanTags(ctx, span)
span.LogFields(log.Object("request.ids", ids))
timelineEvents, err := r.Services.TimelineEventService.GetTimelineEventsWithIds(ctx, ids)
if err != nil {
tracing.TraceErr(span, err)
graphql.AddErrorf(ctx, "Failed to fetch timeline events")
return nil, nil
}
return mapper.MapEntitiesToTimelineEvents(timelineEvents), err
}