blob: e26ae7d228cabeb58657034dde19a55b22a99b90 (
plain)
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
|
# frozen_string_literal: true
module Mutations
module ResolvesSubscription
extend ActiveSupport::Concern
included do
argument :subscribed_state,
GraphQL::BOOLEAN_TYPE,
required: true,
description: 'The desired state of the subscription.'
end
def resolve(project_path:, iid:, subscribed_state:)
resource = authorized_find!(project_path: project_path, iid: iid)
project = resource.project
resource.set_subscription(current_user, subscribed_state, project)
{
resource.class.name.underscore.to_sym => resource,
errors: errors_on_object(resource)
}
end
end
end
|