Class: Twenty::GraphQL::Type::Query

Inherits:
GraphQL::Schema::Object
  • Object
show all
Defined in:
lib/twenty-backend/graphql/type/query.rb

Instance Method Summary collapse

Instance Method Details

#find_task(task_id:) ⇒ Object



12
13
14
# File 'lib/twenty-backend/graphql/type/query.rb', line 12

def find_task(task_id:)
  Twenty::Task.find_by(id: task_id)
end

#projectsObject



23
24
25
# File 'lib/twenty-backend/graphql/type/query.rb', line 23

def projects
  Twenty::Project.all
end

#tasks(status:, project_id: nil) ⇒ Object



16
17
18
19
20
21
# File 'lib/twenty-backend/graphql/type/query.rb', line 16

def tasks(status:, project_id: nil)
  tasks = Twenty::Task
    .where(status:)
    .order(updated_at: :desc)
  project_id ? tasks.where(project_id:) : tasks
end