2021-04-17 20:07:23 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mutations
|
|
|
|
module UserCallouts
|
|
|
|
class Create < ::Mutations::BaseMutation
|
|
|
|
graphql_name 'UserCalloutCreate'
|
|
|
|
|
|
|
|
argument :feature_name,
|
2021-10-27 15:23:28 +05:30
|
|
|
GraphQL::Types::String,
|
2021-04-17 20:07:23 +05:30
|
|
|
required: true,
|
2021-10-27 15:23:28 +05:30
|
|
|
description: "Feature name you want to dismiss the callout for."
|
2021-04-17 20:07:23 +05:30
|
|
|
|
|
|
|
field :user_callout, Types::UserCalloutType,
|
|
|
|
null: false,
|
2021-10-27 15:23:28 +05:30
|
|
|
description: 'User callout dismissed.'
|
2021-04-17 20:07:23 +05:30
|
|
|
|
|
|
|
def resolve(feature_name:)
|
2022-01-26 12:08:38 +05:30
|
|
|
callout = Users::DismissCalloutService.new(
|
2021-04-17 20:07:23 +05:30
|
|
|
container: nil, current_user: current_user, params: { feature_name: feature_name }
|
|
|
|
).execute
|
|
|
|
errors = errors_on_object(callout)
|
|
|
|
|
|
|
|
{
|
|
|
|
user_callout: callout,
|
|
|
|
errors: errors
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|