# Requêtes CRUD tasks

list:
  query: >
    SELECT id, project_id, status_id, title, description, priority,
    date_start, date_end, time_estimated, time_spent, billing, position,
    created_at, updated_at
    FROM tasks
  filters:
    default: "user_id = :user_id"
    admin: ""
  order: "position ASC"

list_by_project:
  query: >
    SELECT id, project_id, status_id, title, description, priority,
    date_start, date_end, time_estimated, time_spent, billing, position,
    created_at, updated_at
    FROM tasks WHERE project_id = :project_id
  filters:
    default: "user_id = :user_id"
    admin: ""
  order: "position ASC"

show:
  query: >
    SELECT id, project_id, status_id, title, description, priority,
    date_start, date_end, time_estimated, time_spent, billing, position,
    created_at, updated_at
    FROM tasks WHERE id = :id
  filters:
    default: "user_id = :user_id"
    admin: ""

create:
  table: tasks
  fields:
    - user_id
    - project_id
    - status_id
    - title
    - description
    - priority
    - date_start
    - date_end
    - time_estimated
    - time_spent
    - billing
    - position

update:
  table: tasks
  fields:
    - project_id
    - status_id
    - title
    - description
    - priority
    - date_start
    - date_end
    - time_estimated
    - time_spent
    - billing
    - position
  filters:
    default: "user_id = :user_id"
    admin: ""

delete:
  table: tasks
  filters:
    default: "user_id = :user_id"
    admin: ""
