Files
bodyshop/server/graphql-client/queries.js
2020-06-03 10:55:13 -07:00

131 lines
2.2 KiB
JavaScript

exports.FIND_BODYSHOP_BY_MESSAGING_SERVICE_SID = `
query FIND_BODYSHOP_BY_MESSAGING_SERVICE_SID(
$mssid: String!
$phone: String!
) {
bodyshops(where: { messagingservicesid: { _eq: $mssid } }) {
id
conversations(where: { phone_num: { _eq: $phone } }) {
id
}
}
}
`;
exports.INSERT_MESSAGE = `
mutation INSERT_MESSAGE($msg: [messages_insert_input!]!) {
insert_messages(objects: $msg) {
returning {
conversation {
bodyshop {
associations(where: {active: {_eq: true}}) {
user {
fcmtokens
}
}
}
}
}
}
}
`;
exports.UPDATE_MESSAGE_STATUS = `
mutation UPDATE_MESSAGE($msid: String!, $fields: messages_set_input!) {
update_messages(where: { msid: { _eq: $msid } }, _set: $fields) {
returning {
id
}
}
}
`;
exports.QUERY_JOBS_FOR_RECEIVABLES_EXPORT = `
query QUERY_JOBS_FOR_RECEIVABLES_EXPORT($id: uuid!) {
jobs_by_pk(id: $id) {
id
job_totals
date_invoiced
ro_number
clm_total
clm_no
invoice_allocation
ownerid
ownr_ln
ownr_fn
ownr_addr1
ownr_addr2
ownr_zip
ownr_city
ownr_st
ins_co_nm
owner{
accountingid
}
bodyshop {
id
md_responsibility_centers
accountingconfig
}
}
}
`;
exports.QUERY_INVOICES_FOR_PAYABLES_EXPORT = `
query QUERY_INVOICES_FOR_PAYABLES_EXPORT($invoices: [uuid!]!) {
invoices(where: {id: {_in: $invoices}}) {
id
date
due_date
federal_tax_rate
invoice_number
is_credit_memo
job {
id
ro_number
clm_no
ownr_fn
ownr_ln
ownr_co_nm
bodyshop{
md_responsibility_centers
}
}
invoicelines{
id
cost_center
actual_cost
applicable_taxes
}
state_tax_rate
local_tax_rate
total
vendor{
id
name
}
}
}
`;
exports.QUERY_UPCOMING_APPOINTMENTS = `
query QUERY_UPCOMING_APPOINTMENTS($now: timestamptz!) {
appointments(where: {start: {_gt: $now}}) {
start
isintake
id
job {
joblines_aggregate {
aggregate {
sum {
mod_lb_hrs
}
}
}
}
}
}
`;