diff options
Diffstat (limited to 'graphql')
-rw-r--r-- | graphql/gqlgen.yml | 10 | ||||
-rw-r--r-- | graphql/graph/gen_graph.go | 1418 | ||||
-rw-r--r-- | graphql/resolvers/root.go | 16 | ||||
-rw-r--r-- | graphql/resolvers/timeline.go | 29 | ||||
-rw-r--r-- | graphql/schema.graphql | 31 |
5 files changed, 1111 insertions, 393 deletions
diff --git a/graphql/gqlgen.yml b/graphql/gqlgen.yml index 9c0e0842..3932eafe 100644 --- a/graphql/gqlgen.yml +++ b/graphql/gqlgen.yml @@ -37,5 +37,11 @@ models: model: github.com/MichaelMure/git-bug/bug.CommentHistoryStep CreateTimelineItem: model: github.com/MichaelMure/git-bug/bug.CreateTimelineItem - CommentTimelineItem: - model: github.com/MichaelMure/git-bug/bug.CommentTimelineItem
\ No newline at end of file + AddCommentTimelineItem: + model: github.com/MichaelMure/git-bug/bug.AddCommentTimelineItem + LabelChangeTimelineItem: + model: github.com/MichaelMure/git-bug/bug.LabelChangeTimelineItem + SetStatusTimelineItem: + model: github.com/MichaelMure/git-bug/bug.SetStatusTimelineItem + SetTitleTimelineItem: + model: github.com/MichaelMure/git-bug/bug.SetTitleTimelineItem
\ No newline at end of file diff --git a/graphql/graph/gen_graph.go b/graphql/graph/gen_graph.go index 01e3bb91..f9cc91f9 100644 --- a/graphql/graph/gen_graph.go +++ b/graphql/graph/gen_graph.go @@ -36,17 +36,20 @@ type Config struct { type ResolverRoot interface { AddCommentOperation() AddCommentOperationResolver + AddCommentTimelineItem() AddCommentTimelineItemResolver Bug() BugResolver CommentHistoryStep() CommentHistoryStepResolver - CommentTimelineItem() CommentTimelineItemResolver CreateOperation() CreateOperationResolver CreateTimelineItem() CreateTimelineItemResolver LabelChangeOperation() LabelChangeOperationResolver + LabelChangeTimelineItem() LabelChangeTimelineItemResolver Mutation() MutationResolver Query() QueryResolver Repository() RepositoryResolver SetStatusOperation() SetStatusOperationResolver + SetStatusTimelineItem() SetStatusTimelineItemResolver SetTitleOperation() SetTitleOperationResolver + SetTitleTimelineItem() SetTitleTimelineItemResolver } type DirectiveRoot struct { @@ -60,6 +63,17 @@ type ComplexityRoot struct { Files func(childComplexity int) int } + AddCommentTimelineItem struct { + Hash func(childComplexity int) int + Author func(childComplexity int) int + Message func(childComplexity int) int + Files func(childComplexity int) int + CreatedAt func(childComplexity int) int + LastEdit func(childComplexity int) int + Edited func(childComplexity int) int + History func(childComplexity int) int + } + Bug struct { Id func(childComplexity int) int HumanId func(childComplexity int) int @@ -109,17 +123,6 @@ type ComplexityRoot struct { Date func(childComplexity int) int } - CommentTimelineItem struct { - Hash func(childComplexity int) int - Author func(childComplexity int) int - Message func(childComplexity int) int - Files func(childComplexity int) int - CreatedAt func(childComplexity int) int - LastEdit func(childComplexity int) int - Edited func(childComplexity int) int - History func(childComplexity int) int - } - CreateOperation struct { Author func(childComplexity int) int Date func(childComplexity int) int @@ -147,6 +150,14 @@ type ComplexityRoot struct { Removed func(childComplexity int) int } + LabelChangeTimelineItem struct { + Hash func(childComplexity int) int + Author func(childComplexity int) int + Date func(childComplexity int) int + Added func(childComplexity int) int + Removed func(childComplexity int) int + } + Mutation struct { NewBug func(childComplexity int, repoRef *string, title string, message string, files []git.Hash) int AddComment func(childComplexity int, repoRef *string, prefix string, message string, files []git.Hash) int @@ -199,6 +210,13 @@ type ComplexityRoot struct { Status func(childComplexity int) int } + SetStatusTimelineItem struct { + Hash func(childComplexity int) int + Author func(childComplexity int) int + Date func(childComplexity int) int + Status func(childComplexity int) int + } + SetTitleOperation struct { Hash func(childComplexity int) int Author func(childComplexity int) int @@ -207,6 +225,14 @@ type ComplexityRoot struct { Was func(childComplexity int) int } + SetTitleTimelineItem struct { + Hash func(childComplexity int) int + Author func(childComplexity int) int + Date func(childComplexity int) int + Title func(childComplexity int) int + Was func(childComplexity int) int + } + TimelineItemConnection struct { Edges func(childComplexity int) int Nodes func(childComplexity int) int @@ -224,6 +250,10 @@ type AddCommentOperationResolver interface { Author(ctx context.Context, obj *bug.AddCommentOperation) (bug.Person, error) Date(ctx context.Context, obj *bug.AddCommentOperation) (time.Time, error) } +type AddCommentTimelineItemResolver interface { + CreatedAt(ctx context.Context, obj *bug.AddCommentTimelineItem) (time.Time, error) + LastEdit(ctx context.Context, obj *bug.AddCommentTimelineItem) (time.Time, error) +} type BugResolver interface { Status(ctx context.Context, obj *bug.Snapshot) (models.Status, error) @@ -235,10 +265,6 @@ type BugResolver interface { type CommentHistoryStepResolver interface { Date(ctx context.Context, obj *bug.CommentHistoryStep) (time.Time, error) } -type CommentTimelineItemResolver interface { - CreatedAt(ctx context.Context, obj *bug.CommentTimelineItem) (time.Time, error) - LastEdit(ctx context.Context, obj *bug.CommentTimelineItem) (time.Time, error) -} type CreateOperationResolver interface { Author(ctx context.Context, obj *bug.CreateOperation) (bug.Person, error) Date(ctx context.Context, obj *bug.CreateOperation) (time.Time, error) @@ -251,6 +277,9 @@ type LabelChangeOperationResolver interface { Author(ctx context.Context, obj *bug.LabelChangeOperation) (bug.Person, error) Date(ctx context.Context, obj *bug.LabelChangeOperation) (time.Time, error) } +type LabelChangeTimelineItemResolver interface { + Date(ctx context.Context, obj *bug.LabelChangeTimelineItem) (time.Time, error) +} type MutationResolver interface { NewBug(ctx context.Context, repoRef *string, title string, message string, files []git.Hash) (bug.Snapshot, error) AddComment(ctx context.Context, repoRef *string, prefix string, message string, files []git.Hash) (bug.Snapshot, error) @@ -273,10 +302,17 @@ type SetStatusOperationResolver interface { Date(ctx context.Context, obj *bug.SetStatusOperation) (time.Time, error) Status(ctx context.Context, obj *bug.SetStatusOperation) (models.Status, error) } +type SetStatusTimelineItemResolver interface { + Date(ctx context.Context, obj *bug.SetStatusTimelineItem) (time.Time, error) + Status(ctx context.Context, obj *bug.SetStatusTimelineItem) (models.Status, error) +} type SetTitleOperationResolver interface { Author(ctx context.Context, obj *bug.SetTitleOperation) (bug.Person, error) Date(ctx context.Context, obj *bug.SetTitleOperation) (time.Time, error) } +type SetTitleTimelineItemResolver interface { + Date(ctx context.Context, obj *bug.SetTitleTimelineItem) (time.Time, error) +} func field_Bug_comments_args(rawArgs map[string]interface{}) (map[string]interface{}, error) { args := map[string]interface{}{} @@ -966,6 +1002,62 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.AddCommentOperation.Files(childComplexity), true + case "AddCommentTimelineItem.hash": + if e.complexity.AddCommentTimelineItem.Hash == nil { + break + } + + return e.complexity.AddCommentTimelineItem.Hash(childComplexity), true + + case "AddCommentTimelineItem.author": + if e.complexity.AddCommentTimelineItem.Author == nil { + break + } + + return e.complexity.AddCommentTimelineItem.Author(childComplexity), true + + case "AddCommentTimelineItem.message": + if e.complexity.AddCommentTimelineItem.Message == nil { + break + } + + return e.complexity.AddCommentTimelineItem.Message(childComplexity), true + + case "AddCommentTimelineItem.files": + if e.complexity.AddCommentTimelineItem.Files == nil { + break + } + + return e.complexity.AddCommentTimelineItem.Files(childComplexity), true + + case "AddCommentTimelineItem.createdAt": + if e.complexity.AddCommentTimelineItem.CreatedAt == nil { + break + } + + return e.complexity.AddCommentTimelineItem.CreatedAt(childComplexity), true + + case "AddCommentTimelineItem.lastEdit": + if e.complexity.AddCommentTimelineItem.LastEdit == nil { + break + } + + return e.complexity.AddCommentTimelineItem.LastEdit(childComplexity), true + + case "AddCommentTimelineItem.edited": + if e.complexity.AddCommentTimelineItem.Edited == nil { + break + } + + return e.complexity.AddCommentTimelineItem.Edited(childComplexity), true + + case "AddCommentTimelineItem.history": + if e.complexity.AddCommentTimelineItem.History == nil { + break + } + + return e.complexity.AddCommentTimelineItem.History(childComplexity), true + case "Bug.id": if e.complexity.Bug.Id == nil { break @@ -1177,62 +1269,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.CommentHistoryStep.Date(childComplexity), true - case "CommentTimelineItem.hash": - if e.complexity.CommentTimelineItem.Hash == nil { - break - } - - return e.complexity.CommentTimelineItem.Hash(childComplexity), true - - case "CommentTimelineItem.author": - if e.complexity.CommentTimelineItem.Author == nil { - break - } - - return e.complexity.CommentTimelineItem.Author(childComplexity), true - - case "CommentTimelineItem.message": - if e.complexity.CommentTimelineItem.Message == nil { - break - } - - return e.complexity.CommentTimelineItem.Message(childComplexity), true - - case "CommentTimelineItem.files": - if e.complexity.CommentTimelineItem.Files == nil { - break - } - - return e.complexity.CommentTimelineItem.Files(childComplexity), true - - case "CommentTimelineItem.createdAt": - if e.complexity.CommentTimelineItem.CreatedAt == nil { - break - } - - return e.complexity.CommentTimelineItem.CreatedAt(childComplexity), true - - case "CommentTimelineItem.lastEdit": - if e.complexity.CommentTimelineItem.LastEdit == nil { - break - } - - return e.complexity.CommentTimelineItem.LastEdit(childComplexity), true - - case "CommentTimelineItem.edited": - if e.complexity.CommentTimelineItem.Edited == nil { - break - } - - return e.complexity.CommentTimelineItem.Edited(childComplexity), true - - case "CommentTimelineItem.history": - if e.complexity.CommentTimelineItem.History == nil { - break - } - - return e.complexity.CommentTimelineItem.History(childComplexity), true - case "CreateOperation.author": if e.complexity.CreateOperation.Author == nil { break @@ -1359,6 +1395,41 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.LabelChangeOperation.Removed(childComplexity), true + case "LabelChangeTimelineItem.hash": + if e.complexity.LabelChangeTimelineItem.Hash == nil { + break + } + + return e.complexity.LabelChangeTimelineItem.Hash(childComplexity), true + + case "LabelChangeTimelineItem.author": + if e.complexity.LabelChangeTimelineItem.Author == nil { + break + } + + return e.complexity.LabelChangeTimelineItem.Author(childComplexity), true + + case "LabelChangeTimelineItem.date": + if e.complexity.LabelChangeTimelineItem.Date == nil { + break + } + + return e.complexity.LabelChangeTimelineItem.Date(childComplexity), true + + case "LabelChangeTimelineItem.added": + if e.complexity.LabelChangeTimelineItem.Added == nil { + break + } + + return e.complexity.LabelChangeTimelineItem.Added(childComplexity), true + + case "LabelChangeTimelineItem.removed": + if e.complexity.LabelChangeTimelineItem.Removed == nil { + break + } + + return e.complexity.LabelChangeTimelineItem.Removed(childComplexity), true + case "Mutation.newBug": if e.complexity.Mutation.NewBug == nil { break @@ -1605,6 +1676,34 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.SetStatusOperation.Status(childComplexity), true + case "SetStatusTimelineItem.hash": + if e.complexity.SetStatusTimelineItem.Hash == nil { + break + } + + return e.complexity.SetStatusTimelineItem.Hash(childComplexity), true + + case "SetStatusTimelineItem.author": + if e.complexity.SetStatusTimelineItem.Author == nil { + break + } + + return e.complexity.SetStatusTimelineItem.Author(childComplexity), true + + case "SetStatusTimelineItem.date": + if e.complexity.SetStatusTimelineItem.Date == nil { + break + } + + return e.complexity.SetStatusTimelineItem.Date(childComplexity), true + + case "SetStatusTimelineItem.status": + if e.complexity.SetStatusTimelineItem.Status == nil { + break + } + + return e.complexity.SetStatusTimelineItem.Status(childComplexity), true + case "SetTitleOperation.hash": if e.complexity.SetTitleOperation.Hash == nil { break @@ -1640,6 +1739,41 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.SetTitleOperation.Was(childComplexity), true + case "SetTitleTimelineItem.hash": + if e.complexity.SetTitleTimelineItem.Hash == nil { + break + } + + return e.complexity.SetTitleTimelineItem.Hash(childComplexity), true + + case "SetTitleTimelineItem.author": + if e.complexity.SetTitleTimelineItem.Author == nil { + break + } + + return e.complexity.SetTitleTimelineItem.Author(childComplexity), true + + case "SetTitleTimelineItem.date": + if e.complexity.SetTitleTimelineItem.Date == nil { + break + } + + return e.complexity.SetTitleTimelineItem.Date(childComplexity), true + + case "SetTitleTimelineItem.title": + if e.complexity.SetTitleTimelineItem.Title == nil { + break + } + + return e.complexity.SetTitleTimelineItem.Title(childComplexity), true + + case "SetTitleTimelineItem.was": + if e.complexity.SetTitleTimelineItem.Was == nil { + break + } + + return e.complexity.SetTitleTimelineItem.Was(childComplexity), true + case "TimelineItemConnection.edges": if e.complexity.TimelineItemConnection.Edges == nil { break @@ -1879,6 +2013,299 @@ func (ec *executionContext) _AddCommentOperation_files(ctx context.Context, fiel return arr1 } +var addCommentTimelineItemImplementors = []string{"AddCommentTimelineItem", "TimelineItem"} + +// nolint: gocyclo, errcheck, gas, goconst +func (ec *executionContext) _AddCommentTimelineItem(ctx context.Context, sel ast.SelectionSet, obj *bug.AddCommentTimelineItem) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, addCommentTimelineItemImplementors) + + var wg sync.WaitGroup + out := graphql.NewOrderedMap(len(fields)) + invalid := false + for i, field := range fields { + out.Keys[i] = field.Alias + + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("AddCommentTimelineItem") + case "hash": + out.Values[i] = ec._AddCommentTimelineItem_hash(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "author": + out.Values[i] = ec._AddCommentTimelineItem_author(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "message": + out.Values[i] = ec._AddCommentTimelineItem_message(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "files": + out.Values[i] = ec._AddCommentTimelineItem_files(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "createdAt": + wg.Add(1) + go func(i int, field graphql.CollectedField) { + out.Values[i] = ec._AddCommentTimelineItem_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + wg.Done() + }(i, field) + case "lastEdit": + wg.Add(1) + go func(i int, field graphql.CollectedField) { + out.Values[i] = ec._AddCommentTimelineItem_lastEdit(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + wg.Done() + }(i, field) + case "edited": + out.Values[i] = ec._AddCommentTimelineItem_edited(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "history": + out.Values[i] = ec._AddCommentTimelineItem_history(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + wg.Wait() + if invalid { + return graphql.Null + } + return out +} + +// nolint: vetshadow +func (ec *executionContext) _AddCommentTimelineItem_hash(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "AddCommentTimelineItem", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return obj.Hash(), nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(git.Hash) + rctx.Result = res + return res +} + +// nolint: vetshadow +func (ec *executionContext) _AddCommentTimelineItem_author(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "AddCommentTimelineItem", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return obj.Author, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bug.Person) + rctx.Result = res + + return ec._Person(ctx, field.Selections, &res) +} + +// nolint: vetshadow +func (ec *executionContext) _AddCommentTimelineItem_message(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "AddCommentTimelineItem", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return obj.Message, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + rctx.Result = res + return graphql.MarshalString(res) +} + +// nolint: vetshadow +func (ec *executionContext) _AddCommentTimelineItem_files(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "AddCommentTimelineItem", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return obj.Files, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]git.Hash) + rctx.Result = res + + arr1 := make(graphql.Array, len(res)) + + for idx1 := range res { + arr1[idx1] = func() graphql.Marshaler { + return res[idx1] + }() + } + + return arr1 +} + +// nolint: vetshadow +func (ec *executionContext) _AddCommentTimelineItem_createdAt(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "AddCommentTimelineItem", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return ec.resolvers.AddCommentTimelineItem().CreatedAt(ctx, obj) + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(time.Time) + rctx.Result = res + return graphql.MarshalTime(res) +} + +// nolint: vetshadow +func (ec *executionContext) _AddCommentTimelineItem_lastEdit(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "AddCommentTimelineItem", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return ec.resolvers.AddCommentTimelineItem().LastEdit(ctx, obj) + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(time.Time) + rctx.Result = res + return graphql.MarshalTime(res) +} + +// nolint: vetshadow +func (ec *executionContext) _AddCommentTimelineItem_edited(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "AddCommentTimelineItem", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return obj.Edited(), nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + rctx.Result = res + return graphql.MarshalBoolean(res) +} + +// nolint: vetshadow +func (ec *executionContext) _AddCommentTimelineItem_history(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "AddCommentTimelineItem", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return obj.History, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]bug.CommentHistoryStep) + rctx.Result = res + + arr1 := make(graphql.Array, len(res)) + var wg sync.WaitGroup + + isLen1 := len(res) == 1 + if !isLen1 { + wg.Add(len(res)) + } + + for idx1 := range res { + idx1 := idx1 + rctx := &graphql.ResolverContext{ + Index: &idx1, + Result: &res[idx1], + } + ctx := graphql.WithResolverContext(ctx, rctx) + f := func(idx1 int) { + if !isLen1 { + defer wg.Done() + } + arr1[idx1] = func() graphql.Marshaler { + + return ec._CommentHistoryStep(ctx, field.Selections, &res[idx1]) + }() + } + if isLen1 { + f(idx1) + } else { + go f(idx1) + } + + } + wg.Wait() + return arr1 +} + var bugImplementors = []string{"Bug"} // nolint: gocyclo, errcheck, gas, goconst @@ -3013,299 +3440,6 @@ func (ec *executionContext) _CommentHistoryStep_date(ctx context.Context, field return graphql.MarshalTime(res) } -var commentTimelineItemImplementors = []string{"CommentTimelineItem", "TimelineItem"} - -// nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _CommentTimelineItem(ctx context.Context, sel ast.SelectionSet, obj *bug.CommentTimelineItem) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, commentTimelineItemImplementors) - - var wg sync.WaitGroup - out := graphql.NewOrderedMap(len(fields)) - invalid := false - for i, field := range fields { - out.Keys[i] = field.Alias - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("CommentTimelineItem") - case "hash": - out.Values[i] = ec._CommentTimelineItem_hash(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "author": - out.Values[i] = ec._CommentTimelineItem_author(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "message": - out.Values[i] = ec._CommentTimelineItem_message(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "files": - out.Values[i] = ec._CommentTimelineItem_files(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "createdAt": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._CommentTimelineItem_createdAt(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "lastEdit": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._CommentTimelineItem_lastEdit(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "edited": - out.Values[i] = ec._CommentTimelineItem_edited(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "history": - out.Values[i] = ec._CommentTimelineItem_history(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - wg.Wait() - if invalid { - return graphql.Null - } - return out -} - -// nolint: vetshadow -func (ec *executionContext) _CommentTimelineItem_hash(ctx context.Context, field graphql.CollectedField, obj *bug.CommentTimelineItem) graphql.Marshaler { - rctx := &graphql.ResolverContext{ - Object: "CommentTimelineItem", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { - return obj.Hash() - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(git.Hash) - rctx.Result = res - return res -} - -// nolint: vetshadow -func (ec *executionContext) _CommentTimelineItem_author(ctx context.Context, field graphql.CollectedField, obj *bug.CommentTimelineItem) graphql.Marshaler { - rctx := &graphql.ResolverContext{ - Object: "CommentTimelineItem", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { - return obj.Author, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bug.Person) - rctx.Result = res - - return ec._Person(ctx, field.Selections, &res) -} - -// nolint: vetshadow -func (ec *executionContext) _CommentTimelineItem_message(ctx context.Context, field graphql.CollectedField, obj *bug.CommentTimelineItem) graphql.Marshaler { - rctx := &graphql.ResolverContext{ - Object: "CommentTimelineItem", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { - return obj.Message, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - rctx.Result = res - return graphql.MarshalString(res) -} - -// nolint: vetshadow -func (ec *executionContext) _CommentTimelineItem_files(ctx context.Context, field graphql.CollectedField, obj *bug.CommentTimelineItem) graphql.Marshaler { - rctx := &graphql.ResolverContext{ - Object: "CommentTimelineItem", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { - return obj.Files, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]git.Hash) - rctx.Result = res - - arr1 := make(graphql.Array, len(res)) - - for idx1 := range res { - arr1[idx1] = func() graphql.Marshaler { - return res[idx1] - }() - } - - return arr1 -} - -// nolint: vetshadow -func (ec *executionContext) _CommentTimelineItem_createdAt(ctx context.Context, field graphql.CollectedField, obj *bug.CommentTimelineItem) graphql.Marshaler { - rctx := &graphql.ResolverContext{ - Object: "CommentTimelineItem", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { - return ec.resolvers.CommentTimelineItem().CreatedAt(ctx, obj) - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(time.Time) - rctx.Result = res - return graphql.MarshalTime(res) -} - -// nolint: vetshadow -func (ec *executionContext) _CommentTimelineItem_lastEdit(ctx context.Context, field graphql.CollectedField, obj *bug.CommentTimelineItem) graphql.Marshaler { - rctx := &graphql.ResolverContext{ - Object: "CommentTimelineItem", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { - return ec.resolvers.CommentTimelineItem().LastEdit(ctx, obj) - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(time.Time) - rctx.Result = res - return graphql.MarshalTime(res) -} - -// nolint: vetshadow -func (ec *executionContext) _CommentTimelineItem_edited(ctx context.Context, field graphql.CollectedField, obj *bug.CommentTimelineItem) graphql.Marshaler { - rctx := &graphql.ResolverContext{ - Object: "CommentTimelineItem", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { - return obj.Edited(), nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bool) - rctx.Result = res - return graphql.MarshalBoolean(res) -} - -// nolint: vetshadow -func (ec *executionContext) _CommentTimelineItem_history(ctx context.Context, field graphql.CollectedField, obj *bug.CommentTimelineItem) graphql.Marshaler { - rctx := &graphql.ResolverContext{ - Object: "CommentTimelineItem", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { - return obj.History, nil - }) - if resTmp == nil { - if !ec.HasError(rctx) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]bug.CommentHistoryStep) - rctx.Result = res - - arr1 := make(graphql.Array, len(res)) - var wg sync.WaitGroup - - isLen1 := len(res) == 1 - if !isLen1 { - wg.Add(len(res)) - } - - for idx1 := range res { - idx1 := idx1 - rctx := &graphql.ResolverContext{ - Index: &idx1, - Result: &res[idx1], - } - ctx := graphql.WithResolverContext(ctx, rctx) - f := func(idx1 int) { - if !isLen1 { - defer wg.Done() - } - arr1[idx1] = func() graphql.Marshaler { - - return ec._CommentHistoryStep(ctx, field.Selections, &res[idx1]) - }() - } - if isLen1 { - f(idx1) - } else { - go f(idx1) - } - - } - wg.Wait() - return arr1 -} - var createOperationImplementors = []string{"CreateOperation", "Operation", "Authored"} // nolint: gocyclo, errcheck, gas, goconst @@ -3568,7 +3702,7 @@ func (ec *executionContext) _CreateTimelineItem_hash(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { - return obj.Hash() + return obj.Hash(), nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3778,7 +3912,7 @@ func (ec *executionContext) _CreateTimelineItem_history(ctx context.Context, fie return arr1 } -var labelChangeOperationImplementors = []string{"LabelChangeOperation", "Operation", "Authored", "TimelineItem"} +var labelChangeOperationImplementors = []string{"LabelChangeOperation", "Operation", "Authored"} // nolint: gocyclo, errcheck, gas, goconst func (ec *executionContext) _LabelChangeOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.LabelChangeOperation) graphql.Marshaler { @@ -3966,6 +4100,190 @@ func (ec *executionContext) _LabelChangeOperation_removed(ctx context.Context, f return arr1 } +var labelChangeTimelineItemImplementors = []string{"LabelChangeTimelineItem", "TimelineItem"} + +// nolint: gocyclo, errcheck, gas, goconst +func (ec *executionContext) _LabelChangeTimelineItem(ctx context.Context, sel ast.SelectionSet, obj *bug.LabelChangeTimelineItem) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, labelChangeTimelineItemImplementors) + + var wg sync.WaitGroup + out := graphql.NewOrderedMap(len(fields)) + invalid := false + for i, field := range fields { + out.Keys[i] = field.Alias + + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("LabelChangeTimelineItem") + case "hash": + out.Values[i] = ec._LabelChangeTimelineItem_hash(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "author": + out.Values[i] = ec._LabelChangeTimelineItem_author(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "date": + wg.Add(1) + go func(i int, field graphql.CollectedField) { + out.Values[i] = ec._LabelChangeTimelineItem_date(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + wg.Done() + }(i, field) + case "added": + out.Values[i] = ec._LabelChangeTimelineItem_added(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "removed": + out.Values[i] = ec._LabelChangeTimelineItem_removed(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + wg.Wait() + if invalid { + return graphql.Null + } + return out +} + +// nolint: vetshadow +func (ec *executionContext) _LabelChangeTimelineItem_hash(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeTimelineItem) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "LabelChangeTimelineItem", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return obj.Hash(), nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(git.Hash) + rctx.Result = res + return res +} + +// nolint: vetshadow +func (ec *executionContext) _LabelChangeTimelineItem_author(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeTimelineItem) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "LabelChangeTimelineItem", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return obj.Author, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bug.Person) + rctx.Result = res + + return ec._Person(ctx, field.Selections, &res) +} + +// nolint: vetshadow +func (ec *executionContext) _LabelChangeTimelineItem_date(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeTimelineItem) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "LabelChangeTimelineItem", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return ec.resolvers.LabelChangeTimelineItem().Date(ctx, obj) + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(time.Time) + rctx.Result = res + return graphql.MarshalTime(res) +} + +// nolint: vetshadow +func (ec *executionContext) _LabelChangeTimelineItem_added(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeTimelineItem) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "LabelChangeTimelineItem", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return obj.Added, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]bug.Label) + rctx.Result = res + + arr1 := make(graphql.Array, len(res)) + + for idx1 := range res { + arr1[idx1] = func() graphql.Marshaler { + return res[idx1] + }() + } + + return arr1 +} + +// nolint: vetshadow +func (ec *executionContext) _LabelChangeTimelineItem_removed(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeTimelineItem) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "LabelChangeTimelineItem", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return obj.Removed, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]bug.Label) + rctx.Result = res + + arr1 := make(graphql.Array, len(res)) + + for idx1 := range res { + arr1[idx1] = func() graphql.Marshaler { + return res[idx1] + }() + } + + return arr1 +} + var mutationImplementors = []string{"Mutation"} // nolint: gocyclo, errcheck, gas, goconst @@ -4994,7 +5312,7 @@ func (ec *executionContext) _Repository_bug(ctx context.Context, field graphql.C return ec._Bug(ctx, field.Selections, res) } -var setStatusOperationImplementors = []string{"SetStatusOperation", "Operation", "Authored", "TimelineItem"} +var setStatusOperationImplementors = []string{"SetStatusOperation", "Operation", "Authored"} // nolint: gocyclo, errcheck, gas, goconst func (ec *executionContext) _SetStatusOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.SetStatusOperation) graphql.Marshaler { @@ -5141,7 +5459,150 @@ func (ec *executionContext) _SetStatusOperation_status(ctx context.Context, fiel return res } -var setTitleOperationImplementors = []string{"SetTitleOperation", "Operation", "Authored", "TimelineItem"} +var setStatusTimelineItemImplementors = []string{"SetStatusTimelineItem", "TimelineItem"} + +// nolint: gocyclo, errcheck, gas, goconst +func (ec *executionContext) _SetStatusTimelineItem(ctx context.Context, sel ast.SelectionSet, obj *bug.SetStatusTimelineItem) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, setStatusTimelineItemImplementors) + + var wg sync.WaitGroup + out := graphql.NewOrderedMap(len(fields)) + invalid := false + for i, field := range fields { + out.Keys[i] = field.Alias + + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("SetStatusTimelineItem") + case "hash": + out.Values[i] = ec._SetStatusTimelineItem_hash(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "author": + out.Values[i] = ec._SetStatusTimelineItem_author(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "date": + wg.Add(1) + go func(i int, field graphql.CollectedField) { + out.Values[i] = ec._SetStatusTimelineItem_date(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + wg.Done() + }(i, field) + case "status": + wg.Add(1) + go func(i int, field graphql.CollectedField) { + out.Values[i] = ec._SetStatusTimelineItem_status(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + wg.Done() + }(i, field) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + wg.Wait() + if invalid { + return graphql.Null + } + return out +} + +// nolint: vetshadow +func (ec *executionContext) _SetStatusTimelineItem_hash(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusTimelineItem) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "SetStatusTimelineItem", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return obj.Hash(), nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(git.Hash) + rctx.Result = res + return res +} + +// nolint: vetshadow +func (ec *executionContext) _SetStatusTimelineItem_author(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusTimelineItem) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "SetStatusTimelineItem", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return obj.Author, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bug.Person) + rctx.Result = res + + return ec._Person(ctx, field.Selections, &res) +} + +// nolint: vetshadow +func (ec *executionContext) _SetStatusTimelineItem_date(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusTimelineItem) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "SetStatusTimelineItem", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return ec.resolvers.SetStatusTimelineItem().Date(ctx, obj) + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(time.Time) + rctx.Result = res + return graphql.MarshalTime(res) +} + +// nolint: vetshadow +func (ec *executionContext) _SetStatusTimelineItem_status(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusTimelineItem) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "SetStatusTimelineItem", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return ec.resolvers.SetStatusTimelineItem().Status(ctx, obj) + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(models.Status) + rctx.Result = res + return res +} + +var setTitleOperationImplementors = []string{"SetTitleOperation", "Operation", "Authored"} // nolint: gocyclo, errcheck, gas, goconst func (ec *executionContext) _SetTitleOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.SetTitleOperation) graphql.Marshaler { @@ -5311,6 +5772,172 @@ func (ec *executionContext) _SetTitleOperation_was(ctx context.Context, field gr return graphql.MarshalString(res) } +var setTitleTimelineItemImplementors = []string{"SetTitleTimelineItem", "TimelineItem"} + +// nolint: gocyclo, errcheck, gas, goconst +func (ec *executionContext) _SetTitleTimelineItem(ctx context.Context, sel ast.SelectionSet, obj *bug.SetTitleTimelineItem) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, setTitleTimelineItemImplementors) + + var wg sync.WaitGroup + out := graphql.NewOrderedMap(len(fields)) + invalid := false + for i, field := range fields { + out.Keys[i] = field.Alias + + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("SetTitleTimelineItem") + case "hash": + out.Values[i] = ec._SetTitleTimelineItem_hash(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "author": + out.Values[i] = ec._SetTitleTimelineItem_author(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "date": + wg.Add(1) + go func(i int, field graphql.CollectedField) { + out.Values[i] = ec._SetTitleTimelineItem_date(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + wg.Done() + }(i, field) + case "title": + out.Values[i] = ec._SetTitleTimelineItem_title(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "was": + out.Values[i] = ec._SetTitleTimelineItem_was(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + wg.Wait() + if invalid { + return graphql.Null + } + return out +} + +// nolint: vetshadow +func (ec *executionContext) _SetTitleTimelineItem_hash(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "SetTitleTimelineItem", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return obj.Hash(), nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(git.Hash) + rctx.Result = res + return res +} + +// nolint: vetshadow +func (ec *executionContext) _SetTitleTimelineItem_author(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "SetTitleTimelineItem", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return obj.Author, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bug.Person) + rctx.Result = res + + return ec._Person(ctx, field.Selections, &res) +} + +// nolint: vetshadow +func (ec *executionContext) _SetTitleTimelineItem_date(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "SetTitleTimelineItem", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return ec.resolvers.SetTitleTimelineItem().Date(ctx, obj) + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(time.Time) + rctx.Result = res + return graphql.MarshalTime(res) +} + +// nolint: vetshadow +func (ec *executionContext) _SetTitleTimelineItem_title(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "SetTitleTimelineItem", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return obj.Title, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + rctx.Result = res + return graphql.MarshalString(res) +} + +// nolint: vetshadow +func (ec *executionContext) _SetTitleTimelineItem_was(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "SetTitleTimelineItem", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return obj.Was, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + rctx.Result = res + return graphql.MarshalString(res) +} + var timelineItemConnectionImplementors = []string{"TimelineItemConnection"} // nolint: gocyclo, errcheck, gas, goconst @@ -6924,16 +7551,22 @@ func (ec *executionContext) _TimelineItem(ctx context.Context, sel ast.Selection switch obj := (*obj).(type) { case nil: return graphql.Null - case *bug.SetTitleOperation: - return ec._SetTitleOperation(ctx, sel, obj) - case *bug.SetStatusOperation: - return ec._SetStatusOperation(ctx, sel, obj) - case *bug.LabelChangeOperation: - return ec._LabelChangeOperation(ctx, sel, obj) case *bug.CreateTimelineItem: return ec._CreateTimelineItem(ctx, sel, obj) - case *bug.CommentTimelineItem: - return ec._CommentTimelineItem(ctx, sel, obj) + case *bug.AddCommentTimelineItem: + return ec._AddCommentTimelineItem(ctx, sel, obj) + case bug.LabelChangeTimelineItem: + return ec._LabelChangeTimelineItem(ctx, sel, &obj) + case *bug.LabelChangeTimelineItem: + return ec._LabelChangeTimelineItem(ctx, sel, obj) + case bug.SetStatusTimelineItem: + return ec._SetStatusTimelineItem(ctx, sel, &obj) + case *bug.SetStatusTimelineItem: + return ec._SetStatusTimelineItem(ctx, sel, obj) + case bug.SetTitleTimelineItem: + return ec._SetTitleTimelineItem(ctx, sel, &obj) + case *bug.SetTitleTimelineItem: + return ec._SetTitleTimelineItem(ctx, sel, obj) default: panic(fmt.Errorf("unexpected type %T", obj)) } @@ -7060,7 +7693,7 @@ type CreateOperation implements Operation & Authored { files: [Hash!]! } -type SetTitleOperation implements Operation & Authored & TimelineItem { +type SetTitleOperation implements Operation & Authored { hash: Hash! author: Person! date: Time! @@ -7077,7 +7710,7 @@ type AddCommentOperation implements Operation & Authored { files: [Hash!]! } -type SetStatusOperation implements Operation & Authored & TimelineItem { +type SetStatusOperation implements Operation & Authored { hash: Hash! author: Person! date: Time! @@ -7085,7 +7718,7 @@ type SetStatusOperation implements Operation & Authored & TimelineItem { status: Status! } -type LabelChangeOperation implements Operation & Authored & TimelineItem { +type LabelChangeOperation implements Operation & Authored { hash: Hash! author: Person! date: Time! @@ -7122,7 +7755,7 @@ type CreateTimelineItem implements TimelineItem { history: [CommentHistoryStep!]! } -type CommentTimelineItem implements TimelineItem { +type AddCommentTimelineItem implements TimelineItem { hash: Hash! author: Person! message: String! @@ -7133,6 +7766,29 @@ type CommentTimelineItem implements TimelineItem { history: [CommentHistoryStep!]! } +type LabelChangeTimelineItem implements TimelineItem { + hash: Hash! + author: Person! + date: Time! + added: [Label!]! + removed: [Label!]! +} + +type SetStatusTimelineItem implements TimelineItem { + hash: Hash! + author: Person! + date: Time! + status: Status! +} + +type SetTitleTimelineItem implements TimelineItem { + hash: Hash! + author: Person! + date: Time! + title: String! + was: String! +} + """The connection type for Bug.""" type BugConnection { """A list of edges.""" diff --git a/graphql/resolvers/root.go b/graphql/resolvers/root.go index 2322edc7..b1ce0356 100644 --- a/graphql/resolvers/root.go +++ b/graphql/resolvers/root.go @@ -40,14 +40,26 @@ func (RootResolver) CommentHistoryStep() graph.CommentHistoryStepResolver { return &commentHistoryStepResolver{} } -func (RootResolver) CommentTimelineItem() graph.CommentTimelineItemResolver { - return &commentTimelineItemResolver{} +func (RootResolver) AddCommentTimelineItem() graph.AddCommentTimelineItemResolver { + return &addCommentTimelineItemResolver{} } func (RootResolver) CreateTimelineItem() graph.CreateTimelineItemResolver { return &createTimelineItemResolver{} } +func (r RootResolver) LabelChangeTimelineItem() graph.LabelChangeTimelineItemResolver { + return &labelChangeTimelineItem{} +} + +func (r RootResolver) SetStatusTimelineItem() graph.SetStatusTimelineItemResolver { + return &setStatusTimelineItem{} +} + +func (r RootResolver) SetTitleTimelineItem() graph.SetTitleTimelineItemResolver { + return &setTitleTimelineItem{} +} + func (RootResolver) CreateOperation() graph.CreateOperationResolver { return &createOperationResolver{} } diff --git a/graphql/resolvers/timeline.go b/graphql/resolvers/timeline.go index 9b8262fe..42e0a643 100644 --- a/graphql/resolvers/timeline.go +++ b/graphql/resolvers/timeline.go @@ -5,6 +5,7 @@ import ( "time" "github.com/MichaelMure/git-bug/bug" + "github.com/MichaelMure/git-bug/graphql/models" ) type commentHistoryStepResolver struct{} @@ -13,13 +14,13 @@ func (commentHistoryStepResolver) Date(ctx context.Context, obj *bug.CommentHist return obj.UnixTime.Time(), nil } -type commentTimelineItemResolver struct{} +type addCommentTimelineItemResolver struct{} -func (commentTimelineItemResolver) CreatedAt(ctx context.Context, obj *bug.CommentTimelineItem) (time.Time, error) { +func (addCommentTimelineItemResolver) CreatedAt(ctx context.Context, obj *bug.AddCommentTimelineItem) (time.Time, error) { return obj.CreatedAt.Time(), nil } -func (commentTimelineItemResolver) LastEdit(ctx context.Context, obj *bug.CommentTimelineItem) (time.Time, error) { +func (addCommentTimelineItemResolver) LastEdit(ctx context.Context, obj *bug.AddCommentTimelineItem) (time.Time, error) { return obj.LastEdit.Time(), nil } @@ -27,10 +28,30 @@ type createTimelineItemResolver struct{} func (createTimelineItemResolver) CreatedAt(ctx context.Context, obj *bug.CreateTimelineItem) (time.Time, error) { return obj.CreatedAt.Time(), nil - } func (createTimelineItemResolver) LastEdit(ctx context.Context, obj *bug.CreateTimelineItem) (time.Time, error) { return obj.LastEdit.Time(), nil +} + +type labelChangeTimelineItem struct{} + +func (labelChangeTimelineItem) Date(ctx context.Context, obj *bug.LabelChangeTimelineItem) (time.Time, error) { + return obj.UnixTime.Time(), nil +} + +type setStatusTimelineItem struct{} +func (setStatusTimelineItem) Date(ctx context.Context, obj *bug.SetStatusTimelineItem) (time.Time, error) { + return obj.UnixTime.Time(), nil +} + +func (setStatusTimelineItem) Status(ctx context.Context, obj *bug.SetStatusTimelineItem) (models.Status, error) { + return convertStatus(obj.Status) +} + +type setTitleTimelineItem struct{} + +func (setTitleTimelineItem) Date(ctx context.Context, obj *bug.SetTitleTimelineItem) (time.Time, error) { + return obj.UnixTime.Time(), nil } diff --git a/graphql/schema.graphql b/graphql/schema.graphql index 5c0d759f..73e457c5 100644 --- a/graphql/schema.graphql +++ b/graphql/schema.graphql @@ -95,7 +95,7 @@ type CreateOperation implements Operation & Authored { files: [Hash!]! } -type SetTitleOperation implements Operation & Authored & TimelineItem { +type SetTitleOperation implements Operation & Authored { hash: Hash! author: Person! date: Time! @@ -112,7 +112,7 @@ type AddCommentOperation implements Operation & Authored { files: [Hash!]! } -type SetStatusOperation implements Operation & Authored & TimelineItem { +type SetStatusOperation implements Operation & Authored { hash: Hash! author: Person! date: Time! @@ -120,7 +120,7 @@ type SetStatusOperation implements Operation & Authored & TimelineItem { status: Status! } -type LabelChangeOperation implements Operation & Authored & TimelineItem { +type LabelChangeOperation implements Operation & Authored { hash: Hash! author: Person! date: Time! @@ -157,7 +157,7 @@ type CreateTimelineItem implements TimelineItem { history: [CommentHistoryStep!]! } -type CommentTimelineItem implements TimelineItem { +type AddCommentTimelineItem implements TimelineItem { hash: Hash! author: Person! message: String! @@ -168,6 +168,29 @@ type CommentTimelineItem implements TimelineItem { history: [CommentHistoryStep!]! } +type LabelChangeTimelineItem implements TimelineItem { + hash: Hash! + author: Person! + date: Time! + added: [Label!]! + removed: [Label!]! +} + +type SetStatusTimelineItem implements TimelineItem { + hash: Hash! + author: Person! + date: Time! + status: Status! +} + +type SetTitleTimelineItem implements TimelineItem { + hash: Hash! + author: Person! + date: Time! + title: String! + was: String! +} + """The connection type for Bug.""" type BugConnection { """A list of edges.""" |