- Progress Commit

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-03-20 18:18:24 -04:00
parent 27c24619c3
commit f31ae9ac6d
11 changed files with 488 additions and 98 deletions

View File

@@ -1,5 +1,9 @@
import {gql} from "@apollo/client";
/**
* All tasks paginated query
* @type {DocumentNode}
*/
export const QUERY_ALL_TASKS_PAGINATED = gql`
query QUERY_ALL_TASKS_PAGINATED(
$offset: Int
@@ -30,10 +34,98 @@ export const QUERY_ALL_TASKS_PAGINATED = gql`
partsorderid
billid
}
tasks_aggregate(args: {}) {
tasks_aggregate {
aggregate {
count(distinct: true)
count
}
}
}
`;
/**
* My tasks paginated query
* @type {DocumentNode}
*/
export const QUERY_MY_TASKS_PAGINATED = gql`
query QUERY_TASKS_PAGINATED(
$offset: Int
$limit: Int
$user: String!
$bodyshop: uuid!
$deleted: Boolean
$completed: Boolean
$order: [tasks_order_by!]!
) {
tasks(
offset: $offset
limit: $limit
order_by: $order
where: {
assigned_to: {_eq: $user},
bodyshopid: {_eq: $bodyshop},
deleted: {_eq: $deleted},
completed: {_eq: $completed}
}
) {
id
created_at
updated_at
title
description
deleted
deleted_at
due_date
created_by
assigned_to
completed
completed_at
remind_at
priority
jobid
joblineid
partsorderid
billid
bodyshopid
}
tasks_aggregate(
where: {
assigned_to: {_eq: $user},
bodyshopid: {_eq: $bodyshop},
deleted: {_eq: $deleted},
completed: {_eq: $completed}
}
) {
aggregate {
count
}
}
}
`;
/**
* Toggle task completed mutation
* @type {DocumentNode}
*/
export const MUTATION_TOGGLE_TASK_COMPLETED = gql`
mutation MUTATION_TOGGLE_TASK_COMPLETED($id: uuid!, $completed: Boolean!, $completed_at: timestamptz) {
update_tasks_by_pk(pk_columns: {id: $id}, _set: {completed: $completed, completed_at: $completed_at}) {
id
completed
completed_at
}
}
`;
/**
* Toggle task deleted mutation
* @type {DocumentNode}
*/
export const MUTATION_TOGGLE_TASK_DELETED = gql`
mutation MUTATION_TOGGLE_TASK_DELETED($id: uuid!, $deleted: Boolean!, $deleted_at: timestamptz) {
update_tasks_by_pk(pk_columns: {id: $id}, _set: {deleted: $deleted, deleted_at: $deleted_at}) {
id
deleted
deleted_at
}
}
`;