diff --git a/twenty-server/lib/twenty-server/graphql.rb b/twenty-server/lib/twenty-server/graphql.rb index 35a2bda..1fd86b3 100644 --- a/twenty-server/lib/twenty-server/graphql.rb +++ b/twenty-server/lib/twenty-server/graphql.rb @@ -1,9 +1,8 @@ # frozen_string_literal: true - module Twenty::GraphQL require "graphql" require_relative "graphql/input" - require_relative "graphql/type" require_relative "graphql/mutation" + require_relative "graphql/type" require_relative "graphql/schema" end diff --git a/twenty-server/lib/twenty-server/graphql/input/task_input.rb b/twenty-server/lib/twenty-server/graphql/input/task_input.rb index 2f9c6d1..2508add 100644 --- a/twenty-server/lib/twenty-server/graphql/input/task_input.rb +++ b/twenty-server/lib/twenty-server/graphql/input/task_input.rb @@ -2,10 +2,9 @@ module Twenty::GraphQL::Input class TaskInput < GraphQL::Schema::InputObject - require_relative "../type/task_status" argument :title, String, required: false argument :content, String, required: false argument :project_id, Int, required: false - argument :status, Twenty::GraphQL::Type::TaskStatus, required: false + argument :status, 'Twenty::GraphQL::Type::TaskStatus', required: false end end diff --git a/twenty-server/lib/twenty-server/graphql/mutation.rb b/twenty-server/lib/twenty-server/graphql/mutation.rb index 4a201aa..e6aa60c 100644 --- a/twenty-server/lib/twenty-server/graphql/mutation.rb +++ b/twenty-server/lib/twenty-server/graphql/mutation.rb @@ -3,5 +3,9 @@ module Twenty::GraphQL module Mutation require_relative "mutation/destroy_task" + require_relative "mutation/complete_task" + require_relative "mutation/create_task" + require_relative "mutation/update_task" + require_relative "mutation/set_random_project_color" end end diff --git a/twenty-server/lib/twenty-server/graphql/mutation/set_random_project_color.rb b/twenty-server/lib/twenty-server/graphql/mutation/set_random_project_color.rb index 3ce97e9..0d7a727 100644 --- a/twenty-server/lib/twenty-server/graphql/mutation/set_random_project_color.rb +++ b/twenty-server/lib/twenty-server/graphql/mutation/set_random_project_color.rb @@ -2,11 +2,10 @@ module Twenty::GraphQL::Mutation class SetRandomProjectColor < ::GraphQL::Schema::Mutation - require_relative "../type/project" argument :project_id, Int, required: true field :errors, [String], null: false - field :project, Twenty::GraphQL::Type::Project, null: true + field :project, 'Twenty::GraphQL::Type::Project', null: true def resolve(project_id:) project = Twenty::Project.with_pk!(project_id) diff --git a/twenty-server/lib/twenty-server/graphql/type/mutation.rb b/twenty-server/lib/twenty-server/graphql/type/mutation.rb index d8a2a0a..ecf1d2b 100644 --- a/twenty-server/lib/twenty-server/graphql/type/mutation.rb +++ b/twenty-server/lib/twenty-server/graphql/type/mutation.rb @@ -2,11 +2,6 @@ module Twenty::GraphQL::Type class Mutation < GraphQL::Schema::Object - require_relative "../mutation/destroy_task" - require_relative "../mutation/complete_task" - require_relative "../mutation/create_task" - require_relative "../mutation/update_task" - require_relative "../mutation/set_random_project_color" field :destroy_task, mutation: Twenty::GraphQL::Mutation::DestroyTask field :complete_task, mutation: Twenty::GraphQL::Mutation::CompleteTask field :create_task, mutation: Twenty::GraphQL::Mutation::CreateTask diff --git a/twenty-server/lib/twenty-server/graphql/type/project.rb b/twenty-server/lib/twenty-server/graphql/type/project.rb index 25d89fa..3c70fea 100644 --- a/twenty-server/lib/twenty-server/graphql/type/project.rb +++ b/twenty-server/lib/twenty-server/graphql/type/project.rb @@ -2,11 +2,10 @@ module Twenty::GraphQL::Type class Project < GraphQL::Schema::Object - require_relative "task" field :id, Int, null: false field :name, String, null: false field :path, String, null: false field :color, String, null: false - field :tasks, [Task], null: false + field :tasks, '[Twenty::GraphQL::Type::Task]', null: false end end diff --git a/twenty-server/lib/twenty-server/graphql/type/task.rb b/twenty-server/lib/twenty-server/graphql/type/task.rb index 969126a..12dadef 100644 --- a/twenty-server/lib/twenty-server/graphql/type/task.rb +++ b/twenty-server/lib/twenty-server/graphql/type/task.rb @@ -2,12 +2,11 @@ module Twenty::GraphQL::Type class Task < GraphQL::Schema::Object - require_relative "project" field :id, Int, null: false field :title, String, null: false - field :status, TaskStatus, null: false + field :status, 'Twenty::GraphQL::Type::TaskStatus', null: false field :content, String, null: false - field :project, Project, null: false + field :project, 'Twenty::GraphQL::Type::Project', null: false field :updated_at, GraphQL::Types::ISO8601DateTime, null: false field :is_ready, Boolean, null: false, method: :ready? field :is_backlogged, Boolean, null: false, method: :backlog?