Mutations::ExtendHookEndDate = GraphQL::Relay::Mutation.define do
name "ExtendHookEndDate"
# TODO: define return fields
return_field :hook, Types::HookType
# TODO: define arguments
input_field :id, !types.ID
resolve ->(obj, args, ctx) {
if ctx[:current_user].is_artist?
hook = Hook.find(args[:id])
hook.update({end_date: hook.campaign.last_event_date + 1.week})
{hook: hook}
end
}
end