twenty-backend 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.bundle/config +3 -0
- data/.rubocop.yml +34 -0
- data/Gemfile +3 -0
- data/Rakefile.rb +12 -0
- data/lib/twenty-backend/graphql/input/task_input.rb +9 -0
- data/lib/twenty-backend/graphql/input.rb +4 -0
- data/lib/twenty-backend/graphql/mutation/complete_task.rb +15 -0
- data/lib/twenty-backend/graphql/mutation/create_task.rb +13 -0
- data/lib/twenty-backend/graphql/mutation/destroy_task.rb +15 -0
- data/lib/twenty-backend/graphql/mutation/set_random_project_color.rb +17 -0
- data/lib/twenty-backend/graphql/mutation/update_task.rb +15 -0
- data/lib/twenty-backend/graphql/mutation.rb +5 -0
- data/lib/twenty-backend/graphql/schema.rb +6 -0
- data/lib/twenty-backend/graphql/type/mutation.rb +14 -0
- data/lib/twenty-backend/graphql/type/project.rb +10 -0
- data/lib/twenty-backend/graphql/type/query.rb +27 -0
- data/lib/twenty-backend/graphql/type/task.rb +15 -0
- data/lib/twenty-backend/graphql/type/task_status.rb +8 -0
- data/lib/twenty-backend/graphql/type.rb +10 -0
- data/lib/twenty-backend/graphql.rb +7 -0
- data/lib/twenty-backend/migration/1_create_projects.rb +16 -0
- data/lib/twenty-backend/migration/2_create_tasks.rb +17 -0
- data/lib/twenty-backend/migration/3_add_color_to_projects.rb +10 -0
- data/lib/twenty-backend/migration.rb +34 -0
- data/lib/twenty-backend/model/mixin/colorable_mixin.rb +28 -0
- data/lib/twenty-backend/model/project.rb +22 -0
- data/lib/twenty-backend/model/task.rb +18 -0
- data/lib/twenty-backend/model.rb +7 -0
- data/lib/twenty-backend/servlet/graphql.rb +15 -0
- data/lib/twenty-backend/servlet/mixin/server_mixin.rb +27 -0
- data/lib/twenty-backend/servlet.rb +12 -0
- data/lib/twenty-backend.rb +55 -0
- data/share/twenty-backend/schema.graphql +91 -0
- data/twenty-backend.gemspec +21 -0
- metadata +175 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e542a39b0f28686ecebc793a71cf5a0ebc0906e82343a4dbf07438cef3b3b962
|
4
|
+
data.tar.gz: 6d1ed96207eb078d8432a65f339fd4095eec81838e4ec697d47294f0632cf45e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4666ad8f846373943ac508d4d4edccd231b7825af18b58b0c14566943d0281d4967f85ec0d0760d1c5d1c2cd0989359650f2480388800dbed3aaeb2cc65ab0ee
|
7
|
+
data.tar.gz: c4214b4df047e114b2be519156530f391bc1dcdc5e0ad193a93b8f68e2034f9b3a49b9c5eb943f781251d82826d901e741e16d78dd3eca5463a13d2647722ef5
|
data/.bundle/config
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
##
|
2
|
+
# Plugins
|
3
|
+
require:
|
4
|
+
- standard
|
5
|
+
|
6
|
+
##
|
7
|
+
# Defaults: standard-rb
|
8
|
+
inherit_gem:
|
9
|
+
standard: config/base.yml
|
10
|
+
|
11
|
+
##
|
12
|
+
# All cops
|
13
|
+
AllCops:
|
14
|
+
TargetRubyVersion: 3.2
|
15
|
+
Include:
|
16
|
+
- lib/*.rb
|
17
|
+
- lib/**/*.rb
|
18
|
+
- test/*_test.rb
|
19
|
+
|
20
|
+
##
|
21
|
+
# Enabled
|
22
|
+
Style/FrozenStringLiteralComment:
|
23
|
+
Enabled: true
|
24
|
+
|
25
|
+
##
|
26
|
+
# Disabled
|
27
|
+
Layout/ArgumentAlignment:
|
28
|
+
Enabled: false
|
29
|
+
Layout/MultilineMethodCallIndentation:
|
30
|
+
Enabled: false
|
31
|
+
Layout/EmptyLineBetweenDefs:
|
32
|
+
Enabled: false
|
33
|
+
Style/TrivialAccessors:
|
34
|
+
Enabled: false
|
data/Gemfile
ADDED
data/Rakefile.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "fileutils"
|
3
|
+
|
4
|
+
namespace :schema do
|
5
|
+
desc "Generate share/twenty-backend/schema.graphql"
|
6
|
+
task :regen do
|
7
|
+
require "twenty-backend"
|
8
|
+
schema = File.join(__dir__, "share", "twenty-backend", "schema.graphql")
|
9
|
+
FileUtils.mkdir_p File.dirname(schema)
|
10
|
+
File.binwrite schema, Twenty::GraphQL::Schema.to_definition
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
module Twenty::GraphQL::Input
|
2
|
+
class TaskInput < GraphQL::Schema::InputObject
|
3
|
+
require_relative "../type/task_status"
|
4
|
+
argument :title, String, required: false
|
5
|
+
argument :content, String, required: false
|
6
|
+
argument :project_id, Int, required: false
|
7
|
+
argument :status, Twenty::GraphQL::Type::TaskStatus, required: false
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Twenty::GraphQL::Mutation
|
2
|
+
class CompleteTask < GraphQL::Schema::Mutation
|
3
|
+
argument :task_id, Int
|
4
|
+
field :ok, Boolean
|
5
|
+
field :errors, [String]
|
6
|
+
|
7
|
+
def resolve(task_id:)
|
8
|
+
task = Twenty::Task.find(task_id)
|
9
|
+
task.update!(status: :complete)
|
10
|
+
{ok: true, errors: []}
|
11
|
+
rescue => ex
|
12
|
+
{ok: false, errors: [ex.message]}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Twenty::GraphQL::Mutation
|
2
|
+
class CreateTask < GraphQL::Schema::Mutation
|
3
|
+
field :errors, [String], null: false
|
4
|
+
argument :input, Twenty::GraphQL::Input::TaskInput
|
5
|
+
|
6
|
+
def resolve(input:)
|
7
|
+
Twenty::Task.new(input.to_h).save!
|
8
|
+
{"errors" => []}
|
9
|
+
rescue => ex
|
10
|
+
{"errors" => [ex.message]}
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Twenty::GraphQL::Mutation
|
2
|
+
class DestroyTask < GraphQL::Schema::Mutation
|
3
|
+
argument :task_id, Int
|
4
|
+
field :ok, Boolean
|
5
|
+
field :errors, [String]
|
6
|
+
|
7
|
+
def resolve(task_id:)
|
8
|
+
task = Twenty::Task.find(task_id)
|
9
|
+
task.destroy!
|
10
|
+
{ok: true, errors: []}
|
11
|
+
rescue => ex
|
12
|
+
{ok: false, errors: [ex.message]}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Twenty::GraphQL::Mutation
|
2
|
+
class SetRandomProjectColor < ::GraphQL::Schema::Mutation
|
3
|
+
require_relative "../type/project"
|
4
|
+
argument :project_id, Int, required: true
|
5
|
+
|
6
|
+
field :errors, [String], null: false
|
7
|
+
field :project, Twenty::GraphQL::Type::Project, null: true
|
8
|
+
|
9
|
+
def resolve(project_id:)
|
10
|
+
project = Twenty::Project.find(project_id)
|
11
|
+
project.update!(color: project.random_color)
|
12
|
+
{errors: [], project:}
|
13
|
+
rescue => ex
|
14
|
+
{errors: [ex.message]}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Twenty::GraphQL::Mutation
|
2
|
+
class UpdateTask < GraphQL::Schema::Mutation
|
3
|
+
field :errors, [String], null: false
|
4
|
+
argument :task_id, Int
|
5
|
+
argument :input, Twenty::GraphQL::Input::TaskInput
|
6
|
+
|
7
|
+
def resolve(task_id:, input:)
|
8
|
+
task = Twenty::Task.find_by(id: task_id)
|
9
|
+
task.update!(input.to_h)
|
10
|
+
{"errors" => []}
|
11
|
+
rescue => ex
|
12
|
+
{"errors" => [ex.message]}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Twenty::GraphQL::Type
|
2
|
+
class Mutation < GraphQL::Schema::Object
|
3
|
+
require_relative "../mutation/destroy_task"
|
4
|
+
require_relative "../mutation/complete_task"
|
5
|
+
require_relative "../mutation/create_task"
|
6
|
+
require_relative "../mutation/update_task"
|
7
|
+
require_relative "../mutation/set_random_project_color"
|
8
|
+
field :destroy_task, mutation: Twenty::GraphQL::Mutation::DestroyTask
|
9
|
+
field :complete_task, mutation: Twenty::GraphQL::Mutation::CompleteTask
|
10
|
+
field :create_task, mutation: Twenty::GraphQL::Mutation::CreateTask
|
11
|
+
field :update_task, mutation: Twenty::GraphQL::Mutation::UpdateTask
|
12
|
+
field :set_random_project_color, mutation: Twenty::GraphQL::Mutation::SetRandomProjectColor
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Twenty::GraphQL::Type
|
2
|
+
class Project < GraphQL::Schema::Object
|
3
|
+
require_relative "task"
|
4
|
+
field :id, Int, null: false
|
5
|
+
field :name, String, null: false
|
6
|
+
field :path, String, null: false
|
7
|
+
field :color, String, null: false
|
8
|
+
field :tasks, [Task], null: false
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Twenty::GraphQL::Type
|
2
|
+
class Query < GraphQL::Schema::Object
|
3
|
+
field :find_task, Task, null: true do
|
4
|
+
argument :task_id, Int
|
5
|
+
end
|
6
|
+
field :tasks, [Task], null: false do
|
7
|
+
argument :status, TaskStatus
|
8
|
+
argument :project_id, Int, required: false
|
9
|
+
end
|
10
|
+
field :projects, [Project], null: false
|
11
|
+
|
12
|
+
def find_task(task_id:)
|
13
|
+
Twenty::Task.find_by(id: task_id)
|
14
|
+
end
|
15
|
+
|
16
|
+
def tasks(status:, project_id: nil)
|
17
|
+
tasks = Twenty::Task
|
18
|
+
.where(status:)
|
19
|
+
.order(updated_at: :desc)
|
20
|
+
project_id ? tasks.where(project_id:) : tasks
|
21
|
+
end
|
22
|
+
|
23
|
+
def projects
|
24
|
+
Twenty::Project.all
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Twenty::GraphQL::Type
|
2
|
+
class Task < GraphQL::Schema::Object
|
3
|
+
require_relative "project"
|
4
|
+
field :id, Int, null: false
|
5
|
+
field :title, String, null: false
|
6
|
+
field :status, TaskStatus, null: false
|
7
|
+
field :content, String, null: false
|
8
|
+
field :project, Project, null: false
|
9
|
+
field :updated_at, GraphQL::Types::ISO8601DateTime, null: false
|
10
|
+
field :is_ready, Boolean, null: false, method: :ready?
|
11
|
+
field :is_backlogged, Boolean, null: false, method: :backlog?
|
12
|
+
field :is_complete, Boolean, null: false, method: :complete?
|
13
|
+
field :in_progress, Boolean, null: false, method: :in_progress?
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateProjects < ActiveRecord::Migration[7.1]
|
4
|
+
def up
|
5
|
+
create_table(:projects) do |t|
|
6
|
+
t.string :name, null: false
|
7
|
+
t.string :path, null: false
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
add_index :projects, [:name, :path], unique: true
|
11
|
+
end
|
12
|
+
|
13
|
+
def down
|
14
|
+
drop_table(:projects)
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateTasks < ActiveRecord::Migration[7.1]
|
4
|
+
def up
|
5
|
+
create_table(:tasks) do |t|
|
6
|
+
t.string :title, null: false
|
7
|
+
t.text :content, null: false
|
8
|
+
t.integer :status, null: false, default: 0
|
9
|
+
t.belongs_to :project, null: false
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def down
|
15
|
+
drop_table(:tasks)
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Twenty::Migration
|
4
|
+
##
|
5
|
+
# @return [String]
|
6
|
+
# Returns the path to twenty's migrations.
|
7
|
+
def self.migrations_path
|
8
|
+
[File.join(__dir__, "migration")]
|
9
|
+
end
|
10
|
+
|
11
|
+
##
|
12
|
+
# Runs migrations (if neccessary).
|
13
|
+
# @return [void]
|
14
|
+
def self.run!
|
15
|
+
context.migrate
|
16
|
+
end
|
17
|
+
ActiveRecord.timestamped_migrations = false
|
18
|
+
|
19
|
+
##
|
20
|
+
# @return [Boolean]
|
21
|
+
# Returns true when there are pending migrations.
|
22
|
+
def self.pending_migrations?
|
23
|
+
context.open.pending_migrations.any?
|
24
|
+
end
|
25
|
+
|
26
|
+
##
|
27
|
+
# @return [ActiveRecord::MigrationContext]
|
28
|
+
# Returns an instance of
|
29
|
+
# {ActiveRecord::MigrationContext ActiveRecord::MigrationContext}.
|
30
|
+
def self.context
|
31
|
+
@context ||= ActiveRecord::MigrationContext.new(migrations_path)
|
32
|
+
end
|
33
|
+
private_class_method :context
|
34
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Twenty::ColorableMixin
|
2
|
+
extend self
|
3
|
+
|
4
|
+
COLORS = [
|
5
|
+
'#222222', '#333333', '#444444', '#555555', '#666666',
|
6
|
+
'#777777', '#888888', '#999999', '#AA2222', '#22AA22',
|
7
|
+
'#2222AA', '#AA22AA', '#CC9900', '#0099CC', '#9900CC',
|
8
|
+
'#FF9900', '#00CC99', '#99CC00', '#CC0099', '#990000',
|
9
|
+
'#112233', '#445566', '#778899', '#AA4455', '#5544AA',
|
10
|
+
'#88AA44', '#AA88AA', '#CCBB00', '#1155CC', '#9900BB',
|
11
|
+
'#DD6600', '#00BBCC', '#CC0099', '#BB3300', '#006688',
|
12
|
+
'#993366', '#2200AA', '#557788', '#998877', '#BB4400'
|
13
|
+
]
|
14
|
+
|
15
|
+
def self.included(klass)
|
16
|
+
klass.before_validation :set_random_color, on: :create
|
17
|
+
end
|
18
|
+
|
19
|
+
def random_color
|
20
|
+
COLORS.sample
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def set_random_color
|
26
|
+
self.color = random_color
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Twenty::Project < Twenty::Model
|
4
|
+
include Twenty::ColorableMixin
|
5
|
+
self.table_name = "projects"
|
6
|
+
|
7
|
+
##
|
8
|
+
# Validations
|
9
|
+
validates :name, presence: true
|
10
|
+
validates :path, presence: true
|
11
|
+
|
12
|
+
##
|
13
|
+
# Associations
|
14
|
+
has_many :tasks, class_name: "Twenty::Task"
|
15
|
+
|
16
|
+
##
|
17
|
+
# @return [String]
|
18
|
+
# The path to a project.
|
19
|
+
def path
|
20
|
+
super&.sub(Dir.home, "~")
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Twenty::Task < Twenty::Model
|
4
|
+
self.table_name = "tasks"
|
5
|
+
|
6
|
+
STATUS = {backlog: 0, ready: 1, in_progress: 2, complete: 3}
|
7
|
+
enum :status, STATUS, default: :backlog
|
8
|
+
|
9
|
+
##
|
10
|
+
# Validations
|
11
|
+
validates :title, presence: true
|
12
|
+
validates :content, presence: true
|
13
|
+
validates :project, presence: true
|
14
|
+
|
15
|
+
##
|
16
|
+
# Associations
|
17
|
+
belongs_to :project, class_name: "Twenty::Project"
|
18
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class Twenty::Servlet::GraphQL < Twenty::Servlet
|
2
|
+
##
|
3
|
+
# POST /servlet/graphql/
|
4
|
+
def do_POST(req, res)
|
5
|
+
params = JSON.parse(req.body)
|
6
|
+
result = Twenty::GraphQL::Schema.execute(
|
7
|
+
params['query'],
|
8
|
+
variables: params['variables'],
|
9
|
+
context: {}
|
10
|
+
)
|
11
|
+
res['content_type'] = 'application/json'
|
12
|
+
res.status = 200
|
13
|
+
res.body = result.to_json
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Twenty::Servlet::ServerMixin
|
4
|
+
##
|
5
|
+
# @param [Hash] options
|
6
|
+
# Server options that take precedence over
|
7
|
+
# {ServerMixin#server_options ServerMixin#server_options}.
|
8
|
+
#
|
9
|
+
# @return [WEBrick::HTTPServer]
|
10
|
+
# Returns an instance of WEBrick::HTTPServer.
|
11
|
+
def server(options = {})
|
12
|
+
server = WEBrick::HTTPServer.new server_options.merge(options)
|
13
|
+
server.mount "/graphql", Twenty::Servlet::GraphQL
|
14
|
+
server
|
15
|
+
end
|
16
|
+
|
17
|
+
##
|
18
|
+
# @return [Hash<Symbol, String>]
|
19
|
+
# The default server options given to WEBrick::HTTPServer.new.
|
20
|
+
def server_options
|
21
|
+
{
|
22
|
+
DocumentRoot: Twenty.build,
|
23
|
+
BindAddress: "127.0.0.1",
|
24
|
+
Port: 2020
|
25
|
+
}
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Twenty
|
4
|
+
require "fileutils"
|
5
|
+
require "webrick"
|
6
|
+
require "active_record"
|
7
|
+
require_relative "twenty-backend/graphql"
|
8
|
+
require_relative "twenty-backend/servlet"
|
9
|
+
require_relative "twenty-backend/migration"
|
10
|
+
require_relative "twenty-backend/model"
|
11
|
+
extend FileUtils
|
12
|
+
|
13
|
+
##
|
14
|
+
# @return [String]
|
15
|
+
# Returns the directory where twenty stores data.
|
16
|
+
def self.data_dir
|
17
|
+
File.join(Dir.home, ".local", "share", "20")
|
18
|
+
end
|
19
|
+
|
20
|
+
##
|
21
|
+
# @return [String]
|
22
|
+
# Returns the location of the default SQLite database.
|
23
|
+
def self.default_database
|
24
|
+
@default_database ||= File.join(data_dir, "database.sqlite")
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Establishes a database connection.
|
29
|
+
#
|
30
|
+
# @param [String] path
|
31
|
+
# The path to a SQLite3 database file.
|
32
|
+
#
|
33
|
+
# @return [void]
|
34
|
+
def self.establish_connection(path:)
|
35
|
+
ActiveRecord::Base.establish_connection(
|
36
|
+
adapter: "sqlite3",
|
37
|
+
database: path,
|
38
|
+
pool: 16
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
##
|
43
|
+
# Prepares the parent directory of the database.
|
44
|
+
# @return [void]
|
45
|
+
# @api private
|
46
|
+
def self.prepare_dir
|
47
|
+
return if File.exist?(default_database)
|
48
|
+
mkdir_p(data_dir)
|
49
|
+
touch(default_database)
|
50
|
+
rescue => ex
|
51
|
+
warn "prepare_dir error: #{ex.message} (#{ex.class})"
|
52
|
+
end
|
53
|
+
private_class_method :prepare_dir
|
54
|
+
prepare_dir
|
55
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
"""
|
2
|
+
Autogenerated return type of CompleteTask.
|
3
|
+
"""
|
4
|
+
type CompleteTaskPayload {
|
5
|
+
errors: [String!]
|
6
|
+
ok: Boolean
|
7
|
+
}
|
8
|
+
|
9
|
+
"""
|
10
|
+
Autogenerated return type of CreateTask.
|
11
|
+
"""
|
12
|
+
type CreateTaskPayload {
|
13
|
+
errors: [String!]!
|
14
|
+
}
|
15
|
+
|
16
|
+
"""
|
17
|
+
Autogenerated return type of DestroyTask.
|
18
|
+
"""
|
19
|
+
type DestroyTaskPayload {
|
20
|
+
errors: [String!]
|
21
|
+
ok: Boolean
|
22
|
+
}
|
23
|
+
|
24
|
+
"""
|
25
|
+
An ISO 8601-encoded datetime
|
26
|
+
"""
|
27
|
+
scalar ISO8601DateTime @specifiedBy(url: "https://tools.ietf.org/html/rfc3339")
|
28
|
+
|
29
|
+
type Mutation {
|
30
|
+
completeTask(taskId: Int!): CompleteTaskPayload
|
31
|
+
createTask(input: TaskInput!): CreateTaskPayload
|
32
|
+
destroyTask(taskId: Int!): DestroyTaskPayload
|
33
|
+
setRandomProjectColor(projectId: Int!): SetRandomProjectColorPayload
|
34
|
+
updateTask(input: TaskInput!, taskId: Int!): UpdateTaskPayload
|
35
|
+
}
|
36
|
+
|
37
|
+
type Project {
|
38
|
+
color: String!
|
39
|
+
id: Int!
|
40
|
+
name: String!
|
41
|
+
path: String!
|
42
|
+
tasks: [Task!]!
|
43
|
+
}
|
44
|
+
|
45
|
+
type Query {
|
46
|
+
findTask(taskId: Int!): Task
|
47
|
+
projects: [Project!]!
|
48
|
+
tasks(projectId: Int, status: TaskStatus!): [Task!]!
|
49
|
+
}
|
50
|
+
|
51
|
+
"""
|
52
|
+
Autogenerated return type of SetRandomProjectColor.
|
53
|
+
"""
|
54
|
+
type SetRandomProjectColorPayload {
|
55
|
+
errors: [String!]!
|
56
|
+
project: Project
|
57
|
+
}
|
58
|
+
|
59
|
+
type Task {
|
60
|
+
content: String!
|
61
|
+
id: Int!
|
62
|
+
inProgress: Boolean!
|
63
|
+
isBacklogged: Boolean!
|
64
|
+
isComplete: Boolean!
|
65
|
+
isReady: Boolean!
|
66
|
+
project: Project!
|
67
|
+
status: TaskStatus!
|
68
|
+
title: String!
|
69
|
+
updatedAt: ISO8601DateTime!
|
70
|
+
}
|
71
|
+
|
72
|
+
input TaskInput {
|
73
|
+
content: String
|
74
|
+
projectId: Int
|
75
|
+
status: TaskStatus
|
76
|
+
title: String
|
77
|
+
}
|
78
|
+
|
79
|
+
enum TaskStatus {
|
80
|
+
backlog
|
81
|
+
complete
|
82
|
+
in_progress
|
83
|
+
ready
|
84
|
+
}
|
85
|
+
|
86
|
+
"""
|
87
|
+
Autogenerated return type of UpdateTask.
|
88
|
+
"""
|
89
|
+
type UpdateTaskPayload {
|
90
|
+
errors: [String!]!
|
91
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.name = "twenty-backend"
|
5
|
+
gem.authors = ["0x1eef"]
|
6
|
+
gem.email = ["0x1eef@protonmail.com"]
|
7
|
+
gem.homepage = "https://github.com/0x1eef/twenty#readme"
|
8
|
+
gem.version = "0.1.0"
|
9
|
+
gem.licenses = ["0BSD"]
|
10
|
+
gem.files = `git ls-files`.split($/)
|
11
|
+
gem.require_paths = ["lib"]
|
12
|
+
gem.summary = "twenty: backend"
|
13
|
+
gem.description = gem.summary
|
14
|
+
gem.add_runtime_dependency "activerecord", "~> 7.1"
|
15
|
+
gem.add_runtime_dependency "sqlite3", "~> 1.6"
|
16
|
+
gem.add_runtime_dependency "webrick", "~> 1.8"
|
17
|
+
gem.add_runtime_dependency "graphql", "~> 2.2"
|
18
|
+
gem.add_development_dependency "test-unit", "~> 3.5.7"
|
19
|
+
gem.add_development_dependency "standard", "~> 1.13"
|
20
|
+
gem.add_development_dependency "rake", "~> 13.1"
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: twenty-backend
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- '0x1eef'
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-02-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activerecord
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '7.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '7.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sqlite3
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: webrick
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.8'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.8'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: graphql
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.2'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.2'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: test-unit
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 3.5.7
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 3.5.7
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: standard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.13'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.13'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '13.1'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '13.1'
|
111
|
+
description: 'twenty: backend'
|
112
|
+
email:
|
113
|
+
- 0x1eef@protonmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".bundle/config"
|
119
|
+
- ".rubocop.yml"
|
120
|
+
- Gemfile
|
121
|
+
- Rakefile.rb
|
122
|
+
- lib/twenty-backend.rb
|
123
|
+
- lib/twenty-backend/graphql.rb
|
124
|
+
- lib/twenty-backend/graphql/input.rb
|
125
|
+
- lib/twenty-backend/graphql/input/task_input.rb
|
126
|
+
- lib/twenty-backend/graphql/mutation.rb
|
127
|
+
- lib/twenty-backend/graphql/mutation/complete_task.rb
|
128
|
+
- lib/twenty-backend/graphql/mutation/create_task.rb
|
129
|
+
- lib/twenty-backend/graphql/mutation/destroy_task.rb
|
130
|
+
- lib/twenty-backend/graphql/mutation/set_random_project_color.rb
|
131
|
+
- lib/twenty-backend/graphql/mutation/update_task.rb
|
132
|
+
- lib/twenty-backend/graphql/schema.rb
|
133
|
+
- lib/twenty-backend/graphql/type.rb
|
134
|
+
- lib/twenty-backend/graphql/type/mutation.rb
|
135
|
+
- lib/twenty-backend/graphql/type/project.rb
|
136
|
+
- lib/twenty-backend/graphql/type/query.rb
|
137
|
+
- lib/twenty-backend/graphql/type/task.rb
|
138
|
+
- lib/twenty-backend/graphql/type/task_status.rb
|
139
|
+
- lib/twenty-backend/migration.rb
|
140
|
+
- lib/twenty-backend/migration/1_create_projects.rb
|
141
|
+
- lib/twenty-backend/migration/2_create_tasks.rb
|
142
|
+
- lib/twenty-backend/migration/3_add_color_to_projects.rb
|
143
|
+
- lib/twenty-backend/model.rb
|
144
|
+
- lib/twenty-backend/model/mixin/colorable_mixin.rb
|
145
|
+
- lib/twenty-backend/model/project.rb
|
146
|
+
- lib/twenty-backend/model/task.rb
|
147
|
+
- lib/twenty-backend/servlet.rb
|
148
|
+
- lib/twenty-backend/servlet/graphql.rb
|
149
|
+
- lib/twenty-backend/servlet/mixin/server_mixin.rb
|
150
|
+
- share/twenty-backend/schema.graphql
|
151
|
+
- twenty-backend.gemspec
|
152
|
+
homepage: https://github.com/0x1eef/twenty#readme
|
153
|
+
licenses:
|
154
|
+
- 0BSD
|
155
|
+
metadata: {}
|
156
|
+
post_install_message:
|
157
|
+
rdoc_options: []
|
158
|
+
require_paths:
|
159
|
+
- lib
|
160
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
165
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - ">="
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
170
|
+
requirements: []
|
171
|
+
rubygems_version: 3.4.19
|
172
|
+
signing_key:
|
173
|
+
specification_version: 4
|
174
|
+
summary: 'twenty: backend'
|
175
|
+
test_files: []
|