// GraphQL Queries and Mutations const GET_BODYSHOP_STATUS = ` query GetBodyshopStatus($id: uuid!) { bodyshops_by_pk(id: $id) { md_order_statuses } } `; const GET_VEHICLE_BY_SHOP_VIN = ` query GetVehicleByShopVin($shopid: uuid!, $v_vin: String!) { vehicles(where: { shopid: { _eq: $shopid }, v_vin: { _eq: $v_vin } }, limit: 1) { id } } `; const INSERT_OWNER = ` mutation InsertOwner($owner: owners_insert_input!) { insert_owners_one(object: $owner) { id } } `; const INSERT_JOB_WITH_LINES = ` mutation InsertJob($job: jobs_insert_input!) { insert_jobs_one(object: $job) { id joblines { id unq_seq } } } `; const GET_JOB_BY_CLAIM = ` query GetJobByClaim($shopid: uuid!, $clm_no: String!) { jobs( where: { shopid: { _eq: $shopid }, clm_no: { _eq: $clm_no } } order_by: { created_at: desc } limit: 1 ) { id } } `; const UPDATE_JOB_BY_ID = ` mutation UpdateJobById($id: uuid!, $job: jobs_set_input!) { update_jobs_by_pk(pk_columns: { id: $id }, _set: $job) { id } } `; const UPSERT_JOBLINES = ` mutation UpsertJoblines($joblines: [joblines_insert_input!]!) { insert_joblines( objects: $joblines on_conflict: { constraint: joblines_pkey update_columns: [ jobid status line_desc part_type part_qty oem_partno db_price act_price mod_lbr_ty mod_lb_hrs lbr_op lbr_amt notes manual_line ] } ) { affected_rows } } `; const DELETE_JOBLINES_BY_JOBID = ` mutation DeleteJoblinesByJobId($jobid: uuid!) { delete_joblines(where: { jobid: { _eq: $jobid } }) { affected_rows } } `; const DELETE_JOBLINES_BY_IDS = ` mutation DeleteJoblinesByIds($jobid: uuid!, $unqSeqs: [Int!]!) { delete_joblines( where: { jobid: { _eq: $jobid }, unq_seq: { _in: $unqSeqs } } ) { affected_rows } } `; const INSERT_JOBLINES = ` mutation InsertJoblines($joblines: [joblines_insert_input!]!) { insert_joblines(objects: $joblines) { affected_rows } } `; const CHECK_EXTERNAL_SHOP_ID = ` query CHECK_KEY($key: String!) { bodyshops(where: { external_shop_id: { _eq: $key } }) { external_shop_id } } `; const CREATE_SHOP = ` mutation CREATE_SHOP($bs: bodyshops_insert_input!) { insert_bodyshops_one(object: $bs) { id } } `; const DELETE_VENDORS_BY_SHOP = ` mutation DELETE_VENDORS($shopId: uuid!) { delete_vendors(where: { shopid: { _eq: $shopId } }) { affected_rows } } `; const DELETE_SHOP = ` mutation DELETE_SHOP($id: uuid!) { delete_bodyshops_by_pk(id: $id) { id } } `; const CREATE_USER = ` mutation CREATE_USER($u: users_insert_input!) { insert_users_one(object: $u) { id: authid email } } `; module.exports = { GET_BODYSHOP_STATUS, GET_VEHICLE_BY_SHOP_VIN, INSERT_OWNER, INSERT_JOB_WITH_LINES, GET_JOB_BY_CLAIM, UPDATE_JOB_BY_ID, UPSERT_JOBLINES, DELETE_JOBLINES_BY_JOBID, DELETE_JOBLINES_BY_IDS, INSERT_JOBLINES, CHECK_EXTERNAL_SHOP_ID, CREATE_SHOP, DELETE_VENDORS_BY_SHOP, DELETE_SHOP, CREATE_USER };