From 4a28f25347addf05708cdff37ecace4139f01779 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Thu, 18 Jun 2020 02:52:33 +0100 Subject: Add support for read-only mode for web UI. Fixes #402. --- graphql/resolvers/mutation.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'graphql/resolvers/mutation.go') diff --git a/graphql/resolvers/mutation.go b/graphql/resolvers/mutation.go index 850645f4..80d6fb1a 100644 --- a/graphql/resolvers/mutation.go +++ b/graphql/resolvers/mutation.go @@ -7,8 +7,32 @@ import ( "github.com/MichaelMure/git-bug/cache" "github.com/MichaelMure/git-bug/graphql/graph" "github.com/MichaelMure/git-bug/graphql/models" + "github.com/vektah/gqlparser/gqlerror" ) +var _ graph.MutationResolver = &readonlyMutationResolver{} + +type readonlyMutationResolver struct{} + +func (readonlyMutationResolver) NewBug(_ context.Context, _ models.NewBugInput) (*models.NewBugPayload, error) { + return nil, gqlerror.Errorf("readonly mode") +} +func (readonlyMutationResolver) AddComment(_ context.Context, input models.AddCommentInput) (*models.AddCommentPayload, error) { + return nil, gqlerror.Errorf("readonly mode") +} +func (readonlyMutationResolver) ChangeLabels(_ context.Context, input *models.ChangeLabelInput) (*models.ChangeLabelPayload, error) { + return nil, gqlerror.Errorf("readonly mode") +} +func (readonlyMutationResolver) OpenBug(_ context.Context, input models.OpenBugInput) (*models.OpenBugPayload, error) { + return nil, gqlerror.Errorf("readonly mode") +} +func (readonlyMutationResolver) CloseBug(_ context.Context, input models.CloseBugInput) (*models.CloseBugPayload, error) { + return nil, gqlerror.Errorf("readonly mode") +} +func (readonlyMutationResolver) SetTitle(_ context.Context, input models.SetTitleInput) (*models.SetTitlePayload, error) { + return nil, gqlerror.Errorf("readonly mode") +} + var _ graph.MutationResolver = &mutationResolver{} type mutationResolver struct { -- cgit