Files
bodyshop/client/src/graphql/documents.queries.js
2021-02-12 11:25:34 -08:00

78 lines
1.3 KiB
JavaScript

import gql from "graphql-tag";
export const GET_DOCUMENTS_BY_JOB = gql`
query GET_DOCUMENTS_BY_JOB($jobId: uuid!) {
documents(
where: { jobid: { _eq: $jobId } }
order_by: { updated_at: desc }
) {
id
name
key
type
extension
bill {
id
invoice_number
date
vendor {
id
name
}
}
}
}
`;
export const INSERT_NEW_DOCUMENT = gql`
mutation INSERT_NEW_DOCUMENT($docInput: [documents_insert_input!]!) {
insert_documents(objects: $docInput) {
returning {
id
name
key
}
}
}
`;
export const DELETE_DOCUMENT = gql`
mutation DELETE_DOCUMENT($id: uuid) {
delete_documents(where: { id: { _eq: $id } }) {
returning {
id
}
}
}
`;
export const QUERY_TEMPORARY_DOCS = gql`
query QUERY_TEMPORARY_DOCS {
documents(
where: { jobid: { _is_null: true } }
order_by: { updated_at: desc }
) {
id
name
key
type
extension
}
}
`;
export const UPDATE_DOCUMENT = gql`
mutation UPDATE_DOCUMENT($id: uuid!, $document: documents_set_input!) {
update_documents_by_pk(pk_columns: { id: $id }, _set: $document) {
billid
bodyshopid
extension
id
jobid
name
type
key
}
}
`;