Class: Mutations::Notes::Update::Base
- Inherits:
-
Base
- Object
- GraphQL::Schema::RelayClassicMutation
- BaseMutation
- Base
- Mutations::Notes::Update::Base
- Defined in:
- app/graphql/mutations/notes/update/base.rb
Overview
This is a Base class for the Note update mutations and is not mounted as a GraphQL mutation itself.
Direct Known Subclasses
Constant Summary
Constants inherited from BaseMutation
Instance Method Summary collapse
Methods inherited from BaseMutation
#api_user?, #current_user, #errors_on_object, #ready?
Instance Method Details
#resolve(args) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/graphql/mutations/notes/update/base.rb', line 16 def resolve(args) note = (id: args[:id]) pre_update_checks!(note, args) updated_note = ::Notes::UpdateService.new( note.project, current_user, note_params(note, args) ).execute(note) # It's possible for updated_note to be `nil`, in the situation # where the note is deleted within `Notes::UpdateService` due to # the body of the note only containing Quick Actions. { note: updated_note&.reset, errors: updated_note ? errors_on_object(updated_note) : [] } end |