From 5717727d2ae20f0d0d9e45c94adb3a5ad02a23a3 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Wed, 12 Apr 2023 13:02:45 -0700 Subject: [PATCH] IO-2243 Capture successful CDK posting details. --- hasura/metadata/tables.yaml | 200 +++++++++++++++++- .../down.sql | 4 + .../up.sql | 2 + server/cdk/cdk-job-export.js | 3 + 4 files changed, 198 insertions(+), 11 deletions(-) create mode 100644 hasura/migrations/1681329377686_alter_table_public_exportlog_add_column_metadata/down.sql create mode 100644 hasura/migrations/1681329377686_alter_table_public_exportlog_add_column_metadata/up.sql diff --git a/hasura/metadata/tables.yaml b/hasura/metadata/tables.yaml index a576c160e..6fe62169b 100644 --- a/hasura/metadata/tables.yaml +++ b/hasura/metadata/tables.yaml @@ -761,6 +761,13 @@ table: name: email_audit_trail schema: public + - name: employee_teams + using: + foreign_key_constraint_on: + column: bodyshopid + table: + name: employee_teams + schema: public - name: employees using: foreign_key_constraint_on: @@ -1945,6 +1952,165 @@ - active: _eq: true check: null +- table: + name: employee_team_members + schema: public + object_relationships: + - name: employee + using: + foreign_key_constraint_on: employeeid + - name: employee_team + using: + foreign_key_constraint_on: teamid + insert_permissions: + - role: user + permission: + check: + employee_team: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - labor_rates + - percentage + - created_at + - updated_at + - employeeid + - id + - teamid + select_permissions: + - role: user + permission: + columns: + - labor_rates + - percentage + - created_at + - updated_at + - employeeid + - id + - teamid + filter: + employee_team: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + update_permissions: + - role: user + permission: + columns: + - labor_rates + - percentage + - created_at + - updated_at + - employeeid + - id + - teamid + filter: + employee_team: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + check: null + delete_permissions: + - role: user + permission: + backend_only: false + filter: + employee_team: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true +- table: + name: employee_teams + schema: public + object_relationships: + - name: bodyshop + using: + foreign_key_constraint_on: bodyshopid + array_relationships: + - name: employee_team_members + using: + foreign_key_constraint_on: + column: teamid + table: + name: employee_team_members + schema: public + insert_permissions: + - role: user + permission: + check: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - active + - name + - created_at + - updated_at + - bodyshopid + - id + select_permissions: + - role: user + permission: + columns: + - active + - name + - created_at + - updated_at + - bodyshopid + - id + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + update_permissions: + - role: user + permission: + columns: + - active + - bodyshopid + - name + - updated_at + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + check: null - table: name: employee_vacation schema: public @@ -2045,6 +2211,13 @@ table: name: allocations schema: public + - name: employee_team_members + using: + foreign_key_constraint_on: + column: employeeid + table: + name: employee_team_members + schema: public - name: employee_vacations using: foreign_key_constraint_on: @@ -2218,30 +2391,32 @@ - active: _eq: true columns: - - id - - created_at - - updated_at - - jobid - billid + - bodyshopid + - created_at + - id + - jobid + - message + - metadata - paymentid - successful - - message - - bodyshopid + - updated_at - useremail select_permissions: - role: user permission: columns: - - successful - - message - - useremail - - created_at - - updated_at - billid - bodyshopid + - created_at - id - jobid + - message + - metadata - paymentid + - successful + - updated_at + - useremail filter: bodyshop: associations: @@ -2493,6 +2668,7 @@ _eq: true columns: - act_price + - act_price_before_ppc - ah_detail_line - alt_co_id - alt_overrd @@ -2559,6 +2735,7 @@ permission: columns: - act_price + - act_price_before_ppc - ah_detail_line - alt_co_id - alt_overrd @@ -2637,6 +2814,7 @@ permission: columns: - act_price + - act_price_before_ppc - ah_detail_line - alt_co_id - alt_overrd diff --git a/hasura/migrations/1681329377686_alter_table_public_exportlog_add_column_metadata/down.sql b/hasura/migrations/1681329377686_alter_table_public_exportlog_add_column_metadata/down.sql new file mode 100644 index 000000000..3c175e747 --- /dev/null +++ b/hasura/migrations/1681329377686_alter_table_public_exportlog_add_column_metadata/down.sql @@ -0,0 +1,4 @@ +-- Could not auto-generate a down migration. +-- Please write an appropriate down migration for the SQL below: +-- alter table "public"."exportlog" add column "metadata" jsonb +-- null; diff --git a/hasura/migrations/1681329377686_alter_table_public_exportlog_add_column_metadata/up.sql b/hasura/migrations/1681329377686_alter_table_public_exportlog_add_column_metadata/up.sql new file mode 100644 index 000000000..621b8481c --- /dev/null +++ b/hasura/migrations/1681329377686_alter_table_public_exportlog_add_column_metadata/up.sql @@ -0,0 +1,2 @@ +alter table "public"."exportlog" add column "metadata" jsonb + null; diff --git a/server/cdk/cdk-job-export.js b/server/cdk/cdk-job-export.js index d5fb6b295..3987d21bc 100644 --- a/server/cdk/cdk-job-export.js +++ b/server/cdk/cdk-job-export.js @@ -224,6 +224,7 @@ async function CdkSelectedCustomer(socket, selectedCustomerId) { } finally { //Ensure we always insert logEvents //GQL to insert logevents. + CdkBase.createLogEvent( socket, "DEBUG", @@ -1213,6 +1214,7 @@ async function GenerateTransWips(socket) { wips.push(item); }); + socket.transWips = wips; return wips; } @@ -1388,6 +1390,7 @@ async function MarkJobExported(socket, jobid) { jobid: jobid, successful: true, useremail: socket.user.email, + metadata: socket.transWips, }, bill: { exported: true,