Class: Twenty::GraphQL::Mutation::SetRandomProjectColor

Inherits:
GraphQL::Schema::Mutation
  • Object
show all
Defined in:
lib/twenty-backend/graphql/mutation/set_random_project_color.rb

Instance Method Summary collapse

Instance Method Details

#resolve(project_id:) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/twenty-backend/graphql/mutation/set_random_project_color.rb', line 9

def resolve(project_id:)
  project = Twenty::Project.find(project_id)
  project.update!(color: project.random_color)
  {errors: [], project:}
rescue => ex
  {errors: [ex.message]}
end