Rockydonthurtem
1/29/2019 - 6:53 PM

1 GraphQL/Ruby backend

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