Fix set_random_project_color.rb

This commit is contained in:
0x1eef 2024-03-29 17:20:42 -03:00
parent 68e25ac8c7
commit 04607a7b7e

View file

@ -9,8 +9,8 @@ module Twenty::GraphQL::Mutation
field :project, Twenty::GraphQL::Type::Project, null: true
def resolve(project_id:)
project = Twenty::Project.find(project_id)
project.update!(color: project.random_color)
project = Twenty::Project.with_pk!(project_id)
project.update(color: project.random_color)
{errors: [], project:}
rescue => ex
{errors: [ex.message]}