- Make sure subscription and initial query only grab jobs that have statuses that are on the board

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-07-18 16:59:17 -04:00
parent 118f14ed4c
commit c31d4096c6
4 changed files with 126 additions and 42 deletions

View File

@@ -151,14 +151,6 @@ export const QUERY_PARTS_QUEUE = gql`
}
}
`;
export const SUBSCRIPTION_JOBS_IN_PRODUCTION = gql`
subscription SUBSCRIPTION_JOBS_IN_PRODUCTION {
jobs(where: { inproduction: { _eq: true } }) {
id
updated_at
}
}
`;
export const QUERY_EXACT_JOB_IN_PRODUCTION = gql`
query QUERY_EXACT_JOB_IN_PRODUCTION($id: uuid!) {
@@ -904,10 +896,7 @@ export const QUERY_JOB_CARD_DETAILS = gql`
status
}
joblines(
where: { removed: { _eq: false } }
order_by: { line_no: asc }
) {
joblines(where: { removed: { _eq: false } }, order_by: { line_no: asc }) {
id
alt_partm
line_no
@@ -2028,10 +2017,6 @@ export const generate_UPDATE_JOB_KANBAN = (
newChildId,
newChildParent
) => {
// console.log("oldChildId", oldChildId, "oldChildNewParent", oldChildNewParent);
// console.log("Moved", movedId, movedNewParent, movedNewStatus);
// console.log("new", newChildId, newChildParent);
const oldChildQuery = `
updateOldChild: update_jobs(where: { id: { _eq: "${oldChildId}" } },
_set: {kanbanparent: ${oldChildNewParent ? `"${oldChildNewParent}"` : null}}) {
@@ -2542,3 +2527,97 @@ export const QUERY_PARTS_QUEUE_CARD_DETAILS = gql`
}
}
`;
export const QUERY_JOBS_IN_PRODUCTION_WITH_STATUSES = gql`
query QUERY_JOBS_IN_PRODUCTION($statuses: [String!]) {
jobs(where: { inproduction: { _eq: true }, status: { _in: $statuses } }) {
id
updated_at
comment
status
category
iouparent
ro_number
ownerid
ownr_fn
ownr_ln
ownr_co_nm
v_model_yr
v_model_desc
clm_no
v_make_desc
v_color
vehicleid
plate_no
actual_in
scheduled_completion
scheduled_delivery
date_last_contacted
date_next_contact
ins_co_nm
clm_total
ownr_ph1
ownr_ph2
special_coverage_policy
owner_owing
production_vars
kanbanparent
alt_transport
employee_body
employee_refinish
employee_prep
employee_csr
est_ct_fn
est_ct_ln
suspended
date_repairstarted
joblines_status {
part_type
status
count
}
labhrs: joblines_aggregate(where: { _and: [{ mod_lbr_ty: { _neq: "LAR" } }, { removed: { _eq: false } }] }) {
aggregate {
sum {
mod_lb_hrs
}
}
}
larhrs: joblines_aggregate(where: { _and: [{ mod_lbr_ty: { _eq: "LAR" } }, { removed: { _eq: false } }] }) {
aggregate {
sum {
mod_lb_hrs
}
}
}
subletLines: joblines(
where: { _and: { part_type: { _in: ["PAS", "PASL"] }, removed: { _eq: false } } }
order_by: { line_no: asc }
) {
id
line_desc
sublet_ignored
sublet_completed
jobid
}
}
}
`;
export const SUBSCRIPTION_JOBS_IN_PRODUCTION_WITH_STATUSES = gql`
subscription SUBSCRIPTION_JOBS_IN_PRODUCTION($statuses: [String!]) {
jobs(where: { inproduction: { _eq: true }, status: { _in: $statuses } }) {
id
updated_at
}
}
`;
export const SUBSCRIPTION_JOBS_IN_PRODUCTION = gql`
subscription SUBSCRIPTION_JOBS_IN_PRODUCTION {
jobs(where: { inproduction: { _eq: true } }) {
id
updated_at
}
}
`;