From 166efdc877060764f3196ce730a1c575b38ef95b Mon Sep 17 00:00:00 2001 From: Dave Richer Date: Mon, 22 Jan 2024 14:25:21 -0500 Subject: [PATCH] progressUpdate Signed-off-by: Dave Richer --- hasura/metadata/tables.yaml | 11 ++++++++--- server/job/job-status-transition.js | 10 ++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/hasura/metadata/tables.yaml b/hasura/metadata/tables.yaml index fda2aa44a..46a1999a1 100644 --- a/hasura/metadata/tables.yaml +++ b/hasura/metadata/tables.yaml @@ -2442,7 +2442,7 @@ _eq: X-Hasura-User-Id columns: - address - - buisness_name + - business_name - date_accepted - eulaid - first_name @@ -2454,7 +2454,7 @@ permission: columns: - address - - buisness_name + - business_name - first_name - last_name - phone_number @@ -4164,11 +4164,16 @@ - name: job_status_transition definition: enable_manual: true + insert: + columns: '*' + update: + columns: + - status retry_conf: interval_sec: 10 num_retries: 0 timeout_sec: 60 - webhook_from_env: HASURA_API_URL + webhook: https://worktest.home.irony.online headers: - name: event-secret value_from_env: EVENT_SECRET diff --git a/server/job/job-status-transition.js b/server/job/job-status-transition.js index fd74a2ec3..294ab395d 100644 --- a/server/job/job-status-transition.js +++ b/server/job/job-status-transition.js @@ -20,13 +20,19 @@ async function StatusTransition(req, res) { res.status(401).send("Unauthorized"); return; } - res.sendStatus(200); - return; + + // return res.sendStatus(200); + const { id: jobid, status: value, shopid: bodyshopid, } = req.body.event.data.new; + + // Create record OPEN on new item, enter state + // If change to SCHEDULE, update the last record and create a new record (update status and end time on old record, create a new record saying we came from previous status going to previous status + // (Timeline) + // Final status is exported, there is no end date as there is no further transition (has no end date) try { const { update_transitions } = await client.request( queries.UPDATE_OLD_TRANSITION,