aboutsummaryrefslogtreecommitdiffstats
path: root/api/graphql/resolvers/bug_operations.go
blob: cf9d9056bbc0a13f57858f3d7430b6f84c575f36 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package resolvers

import (
	"context"

	"github.com/git-bug/git-bug/api/graphql/graph"
	"github.com/git-bug/git-bug/api/graphql/models"
	"github.com/git-bug/git-bug/entities/bug"
)

var _ graph.BugCreateOperationResolver = bugCreateOperationResolver{}

type bugCreateOperationResolver struct{}

func (bugCreateOperationResolver) Author(_ context.Context, obj *bug.CreateOperation) (models.IdentityWrapper, error) {
	return models.NewLoadedIdentity(obj.Author()), nil
}

var _ graph.BugAddCommentOperationResolver = bugAddCommentOperationResolver{}

type bugAddCommentOperationResolver struct{}

func (bugAddCommentOperationResolver) Author(_ context.Context, obj *bug.AddCommentOperation) (models.IdentityWrapper, error) {
	return models.NewLoadedIdentity(obj.Author()), nil
}

var _ graph.BugEditCommentOperationResolver = bugEditCommentOperationResolver{}

type bugEditCommentOperationResolver struct{}

func (bugEditCommentOperationResolver) Target(_ context.Context, obj *bug.EditCommentOperation) (string, error) {
	return obj.Target.String(), nil
}

func (bugEditCommentOperationResolver) Author(_ context.Context, obj *bug.EditCommentOperation) (models.IdentityWrapper, error) {
	return models.NewLoadedIdentity(obj.Author()), nil
}

var _ graph.BugLabelChangeOperationResolver = bugLabelChangeOperationResolver{}

type bugLabelChangeOperationResolver struct{}

func (bugLabelChangeOperationResolver) Author(_ context.Context, obj *bug.LabelChangeOperation) (models.IdentityWrapper, error) {
	return models.NewLoadedIdentity(obj.Author()), nil
}

var _ graph.BugSetStatusOperationResolver = bugSetStatusOperationResolver{}

type bugSetStatusOperationResolver struct{}

func (bugSetStatusOperationResolver) Author(_ context.Context, obj *bug.SetStatusOperation) (models.IdentityWrapper, error) {
	return models.NewLoadedIdentity(obj.Author()), nil
}

var _ graph.BugSetTitleOperationResolver = bugSetTitleOperationResolver{}

type bugSetTitleOperationResolver struct{}

func (bugSetTitleOperationResolver) Author(_ context.Context, obj *bug.SetTitleOperation) (models.IdentityWrapper, error) {
	return models.NewLoadedIdentity(obj.Author()), nil
}