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