server: modify .rubocop.yml
, commit result
This commit is contained in:
parent
8246c43e30
commit
a1e1739b63
20 changed files with 52 additions and 11 deletions
|
@ -15,6 +15,9 @@ AllCops:
|
||||||
Include:
|
Include:
|
||||||
- lib/*.rb
|
- lib/*.rb
|
||||||
- lib/**/*.rb
|
- lib/**/*.rb
|
||||||
|
- libexec/*
|
||||||
|
- libexec/twenty/*
|
||||||
|
- bin/*
|
||||||
- test/*_test.rb
|
- test/*_test.rb
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Twenty::GraphQL
|
module Twenty::GraphQL
|
||||||
require "graphql"
|
require "graphql"
|
||||||
require_relative "graphql/input"
|
require_relative "graphql/input"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Twenty::GraphQL::Input
|
module Twenty::GraphQL::Input
|
||||||
include GraphQL::Types
|
include GraphQL::Types
|
||||||
require_relative "input/task_input"
|
require_relative "input/task_input"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Twenty::GraphQL::Input
|
module Twenty::GraphQL::Input
|
||||||
class TaskInput < GraphQL::Schema::InputObject
|
class TaskInput < GraphQL::Schema::InputObject
|
||||||
require_relative "../type/task_status"
|
require_relative "../type/task_status"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Twenty::GraphQL
|
module Twenty::GraphQL
|
||||||
module Mutation
|
module Mutation
|
||||||
require_relative "mutation/destroy_task"
|
require_relative "mutation/destroy_task"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Twenty::GraphQL::Mutation
|
module Twenty::GraphQL::Mutation
|
||||||
class CompleteTask < GraphQL::Schema::Mutation
|
class CompleteTask < GraphQL::Schema::Mutation
|
||||||
argument :task_id, Int
|
argument :task_id, Int
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Twenty::GraphQL::Mutation
|
module Twenty::GraphQL::Mutation
|
||||||
class CreateTask < GraphQL::Schema::Mutation
|
class CreateTask < GraphQL::Schema::Mutation
|
||||||
field :errors, [String], null: false
|
field :errors, [String], null: false
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Twenty::GraphQL::Mutation
|
module Twenty::GraphQL::Mutation
|
||||||
class DestroyTask < GraphQL::Schema::Mutation
|
class DestroyTask < GraphQL::Schema::Mutation
|
||||||
argument :task_id, Int
|
argument :task_id, Int
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Twenty::GraphQL::Mutation
|
module Twenty::GraphQL::Mutation
|
||||||
class SetRandomProjectColor < ::GraphQL::Schema::Mutation
|
class SetRandomProjectColor < ::GraphQL::Schema::Mutation
|
||||||
require_relative "../type/project"
|
require_relative "../type/project"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Twenty::GraphQL::Mutation
|
module Twenty::GraphQL::Mutation
|
||||||
class UpdateTask < GraphQL::Schema::Mutation
|
class UpdateTask < GraphQL::Schema::Mutation
|
||||||
field :errors, [String], null: false
|
field :errors, [String], null: false
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Twenty::GraphQL
|
module Twenty::GraphQL
|
||||||
class Schema < GraphQL::Schema
|
class Schema < GraphQL::Schema
|
||||||
query Type::Query
|
query Type::Query
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Twenty::GraphQL
|
module Twenty::GraphQL
|
||||||
module Type
|
module Type
|
||||||
include ::GraphQL::Types
|
include ::GraphQL::Types
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Twenty::GraphQL::Type
|
module Twenty::GraphQL::Type
|
||||||
class Mutation < GraphQL::Schema::Object
|
class Mutation < GraphQL::Schema::Object
|
||||||
require_relative "../mutation/destroy_task"
|
require_relative "../mutation/destroy_task"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Twenty::GraphQL::Type
|
module Twenty::GraphQL::Type
|
||||||
class Project < GraphQL::Schema::Object
|
class Project < GraphQL::Schema::Object
|
||||||
require_relative "task"
|
require_relative "task"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Twenty::GraphQL::Type
|
module Twenty::GraphQL::Type
|
||||||
class Query < GraphQL::Schema::Object
|
class Query < GraphQL::Schema::Object
|
||||||
field :find_task, Task, null: true do
|
field :find_task, Task, null: true do
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Twenty::GraphQL::Type
|
module Twenty::GraphQL::Type
|
||||||
class Task < GraphQL::Schema::Object
|
class Task < GraphQL::Schema::Object
|
||||||
require_relative "project"
|
require_relative "project"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Twenty::GraphQL::Type
|
module Twenty::GraphQL::Type
|
||||||
class TaskStatus < GraphQL::Schema::Enum
|
class TaskStatus < GraphQL::Schema::Enum
|
||||||
value :backlog
|
value :backlog
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class AddColorToProjects < ActiveRecord::Migration[7.1]
|
class AddColorToProjects < ActiveRecord::Migration[7.1]
|
||||||
def up
|
def up
|
||||||
default = Twenty::ColorableMixin.random_color
|
default = Twenty::ColorableMixin.random_color
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Twenty::ColorableMixin
|
module Twenty::ColorableMixin
|
||||||
extend self
|
extend self
|
||||||
|
|
||||||
COLORS = [
|
COLORS = [
|
||||||
'#222222', '#333333', '#444444', '#555555', '#666666',
|
"#222222", "#333333", "#444444", "#555555", "#666666",
|
||||||
'#777777', '#888888', '#999999', '#AA2222', '#22AA22',
|
"#777777", "#888888", "#999999", "#AA2222", "#22AA22",
|
||||||
'#2222AA', '#AA22AA', '#CC9900', '#0099CC', '#9900CC',
|
"#2222AA", "#AA22AA", "#CC9900", "#0099CC", "#9900CC",
|
||||||
'#FF9900', '#00CC99', '#99CC00', '#CC0099', '#990000',
|
"#FF9900", "#00CC99", "#99CC00", "#CC0099", "#990000",
|
||||||
'#112233', '#445566', '#778899', '#AA4455', '#5544AA',
|
"#112233", "#445566", "#778899", "#AA4455", "#5544AA",
|
||||||
'#88AA44', '#AA88AA', '#CCBB00', '#1155CC', '#9900BB',
|
"#88AA44", "#AA88AA", "#CCBB00", "#1155CC", "#9900BB",
|
||||||
'#DD6600', '#00BBCC', '#CC0099', '#BB3300', '#006688',
|
"#DD6600", "#00BBCC", "#CC0099", "#BB3300", "#006688",
|
||||||
'#993366', '#2200AA', '#557788', '#998877', '#BB4400'
|
"#993366", "#2200AA", "#557788", "#998877", "#BB4400"
|
||||||
]
|
]
|
||||||
|
|
||||||
def self.included(klass)
|
def self.included(klass)
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Twenty::Servlet::GraphQL < Twenty::Servlet
|
class Twenty::Servlet::GraphQL < Twenty::Servlet
|
||||||
##
|
##
|
||||||
# POST /servlet/graphql/
|
# POST /servlet/graphql/
|
||||||
def do_POST(req, res)
|
def do_POST(req, res)
|
||||||
params = JSON.parse(req.body)
|
params = JSON.parse(req.body)
|
||||||
result = Twenty::GraphQL::Schema.execute(
|
result = Twenty::GraphQL::Schema.execute(
|
||||||
params['query'],
|
params["query"],
|
||||||
variables: params['variables'],
|
variables: params["variables"],
|
||||||
context: {}
|
context: {}
|
||||||
)
|
)
|
||||||
res['content_type'] = 'application/json'
|
res["content_type"] = "application/json"
|
||||||
res.status = 200
|
res.status = 200
|
||||||
res.body = result.to_json
|
res.body = result.to_json
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue