66
77 "github.com/MichaelMure/git-bug/api/graphql/graph"
88 "github.com/MichaelMure/git-bug/api/graphql/models"
9- "github.com/MichaelMure/git-bug/bug"
109 "github.com/MichaelMure/git-bug/cache"
10+ "github.com/MichaelMure/git-bug/commentary"
1111 "github.com/MichaelMure/git-bug/entity"
1212 "github.com/MichaelMure/git-bug/repository"
1313)
@@ -16,7 +16,7 @@ var _ graph.AlterationResolver = alterationResolver{}
1616
1717type alterationResolver struct {}
1818
19- func (alterationResolver ) Date (_ context.Context , obj * bug .Alteration ) (* time.Time , error ) {
19+ func (alterationResolver ) Date (_ context.Context , obj * commentary .Alteration ) (* time.Time , error ) {
2020 t := obj .CreatedAt .Time ()
2121 return & t , nil
2222}
@@ -29,7 +29,7 @@ type commentResolver struct {
2929
3030// getComment is a helper function to fetch a comment with the given Id from
3131// the repository.
32- func (r commentResolver ) getComment (id entity.Id ) (* bug .Comment , error ) {
32+ func (r commentResolver ) getComment (id entity.Id ) (* commentary .Comment , error ) {
3333 var repo , err = r .cache .DefaultRepo ()
3434 if err != nil {
3535 return nil , err
@@ -42,19 +42,19 @@ func (r commentResolver) getComment(id entity.Id) (*bug.Comment, error) {
4242 return bug .Snapshot ().SearchComment (commentId )
4343}
4444
45- func (commentResolver ) ID (_ context.Context , obj * bug .Comment ) (string , error ) {
45+ func (commentResolver ) ID (_ context.Context , obj * commentary .Comment ) (string , error ) {
4646 return obj .Id ().String (), nil
4747}
4848
49- func (r commentResolver ) Author (_ context.Context , obj * bug .Comment ) (models.IdentityWrapper , error ) {
49+ func (r commentResolver ) Author (_ context.Context , obj * commentary .Comment ) (models.IdentityWrapper , error ) {
5050 comment , err := r .getComment (obj .Id ())
5151 if err != nil {
5252 return nil , err
5353 }
5454 return models .NewLoadedIdentity (comment .Author ()), nil
5555}
5656
57- func (r commentResolver ) CreatedAt (_ context.Context , obj * bug .Comment ) (* time.Time , error ) {
57+ func (r commentResolver ) CreatedAt (_ context.Context , obj * commentary .Comment ) (* time.Time , error ) {
5858 comment , err := r .getComment (obj .Id ())
5959 if err != nil {
6060 return nil , err
@@ -63,7 +63,7 @@ func (r commentResolver) CreatedAt(_ context.Context, obj *bug.Comment) (*time.T
6363 return & t , nil
6464}
6565
66- func (r commentResolver ) LastEdited (_ context.Context , obj * bug .Comment ) (* time.Time , error ) {
66+ func (r commentResolver ) LastEdited (_ context.Context , obj * commentary .Comment ) (* time.Time , error ) {
6767 comment , err := r .getComment (obj .Id ())
6868 if err != nil {
6969 return nil , err
@@ -72,39 +72,39 @@ func (r commentResolver) LastEdited(_ context.Context, obj *bug.Comment) (*time.
7272 return & t , nil
7373}
7474
75- func (r commentResolver ) WasEdited (_ context.Context , obj * bug .Comment ) (bool , error ) {
75+ func (r commentResolver ) WasEdited (_ context.Context , obj * commentary .Comment ) (bool , error ) {
7676 comment , err := r .getComment (obj .Id ())
7777 if err != nil {
7878 return false , err
7979 }
8080 return comment .WasEdited (), nil
8181}
8282
83- func (r commentResolver ) Message (_ context.Context , obj * bug .Comment ) (string , error ) {
83+ func (r commentResolver ) Message (_ context.Context , obj * commentary .Comment ) (string , error ) {
8484 comment , err := r .getComment (obj .Id ())
8585 if err != nil {
8686 return "" , err
8787 }
8888 return comment .Message (), nil
8989}
9090
91- func (r commentResolver ) HasEmptyMessage (_ context.Context , obj * bug .Comment ) (bool , error ) {
91+ func (r commentResolver ) HasEmptyMessage (_ context.Context , obj * commentary .Comment ) (bool , error ) {
9292 comment , err := r .getComment (obj .Id ())
9393 if err != nil {
9494 return false , err
9595 }
9696 return comment .HasEmptyMessage (), nil
9797}
9898
99- func (r commentResolver ) Files (_ context.Context , obj * bug .Comment ) ([]repository.Hash , error ) {
99+ func (r commentResolver ) Files (_ context.Context , obj * commentary .Comment ) ([]repository.Hash , error ) {
100100 comment , err := r .getComment (obj .Id ())
101101 if err != nil {
102102 return nil , err
103103 }
104104 return comment .Files (), nil
105105}
106106
107- func (r commentResolver ) History (_ context.Context , obj * bug .Comment ) ([]* bug .Alteration , error ) {
107+ func (r commentResolver ) History (_ context.Context , obj * commentary .Comment ) ([]* commentary .Alteration , error ) {
108108 comment , err := r .getComment (obj .Id ())
109109 if err != nil {
110110 return nil , err
@@ -113,7 +113,7 @@ func (r commentResolver) History(_ context.Context, obj *bug.Comment) ([]*bug.Al
113113 // to type of []*Alteration. This is due to the gqlgen generated
114114 // the code, which expects a slice of pointers as return. Don't know how
115115 // to fix this otherwise *sigh*
116- history := make ([]* bug .Alteration , len (comment .History ()))
116+ history := make ([]* commentary .Alteration , len (comment .History ()))
117117 for edit := range comment .History () {
118118 history [edit ] = & comment .History ()[edit ]
119119 }
0 commit comments