From 7f86898ef9a8f9e866835ece3c9824a8edc58036 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Mur=C3=A9?= Date: Sun, 30 Sep 2018 17:15:54 +0200 Subject: [PATCH] bug: use deditated type for all TimelineItem --- bug/op_add_comment.go | 11 +- bug/op_create.go | 9 +- bug/op_create_test.go | 4 +- bug/op_edit_comment.go | 11 +- bug/op_edit_comment_test.go | 4 +- bug/op_label_change.go | 29 +- bug/op_set_status.go | 28 +- bug/op_set_title.go | 30 +- bug/snapshot.go | 7 +- bug/timeline.go | 36 +- graphql/gqlgen.yml | 10 +- graphql/graph/gen_graph.go | 1846 ++++++++++++++++++++++----------- graphql/resolvers/root.go | 16 +- graphql/resolvers/timeline.go | 29 +- graphql/schema.graphql | 31 +- termui/show_bug.go | 22 +- 16 files changed, 1453 insertions(+), 670 deletions(-) diff --git a/bug/op_add_comment.go b/bug/op_add_comment.go index 7f8b8b5b800bbeadb217ac66827455ea95c0e53b..156a8f717981977182e69306b0a1f05b9cde1bce 100644 --- a/bug/op_add_comment.go +++ b/bug/op_add_comment.go @@ -42,7 +42,11 @@ func (op *AddCommentOperation) Apply(snapshot *Snapshot) { panic(err) } - snapshot.Timeline = append(snapshot.Timeline, NewCommentTimelineItem(hash, comment)) + item := &AddCommentTimelineItem{ + CommentTimelineItem: NewCommentTimelineItem(hash, comment), + } + + snapshot.Timeline = append(snapshot.Timeline, item) } func (op *AddCommentOperation) GetFiles() []git.Hash { @@ -73,6 +77,11 @@ func NewAddCommentOp(author Person, unixTime int64, message string, files []git. } } +// CreateTimelineItem replace a AddComment operation in the Timeline and hold its edition history +type AddCommentTimelineItem struct { + CommentTimelineItem +} + // Convenience function to apply the operation func AddComment(b Interface, author Person, unixTime int64, message string) error { return AddCommentWithFiles(b, author, unixTime, message, nil) diff --git a/bug/op_create.go b/bug/op_create.go index 0553137f250eedd5698262e830fd026eba55ad6b..200da4ae57347ca1c24ac3d46c6b4921541b4e15 100644 --- a/bug/op_create.go +++ b/bug/op_create.go @@ -47,7 +47,9 @@ func (op *CreateOperation) Apply(snapshot *Snapshot) { } snapshot.Timeline = []TimelineItem{ - NewCreateTimelineItem(hash, comment), + &CreateTimelineItem{ + CommentTimelineItem: NewCommentTimelineItem(hash, comment), + }, } } @@ -88,6 +90,11 @@ func NewCreateOp(author Person, unixTime int64, title, message string, files []g } } +// CreateTimelineItem replace a Create operation in the Timeline and hold its edition history +type CreateTimelineItem struct { + CommentTimelineItem +} + // Convenience function to apply the operation func Create(author Person, unixTime int64, title, message string) (*Bug, error) { return CreateWithFiles(author, unixTime, title, message, nil) diff --git a/bug/op_create_test.go b/bug/op_create_test.go index f27f6ee08bd4fb59504bc733b6769437487348e9..d74051ecfc4733ec04d51f6d943af6eea164dee0 100644 --- a/bug/op_create_test.go +++ b/bug/op_create_test.go @@ -36,7 +36,9 @@ func TestCreate(t *testing.T) { Author: rene, CreatedAt: create.Time(), Timeline: []TimelineItem{ - NewCreateTimelineItem(hash, comment), + &CreateTimelineItem{ + CommentTimelineItem: NewCommentTimelineItem(hash, comment), + }, }, } diff --git a/bug/op_edit_comment.go b/bug/op_edit_comment.go index cb4a22169fdd79cd2715dcb0ce0cfbb30d4f44ac..78976af7a3e0a7137cd465a3de242a0b102704a4 100644 --- a/bug/op_edit_comment.go +++ b/bug/op_edit_comment.go @@ -33,12 +33,7 @@ func (op *EditCommentOperation) Apply(snapshot *Snapshot) { var commentIndex int for i, item := range snapshot.Timeline { - h, err := item.Hash() - - if err != nil { - // Should never happen, we control what goes into the timeline - panic(err) - } + h := item.Hash() if h == op.Target { target = snapshot.Timeline[i] @@ -68,8 +63,8 @@ func (op *EditCommentOperation) Apply(snapshot *Snapshot) { item := target.(*CreateTimelineItem) item.Append(comment) - case *CommentTimelineItem: - item := target.(*CommentTimelineItem) + case *AddCommentTimelineItem: + item := target.(*AddCommentTimelineItem) item.Append(comment) } diff --git a/bug/op_edit_comment_test.go b/bug/op_edit_comment_test.go index 9c32051d2f91a6da5e5213820f5f1e36b303a815..71a7dda287265a3ac7fa90260b4a154800ea3c9d 100644 --- a/bug/op_edit_comment_test.go +++ b/bug/op_edit_comment_test.go @@ -38,7 +38,7 @@ func TestEdit(t *testing.T) { assert.Equal(t, len(snapshot.Timeline), 2) assert.Equal(t, len(snapshot.Timeline[0].(*CreateTimelineItem).History), 2) - assert.Equal(t, len(snapshot.Timeline[1].(*CommentTimelineItem).History), 1) + assert.Equal(t, len(snapshot.Timeline[1].(*AddCommentTimelineItem).History), 1) assert.Equal(t, snapshot.Comments[0].Message, "create edited") assert.Equal(t, snapshot.Comments[1].Message, "comment") @@ -47,7 +47,7 @@ func TestEdit(t *testing.T) { assert.Equal(t, len(snapshot.Timeline), 2) assert.Equal(t, len(snapshot.Timeline[0].(*CreateTimelineItem).History), 2) - assert.Equal(t, len(snapshot.Timeline[1].(*CommentTimelineItem).History), 2) + assert.Equal(t, len(snapshot.Timeline[1].(*AddCommentTimelineItem).History), 2) assert.Equal(t, snapshot.Comments[0].Message, "create edited") assert.Equal(t, snapshot.Comments[1].Message, "comment edited") } diff --git a/bug/op_label_change.go b/bug/op_label_change.go index 5f2dbd6fef5daacab5a8f4447256d623aee2a723..b025be817426e01b1e49c5283d386dd001188e9f 100644 --- a/bug/op_label_change.go +++ b/bug/op_label_change.go @@ -55,7 +55,22 @@ AddLoop: return string(snapshot.Labels[i]) < string(snapshot.Labels[j]) }) - snapshot.Timeline = append(snapshot.Timeline, op) + hash, err := op.Hash() + if err != nil { + // Should never error unless a programming error happened + // (covered in OpBase.Validate()) + panic(err) + } + + item := &LabelChangeTimelineItem{ + hash: hash, + Author: op.Author, + UnixTime: Timestamp(op.UnixTime), + Added: op.Added, + Removed: op.Removed, + } + + snapshot.Timeline = append(snapshot.Timeline, item) } func (op *LabelChangeOperation) Validate() error { @@ -90,6 +105,18 @@ func NewLabelChangeOperation(author Person, unixTime int64, added, removed []Lab } } +type LabelChangeTimelineItem struct { + hash git.Hash + Author Person + UnixTime Timestamp + Added []Label + Removed []Label +} + +func (l LabelChangeTimelineItem) Hash() git.Hash { + return l.hash +} + // ChangeLabels is a convenience function to apply the operation func ChangeLabels(b Interface, author Person, unixTime int64, add, remove []string) ([]LabelChangeResult, error) { var added, removed []Label diff --git a/bug/op_set_status.go b/bug/op_set_status.go index cdfa25e740d206904e7281486cb9a512ecf87d04..7e9f4314ab85646330f94e2501e41491b42be7e6 100644 --- a/bug/op_set_status.go +++ b/bug/op_set_status.go @@ -23,7 +23,22 @@ func (op *SetStatusOperation) Hash() (git.Hash, error) { func (op *SetStatusOperation) Apply(snapshot *Snapshot) { snapshot.Status = op.Status - snapshot.Timeline = append(snapshot.Timeline, op) + + hash, err := op.Hash() + if err != nil { + // Should never error unless a programming error happened + // (covered in OpBase.Validate()) + panic(err) + } + + item := &SetStatusTimelineItem{ + hash: hash, + Author: op.Author, + UnixTime: Timestamp(op.UnixTime), + Status: op.Status, + } + + snapshot.Timeline = append(snapshot.Timeline, item) } func (op *SetStatusOperation) Validate() error { @@ -45,6 +60,17 @@ func NewSetStatusOp(author Person, unixTime int64, status Status) *SetStatusOper } } +type SetStatusTimelineItem struct { + hash git.Hash + Author Person + UnixTime Timestamp + Status Status +} + +func (s SetStatusTimelineItem) Hash() git.Hash { + return s.hash +} + // Convenience function to apply the operation func Open(b Interface, author Person, unixTime int64) error { op := NewSetStatusOp(author, unixTime, OpenStatus) diff --git a/bug/op_set_title.go b/bug/op_set_title.go index 74467ec2bcc5f5e53c2e0c236f8f237c76ec9908..fd964a30400ebdb88b720e094e023d5003be6dcb 100644 --- a/bug/op_set_title.go +++ b/bug/op_set_title.go @@ -27,7 +27,23 @@ func (op *SetTitleOperation) Hash() (git.Hash, error) { func (op *SetTitleOperation) Apply(snapshot *Snapshot) { snapshot.Title = op.Title - snapshot.Timeline = append(snapshot.Timeline, op) + + hash, err := op.Hash() + if err != nil { + // Should never error unless a programming error happened + // (covered in OpBase.Validate()) + panic(err) + } + + item := &SetTitleTimelineItem{ + hash: hash, + Author: op.Author, + UnixTime: Timestamp(op.UnixTime), + Title: op.Title, + Was: op.Was, + } + + snapshot.Timeline = append(snapshot.Timeline, item) } func (op *SetTitleOperation) Validate() error { @@ -66,6 +82,18 @@ func NewSetTitleOp(author Person, unixTime int64, title string, was string) *Set } } +type SetTitleTimelineItem struct { + hash git.Hash + Author Person + UnixTime Timestamp + Title string + Was string +} + +func (s SetTitleTimelineItem) Hash() git.Hash { + return s.hash +} + // Convenience function to apply the operation func SetTitle(b Interface, author Person, unixTime int64, title string) error { it := NewOperationIterator(b) diff --git a/bug/snapshot.go b/bug/snapshot.go index df39ff46e0df31798730093d3fe8c4e1cd70d452..28a929614fdaa73302479165c5535a16117413b0 100644 --- a/bug/snapshot.go +++ b/bug/snapshot.go @@ -61,12 +61,7 @@ func (snap *Snapshot) LastEditUnix() int64 { // SearchTimelineItem will search in the timeline for an item matching the given hash func (snap *Snapshot) SearchTimelineItem(hash git.Hash) (TimelineItem, error) { for i := range snap.Timeline { - h, err := snap.Timeline[i].Hash() - if err != nil { - return nil, err - } - - if h == hash { + if snap.Timeline[i].Hash() == hash { return snap.Timeline[i], nil } } diff --git a/bug/timeline.go b/bug/timeline.go index d734e18b622841a08819cfcf0e7aa7c4eeaa600b..f2feafbae82f3fa3f0727d7bf853c15827bde298 100644 --- a/bug/timeline.go +++ b/bug/timeline.go @@ -6,7 +6,7 @@ import ( type TimelineItem interface { // Hash return the hash of the item - Hash() (git.Hash, error) + Hash() git.Hash } type CommentHistoryStep struct { @@ -14,31 +14,7 @@ type CommentHistoryStep struct { UnixTime Timestamp } -// CreateTimelineItem replace a Create operation in the Timeline and hold its edition history -type CreateTimelineItem struct { - CommentTimelineItem -} - -func NewCreateTimelineItem(hash git.Hash, comment Comment) *CreateTimelineItem { - return &CreateTimelineItem{ - CommentTimelineItem: CommentTimelineItem{ - hash: hash, - Author: comment.Author, - Message: comment.Message, - Files: comment.Files, - CreatedAt: comment.UnixTime, - LastEdit: comment.UnixTime, - History: []CommentHistoryStep{ - { - Message: comment.Message, - UnixTime: comment.UnixTime, - }, - }, - }, - } -} - -// CommentTimelineItem replace a Comment in the Timeline and hold its edition history +// CommentTimelineItem is a TimelineItem that holds a Comment and its edition history type CommentTimelineItem struct { hash git.Hash Author Person @@ -49,8 +25,8 @@ type CommentTimelineItem struct { History []CommentHistoryStep } -func NewCommentTimelineItem(hash git.Hash, comment Comment) *CommentTimelineItem { - return &CommentTimelineItem{ +func NewCommentTimelineItem(hash git.Hash, comment Comment) CommentTimelineItem { + return CommentTimelineItem{ hash: hash, Author: comment.Author, Message: comment.Message, @@ -66,8 +42,8 @@ func NewCommentTimelineItem(hash git.Hash, comment Comment) *CommentTimelineItem } } -func (c *CommentTimelineItem) Hash() (git.Hash, error) { - return c.hash, nil +func (c *CommentTimelineItem) Hash() git.Hash { + return c.hash } // Append will append a new comment in the history and update the other values diff --git a/graphql/gqlgen.yml b/graphql/gqlgen.yml index 9c0e08429f1dfc49139ca2040b1e4d913ffff0c7..3932eafea03c251ad4dde1345c983a8fb6ee534d 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 01e3bb914e5e09a9b088347c3dfcdd823ec55ebf..f9cc91f9484053a20b29e7b4bb982f44fa6e168c 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,11 +2013,11 @@ func (ec *executionContext) _AddCommentOperation_files(ctx context.Context, fiel return arr1 } -var bugImplementors = []string{"Bug"} +var addCommentTimelineItemImplementors = []string{"AddCommentTimelineItem", "TimelineItem"} // nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _Bug(ctx context.Context, sel ast.SelectionSet, obj *bug.Snapshot) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, bugImplementors) +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)) @@ -1893,82 +2027,55 @@ func (ec *executionContext) _Bug(ctx context.Context, sel ast.SelectionSet, obj switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("Bug") - case "id": - out.Values[i] = ec._Bug_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "humanId": - out.Values[i] = ec._Bug_humanId(ctx, field, obj) + 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 "status": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Bug_status(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "title": - out.Values[i] = ec._Bug_title(ctx, field, obj) + case "author": + out.Values[i] = ec._AddCommentTimelineItem_author(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } - case "labels": - out.Values[i] = ec._Bug_labels(ctx, field, obj) + case "message": + out.Values[i] = ec._AddCommentTimelineItem_message(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } - case "author": - out.Values[i] = ec._Bug_author(ctx, field, obj) + case "files": + out.Values[i] = ec._AddCommentTimelineItem_files(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } case "createdAt": - out.Values[i] = ec._Bug_createdAt(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - case "lastEdit": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Bug_lastEdit(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "comments": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Bug_comments(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) - case "timeline": wg.Add(1) go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Bug_timeline(ctx, field, obj) + out.Values[i] = ec._AddCommentTimelineItem_createdAt(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } wg.Done() }(i, field) - case "operations": + case "lastEdit": wg.Add(1) go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Bug_operations(ctx, field, obj) + 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)) } @@ -1981,15 +2088,15 @@ func (ec *executionContext) _Bug(ctx context.Context, sel ast.SelectionSet, obj } // nolint: vetshadow -func (ec *executionContext) _Bug_id(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { +func (ec *executionContext) _AddCommentTimelineItem_hash(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { rctx := &graphql.ResolverContext{ - Object: "Bug", + Object: "AddCommentTimelineItem", Args: nil, Field: field, } ctx = graphql.WithResolverContext(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { - return obj.Id(), nil + return obj.Hash(), nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -1997,21 +2104,21 @@ func (ec *executionContext) _Bug_id(ctx context.Context, field graphql.Collected } return graphql.Null } - res := resTmp.(string) + res := resTmp.(git.Hash) rctx.Result = res - return graphql.MarshalString(res) + return res } // nolint: vetshadow -func (ec *executionContext) _Bug_humanId(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { +func (ec *executionContext) _AddCommentTimelineItem_author(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { rctx := &graphql.ResolverContext{ - Object: "Bug", + Object: "AddCommentTimelineItem", Args: nil, Field: field, } ctx = graphql.WithResolverContext(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { - return obj.HumanId(), nil + return obj.Author, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -2019,21 +2126,22 @@ func (ec *executionContext) _Bug_humanId(ctx context.Context, field graphql.Coll } return graphql.Null } - res := resTmp.(string) + res := resTmp.(bug.Person) rctx.Result = res - return graphql.MarshalString(res) + + return ec._Person(ctx, field.Selections, &res) } // nolint: vetshadow -func (ec *executionContext) _Bug_status(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { +func (ec *executionContext) _AddCommentTimelineItem_message(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { rctx := &graphql.ResolverContext{ - Object: "Bug", + 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.Bug().Status(ctx, obj) + return obj.Message, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -2041,15 +2149,334 @@ func (ec *executionContext) _Bug_status(ctx context.Context, field graphql.Colle } return graphql.Null } - res := resTmp.(models.Status) + res := resTmp.(string) rctx.Result = res - return res + return graphql.MarshalString(res) } // nolint: vetshadow -func (ec *executionContext) _Bug_title(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { +func (ec *executionContext) _AddCommentTimelineItem_files(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) graphql.Marshaler { rctx := &graphql.ResolverContext{ - Object: "Bug", + 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 +func (ec *executionContext) _Bug(ctx context.Context, sel ast.SelectionSet, obj *bug.Snapshot) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, bugImplementors) + + 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("Bug") + case "id": + out.Values[i] = ec._Bug_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "humanId": + out.Values[i] = ec._Bug_humanId(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "status": + wg.Add(1) + go func(i int, field graphql.CollectedField) { + out.Values[i] = ec._Bug_status(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + wg.Done() + }(i, field) + case "title": + out.Values[i] = ec._Bug_title(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "labels": + out.Values[i] = ec._Bug_labels(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "author": + out.Values[i] = ec._Bug_author(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "createdAt": + out.Values[i] = ec._Bug_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "lastEdit": + wg.Add(1) + go func(i int, field graphql.CollectedField) { + out.Values[i] = ec._Bug_lastEdit(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + wg.Done() + }(i, field) + case "comments": + wg.Add(1) + go func(i int, field graphql.CollectedField) { + out.Values[i] = ec._Bug_comments(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + wg.Done() + }(i, field) + case "timeline": + wg.Add(1) + go func(i int, field graphql.CollectedField) { + out.Values[i] = ec._Bug_timeline(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + wg.Done() + }(i, field) + case "operations": + wg.Add(1) + go func(i int, field graphql.CollectedField) { + out.Values[i] = ec._Bug_operations(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) _Bug_id(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "Bug", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return obj.Id(), 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) _Bug_humanId(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "Bug", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return obj.HumanId(), 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) _Bug_status(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "Bug", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return ec.resolvers.Bug().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 +} + +// nolint: vetshadow +func (ec *executionContext) _Bug_title(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "Bug", Args: nil, Field: field, } @@ -2939,306 +3366,46 @@ func (ec *executionContext) _CommentHistoryStep(ctx context.Context, sel ast.Sel 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("CommentHistoryStep") - case "message": - out.Values[i] = ec._CommentHistoryStep_message(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._CommentHistoryStep_date(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) _CommentHistoryStep_message(ctx context.Context, field graphql.CollectedField, obj *bug.CommentHistoryStep) graphql.Marshaler { - rctx := &graphql.ResolverContext{ - Object: "CommentHistoryStep", - 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) _CommentHistoryStep_date(ctx context.Context, field graphql.CollectedField, obj *bug.CommentHistoryStep) graphql.Marshaler { - rctx := &graphql.ResolverContext{ - Object: "CommentHistoryStep", - Args: nil, - Field: field, - } - ctx = graphql.WithResolverContext(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { - return ec.resolvers.CommentHistoryStep().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) -} - -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) -} + out.Keys[i] = field.Alias -// 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") + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("CommentHistoryStep") + case "message": + out.Values[i] = ec._CommentHistoryStep_message(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._CommentHistoryStep_date(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 } - res := resTmp.(time.Time) - rctx.Result = res - return graphql.MarshalTime(res) + return out } // nolint: vetshadow -func (ec *executionContext) _CommentTimelineItem_edited(ctx context.Context, field graphql.CollectedField, obj *bug.CommentTimelineItem) graphql.Marshaler { +func (ec *executionContext) _CommentHistoryStep_message(ctx context.Context, field graphql.CollectedField, obj *bug.CommentHistoryStep) graphql.Marshaler { rctx := &graphql.ResolverContext{ - Object: "CommentTimelineItem", + Object: "CommentHistoryStep", Args: nil, Field: field, } ctx = graphql.WithResolverContext(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { - return obj.Edited(), nil + return obj.Message, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3246,21 +3413,21 @@ func (ec *executionContext) _CommentTimelineItem_edited(ctx context.Context, fie } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(string) rctx.Result = res - return graphql.MarshalBoolean(res) + return graphql.MarshalString(res) } // nolint: vetshadow -func (ec *executionContext) _CommentTimelineItem_history(ctx context.Context, field graphql.CollectedField, obj *bug.CommentTimelineItem) graphql.Marshaler { +func (ec *executionContext) _CommentHistoryStep_date(ctx context.Context, field graphql.CollectedField, obj *bug.CommentHistoryStep) graphql.Marshaler { rctx := &graphql.ResolverContext{ - Object: "CommentTimelineItem", + Object: "CommentHistoryStep", Args: nil, Field: field, } ctx = graphql.WithResolverContext(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { - return obj.History, nil + return ec.resolvers.CommentHistoryStep().Date(ctx, obj) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -3268,42 +3435,9 @@ func (ec *executionContext) _CommentTimelineItem_history(ctx context.Context, fi } return graphql.Null } - res := resTmp.([]bug.CommentHistoryStep) + res := resTmp.(time.Time) 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 + return graphql.MarshalTime(res) } var createOperationImplementors = []string{"CreateOperation", "Operation", "Authored"} @@ -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 { @@ -3891,7 +4025,191 @@ func (ec *executionContext) _LabelChangeOperation_date(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { - return ec.resolvers.LabelChangeOperation().Date(ctx, obj) + return ec.resolvers.LabelChangeOperation().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) _LabelChangeOperation_added(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeOperation) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "LabelChangeOperation", + 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) _LabelChangeOperation_removed(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeOperation) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "LabelChangeOperation", + 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 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) { @@ -3905,9 +4223,9 @@ func (ec *executionContext) _LabelChangeOperation_date(ctx context.Context, fiel } // nolint: vetshadow -func (ec *executionContext) _LabelChangeOperation_added(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeOperation) graphql.Marshaler { +func (ec *executionContext) _LabelChangeTimelineItem_added(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeTimelineItem) graphql.Marshaler { rctx := &graphql.ResolverContext{ - Object: "LabelChangeOperation", + Object: "LabelChangeTimelineItem", Args: nil, Field: field, } @@ -3936,9 +4254,9 @@ func (ec *executionContext) _LabelChangeOperation_added(ctx context.Context, fie } // nolint: vetshadow -func (ec *executionContext) _LabelChangeOperation_removed(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeOperation) graphql.Marshaler { +func (ec *executionContext) _LabelChangeTimelineItem_removed(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeTimelineItem) graphql.Marshaler { rctx := &graphql.ResolverContext{ - Object: "LabelChangeOperation", + Object: "LabelChangeTimelineItem", Args: nil, Field: field, } @@ -4860,45 +5178,292 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col if resTmp == nil { return graphql.Null } - res := resTmp.(*introspection.Type) + res := resTmp.(*introspection.Type) + rctx.Result = res + + if res == nil { + return graphql.Null + } + + return ec.___Type(ctx, field.Selections, res) +} + +// nolint: vetshadow +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "Query", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, nil, func(ctx context.Context) (interface{}, error) { + return ec.introspectSchema(), nil + }) + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Schema) + rctx.Result = res + + if res == nil { + return graphql.Null + } + + return ec.___Schema(ctx, field.Selections, res) +} + +var repositoryImplementors = []string{"Repository"} + +// nolint: gocyclo, errcheck, gas, goconst +func (ec *executionContext) _Repository(ctx context.Context, sel ast.SelectionSet, obj *models.Repository) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, repositoryImplementors) + + 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("Repository") + case "allBugs": + wg.Add(1) + go func(i int, field graphql.CollectedField) { + out.Values[i] = ec._Repository_allBugs(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + wg.Done() + }(i, field) + case "bug": + wg.Add(1) + go func(i int, field graphql.CollectedField) { + out.Values[i] = ec._Repository_bug(ctx, field, obj) + 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) _Repository_allBugs(ctx context.Context, field graphql.CollectedField, obj *models.Repository) graphql.Marshaler { + rawArgs := field.ArgumentMap(ec.Variables) + args, err := field_Repository_allBugs_args(rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + rctx := &graphql.ResolverContext{ + Object: "Repository", + Args: args, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return ec.resolvers.Repository().AllBugs(ctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int), args["query"].(*string)) + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(models.BugConnection) + rctx.Result = res + + return ec._BugConnection(ctx, field.Selections, &res) +} + +// nolint: vetshadow +func (ec *executionContext) _Repository_bug(ctx context.Context, field graphql.CollectedField, obj *models.Repository) graphql.Marshaler { + rawArgs := field.ArgumentMap(ec.Variables) + args, err := field_Repository_bug_args(rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + rctx := &graphql.ResolverContext{ + Object: "Repository", + Args: args, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return ec.resolvers.Repository().Bug(ctx, obj, args["prefix"].(string)) + }) + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*bug.Snapshot) + rctx.Result = res + + if res == nil { + return graphql.Null + } + + return ec._Bug(ctx, field.Selections, res) +} + +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 { + fields := graphql.CollectFields(ctx, sel, setStatusOperationImplementors) + + 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("SetStatusOperation") + case "hash": + out.Values[i] = ec._SetStatusOperation_hash(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "author": + wg.Add(1) + go func(i int, field graphql.CollectedField) { + out.Values[i] = ec._SetStatusOperation_author(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + wg.Done() + }(i, field) + case "date": + wg.Add(1) + go func(i int, field graphql.CollectedField) { + out.Values[i] = ec._SetStatusOperation_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._SetStatusOperation_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) _SetStatusOperation_hash(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusOperation) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "SetStatusOperation", + 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) _SetStatusOperation_author(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusOperation) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "SetStatusOperation", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return ec.resolvers.SetStatusOperation().Author(ctx, obj) + }) + 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) _SetStatusOperation_date(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusOperation) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "SetStatusOperation", + Args: nil, + Field: field, + } + ctx = graphql.WithResolverContext(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return ec.resolvers.SetStatusOperation().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 - - if res == nil { - return graphql.Null - } - - return ec.___Type(ctx, field.Selections, res) + return graphql.MarshalTime(res) } // nolint: vetshadow -func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _SetStatusOperation_status(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusOperation) graphql.Marshaler { rctx := &graphql.ResolverContext{ - Object: "Query", + Object: "SetStatusOperation", Args: nil, Field: field, } ctx = graphql.WithResolverContext(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(ctx context.Context) (interface{}, error) { - return ec.introspectSchema(), nil + resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { + return ec.resolvers.SetStatusOperation().Status(ctx, obj) }) if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*introspection.Schema) + res := resTmp.(models.Status) rctx.Result = res - - if res == nil { - return graphql.Null - } - - return ec.___Schema(ctx, field.Selections, res) + return res } -var repositoryImplementors = []string{"Repository"} +var setStatusTimelineItemImplementors = []string{"SetStatusTimelineItem", "TimelineItem"} // nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _Repository(ctx context.Context, sel ast.SelectionSet, obj *models.Repository) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, repositoryImplementors) +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)) @@ -4908,20 +5473,33 @@ func (ec *executionContext) _Repository(ctx context.Context, sel ast.SelectionSe switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("Repository") - case "allBugs": + 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._Repository_allBugs(ctx, field, obj) + out.Values[i] = ec._SetStatusTimelineItem_date(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } wg.Done() }(i, field) - case "bug": + case "status": wg.Add(1) go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._Repository_bug(ctx, field, obj) + out.Values[i] = ec._SetStatusTimelineItem_status(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } wg.Done() }(i, field) default: @@ -4936,21 +5514,37 @@ func (ec *executionContext) _Repository(ctx context.Context, sel ast.SelectionSe } // nolint: vetshadow -func (ec *executionContext) _Repository_allBugs(ctx context.Context, field graphql.CollectedField, obj *models.Repository) graphql.Marshaler { - rawArgs := field.ArgumentMap(ec.Variables) - args, err := field_Repository_allBugs_args(rawArgs) - if err != nil { - ec.Error(ctx, err) +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: "Repository", - Args: args, + 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.Repository().AllBugs(ctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int), args["query"].(*string)) + return obj.Author, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -4958,47 +5552,61 @@ func (ec *executionContext) _Repository_allBugs(ctx context.Context, field graph } return graphql.Null } - res := resTmp.(models.BugConnection) + res := resTmp.(bug.Person) rctx.Result = res - return ec._BugConnection(ctx, field.Selections, &res) + return ec._Person(ctx, field.Selections, &res) } // nolint: vetshadow -func (ec *executionContext) _Repository_bug(ctx context.Context, field graphql.CollectedField, obj *models.Repository) graphql.Marshaler { - rawArgs := field.ArgumentMap(ec.Variables) - args, err := field_Repository_bug_args(rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } +func (ec *executionContext) _SetStatusTimelineItem_date(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusTimelineItem) graphql.Marshaler { rctx := &graphql.ResolverContext{ - Object: "Repository", - Args: args, + 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.Repository().Bug(ctx, obj, args["prefix"].(string)) + 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.(*bug.Snapshot) + res := resTmp.(time.Time) rctx.Result = res + return graphql.MarshalTime(res) +} - if res == nil { +// 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 } - - return ec._Bug(ctx, field.Selections, res) + res := resTmp.(models.Status) + rctx.Result = res + return res } -var setStatusOperationImplementors = []string{"SetStatusOperation", "Operation", "Authored", "TimelineItem"} +var setTitleOperationImplementors = []string{"SetTitleOperation", "Operation", "Authored"} // nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _SetStatusOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.SetStatusOperation) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, setStatusOperationImplementors) +func (ec *executionContext) _SetTitleOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.SetTitleOperation) graphql.Marshaler { + fields := graphql.CollectFields(ctx, sel, setTitleOperationImplementors) var wg sync.WaitGroup out := graphql.NewOrderedMap(len(fields)) @@ -5008,16 +5616,16 @@ func (ec *executionContext) _SetStatusOperation(ctx context.Context, sel ast.Sel switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("SetStatusOperation") + out.Values[i] = graphql.MarshalString("SetTitleOperation") case "hash": - out.Values[i] = ec._SetStatusOperation_hash(ctx, field, obj) + out.Values[i] = ec._SetTitleOperation_hash(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } case "author": wg.Add(1) go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._SetStatusOperation_author(ctx, field, obj) + out.Values[i] = ec._SetTitleOperation_author(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } @@ -5026,21 +5634,22 @@ func (ec *executionContext) _SetStatusOperation(ctx context.Context, sel ast.Sel case "date": wg.Add(1) go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._SetStatusOperation_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._SetStatusOperation_status(ctx, field, obj) + out.Values[i] = ec._SetTitleOperation_date(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } wg.Done() }(i, field) + case "title": + out.Values[i] = ec._SetTitleOperation_title(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } + case "was": + out.Values[i] = ec._SetTitleOperation_was(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalid = true + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -5053,9 +5662,9 @@ func (ec *executionContext) _SetStatusOperation(ctx context.Context, sel ast.Sel } // nolint: vetshadow -func (ec *executionContext) _SetStatusOperation_hash(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusOperation) graphql.Marshaler { +func (ec *executionContext) _SetTitleOperation_hash(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) graphql.Marshaler { rctx := &graphql.ResolverContext{ - Object: "SetStatusOperation", + Object: "SetTitleOperation", Args: nil, Field: field, } @@ -5075,15 +5684,15 @@ func (ec *executionContext) _SetStatusOperation_hash(ctx context.Context, field } // nolint: vetshadow -func (ec *executionContext) _SetStatusOperation_author(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusOperation) graphql.Marshaler { +func (ec *executionContext) _SetTitleOperation_author(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) graphql.Marshaler { rctx := &graphql.ResolverContext{ - Object: "SetStatusOperation", + Object: "SetTitleOperation", Args: nil, Field: field, } ctx = graphql.WithResolverContext(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { - return ec.resolvers.SetStatusOperation().Author(ctx, obj) + return ec.resolvers.SetTitleOperation().Author(ctx, obj) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -5098,15 +5707,15 @@ func (ec *executionContext) _SetStatusOperation_author(ctx context.Context, fiel } // nolint: vetshadow -func (ec *executionContext) _SetStatusOperation_date(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusOperation) graphql.Marshaler { +func (ec *executionContext) _SetTitleOperation_date(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) graphql.Marshaler { rctx := &graphql.ResolverContext{ - Object: "SetStatusOperation", + Object: "SetTitleOperation", Args: nil, Field: field, } ctx = graphql.WithResolverContext(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { - return ec.resolvers.SetStatusOperation().Date(ctx, obj) + return ec.resolvers.SetTitleOperation().Date(ctx, obj) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -5120,15 +5729,15 @@ func (ec *executionContext) _SetStatusOperation_date(ctx context.Context, field } // nolint: vetshadow -func (ec *executionContext) _SetStatusOperation_status(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusOperation) graphql.Marshaler { +func (ec *executionContext) _SetTitleOperation_title(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) graphql.Marshaler { rctx := &graphql.ResolverContext{ - Object: "SetStatusOperation", + Object: "SetTitleOperation", Args: nil, Field: field, } ctx = graphql.WithResolverContext(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, obj, func(ctx context.Context) (interface{}, error) { - return ec.resolvers.SetStatusOperation().Status(ctx, obj) + return obj.Title, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -5136,16 +5745,38 @@ func (ec *executionContext) _SetStatusOperation_status(ctx context.Context, fiel } return graphql.Null } - res := resTmp.(models.Status) + res := resTmp.(string) rctx.Result = res - return res + return graphql.MarshalString(res) +} + +// nolint: vetshadow +func (ec *executionContext) _SetTitleOperation_was(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) graphql.Marshaler { + rctx := &graphql.ResolverContext{ + Object: "SetTitleOperation", + 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 setTitleOperationImplementors = []string{"SetTitleOperation", "Operation", "Authored", "TimelineItem"} +var setTitleTimelineItemImplementors = []string{"SetTitleTimelineItem", "TimelineItem"} // nolint: gocyclo, errcheck, gas, goconst -func (ec *executionContext) _SetTitleOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.SetTitleOperation) graphql.Marshaler { - fields := graphql.CollectFields(ctx, sel, setTitleOperationImplementors) +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)) @@ -5155,37 +5786,33 @@ func (ec *executionContext) _SetTitleOperation(ctx context.Context, sel ast.Sele switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("SetTitleOperation") + out.Values[i] = graphql.MarshalString("SetTitleTimelineItem") case "hash": - out.Values[i] = ec._SetTitleOperation_hash(ctx, field, obj) + out.Values[i] = ec._SetTitleTimelineItem_hash(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } case "author": - wg.Add(1) - go func(i int, field graphql.CollectedField) { - out.Values[i] = ec._SetTitleOperation_author(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalid = true - } - wg.Done() - }(i, field) + 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._SetTitleOperation_date(ctx, field, obj) + 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._SetTitleOperation_title(ctx, field, obj) + out.Values[i] = ec._SetTitleTimelineItem_title(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } case "was": - out.Values[i] = ec._SetTitleOperation_was(ctx, field, obj) + out.Values[i] = ec._SetTitleTimelineItem_was(ctx, field, obj) if out.Values[i] == graphql.Null { invalid = true } @@ -5201,15 +5828,15 @@ func (ec *executionContext) _SetTitleOperation(ctx context.Context, sel ast.Sele } // nolint: vetshadow -func (ec *executionContext) _SetTitleOperation_hash(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) graphql.Marshaler { +func (ec *executionContext) _SetTitleTimelineItem_hash(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) graphql.Marshaler { rctx := &graphql.ResolverContext{ - Object: "SetTitleOperation", + 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() + return obj.Hash(), nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -5223,15 +5850,15 @@ func (ec *executionContext) _SetTitleOperation_hash(ctx context.Context, field g } // nolint: vetshadow -func (ec *executionContext) _SetTitleOperation_author(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) graphql.Marshaler { +func (ec *executionContext) _SetTitleTimelineItem_author(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) graphql.Marshaler { rctx := &graphql.ResolverContext{ - Object: "SetTitleOperation", + 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.SetTitleOperation().Author(ctx, obj) + return obj.Author, nil }) if resTmp == nil { if !ec.HasError(rctx) { @@ -5246,15 +5873,15 @@ func (ec *executionContext) _SetTitleOperation_author(ctx context.Context, field } // nolint: vetshadow -func (ec *executionContext) _SetTitleOperation_date(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) graphql.Marshaler { +func (ec *executionContext) _SetTitleTimelineItem_date(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) graphql.Marshaler { rctx := &graphql.ResolverContext{ - Object: "SetTitleOperation", + 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.SetTitleOperation().Date(ctx, obj) + return ec.resolvers.SetTitleTimelineItem().Date(ctx, obj) }) if resTmp == nil { if !ec.HasError(rctx) { @@ -5268,9 +5895,9 @@ func (ec *executionContext) _SetTitleOperation_date(ctx context.Context, field g } // nolint: vetshadow -func (ec *executionContext) _SetTitleOperation_title(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) graphql.Marshaler { +func (ec *executionContext) _SetTitleTimelineItem_title(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) graphql.Marshaler { rctx := &graphql.ResolverContext{ - Object: "SetTitleOperation", + Object: "SetTitleTimelineItem", Args: nil, Field: field, } @@ -5290,9 +5917,9 @@ func (ec *executionContext) _SetTitleOperation_title(ctx context.Context, field } // nolint: vetshadow -func (ec *executionContext) _SetTitleOperation_was(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) graphql.Marshaler { +func (ec *executionContext) _SetTitleTimelineItem_was(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) graphql.Marshaler { rctx := &graphql.ResolverContext{ - Object: "SetTitleOperation", + Object: "SetTitleTimelineItem", Args: nil, Field: field, } @@ -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 2322edc71075dc1386c3682445e9331a72455507..b1ce0356f665cb810e31af9ece691ec739377863 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 9b8262fec7dd0ece23a72a7c7042e67615c5dd99..42e0a6430ac8a2ea3868cc4fbbd6f0dc4431acf1 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 5c0d759fa393d0fd5526ccd790a26c01d2a7287b..73e457c5b7265057227cf1b2505965cf7aaa91ad 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.""" diff --git a/termui/show_bug.go b/termui/show_bug.go index 5a3ea1d55a4d441ddf7d80b0896a814ffef46d7f..32bea95a899e15a1bf24b8ac52525ab7c00be78a 100644 --- a/termui/show_bug.go +++ b/termui/show_bug.go @@ -253,8 +253,8 @@ func (sb *showBug) renderMain(g *gocui.Gui, mainView *gocui.View) error { fmt.Fprint(v, content) y0 += lines + 2 - case *bug.CommentTimelineItem: - comment := op.(*bug.CommentTimelineItem) + case *bug.AddCommentTimelineItem: + comment := op.(*bug.AddCommentTimelineItem) edited := "" if comment.Edited() { @@ -277,13 +277,13 @@ func (sb *showBug) renderMain(g *gocui.Gui, mainView *gocui.View) error { fmt.Fprint(v, content) y0 += lines + 2 - case *bug.SetTitleOperation: - setTitle := op.(*bug.SetTitleOperation) + case *bug.SetTitleTimelineItem: + setTitle := op.(*bug.SetTitleTimelineItem) content := fmt.Sprintf("%s changed the title to %s on %s", colors.Magenta(setTitle.Author.Name), colors.Bold(setTitle.Title), - setTitle.Time().Format(timeLayout), + setTitle.UnixTime.Time().Format(timeLayout), ) content, lines := text.Wrap(content, maxX) @@ -294,13 +294,13 @@ func (sb *showBug) renderMain(g *gocui.Gui, mainView *gocui.View) error { fmt.Fprint(v, content) y0 += lines + 2 - case *bug.SetStatusOperation: - setStatus := op.(*bug.SetStatusOperation) + case *bug.SetStatusTimelineItem: + setStatus := op.(*bug.SetStatusTimelineItem) content := fmt.Sprintf("%s %s the bug on %s", colors.Magenta(setStatus.Author.Name), colors.Bold(setStatus.Status.Action()), - setStatus.Time().Format(timeLayout), + setStatus.UnixTime.Time().Format(timeLayout), ) content, lines := text.Wrap(content, maxX) @@ -311,8 +311,8 @@ func (sb *showBug) renderMain(g *gocui.Gui, mainView *gocui.View) error { fmt.Fprint(v, content) y0 += lines + 2 - case *bug.LabelChangeOperation: - labelChange := op.(*bug.LabelChangeOperation) + case *bug.LabelChangeTimelineItem: + labelChange := op.(*bug.LabelChangeTimelineItem) var added []string for _, label := range labelChange.Added { @@ -349,7 +349,7 @@ func (sb *showBug) renderMain(g *gocui.Gui, mainView *gocui.View) error { content := fmt.Sprintf("%s %s on %s", colors.Magenta(labelChange.Author.Name), action.String(), - labelChange.Time().Format(timeLayout), + labelChange.UnixTime.Time().Format(timeLayout), ) content, lines := text.Wrap(content, maxX)