From 8d858cbf9bd88f5a775bb2a24c710d3514ba50f1 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Thu, 12 Nov 2020 14:25:48 -0800 Subject: [PATCH] RPS Admin db schema changes + flag updates. --- electron/decoder/decoder.js | 37 +++++++++++-------- .../down.yaml | 5 +++ .../up.yaml | 10 +++++ .../down.yaml | 23 ++++++++++++ .../up.yaml | 24 ++++++++++++ hasura/migrations/metadata.yaml | 3 +- 6 files changed, 85 insertions(+), 17 deletions(-) create mode 100644 hasura/migrations/1605053333239_alter_table_public_users_add_column_id/down.yaml create mode 100644 hasura/migrations/1605053333239_alter_table_public_users_add_column_id/up.yaml create mode 100644 hasura/migrations/1605053392992_update_permission_user_public_table_users/down.yaml create mode 100644 hasura/migrations/1605053392992_update_permission_user_public_table_users/up.yaml diff --git a/electron/decoder/decoder.js b/electron/decoder/decoder.js index 85a8485..28d1c8d 100644 --- a/electron/decoder/decoder.js +++ b/electron/decoder/decoder.js @@ -351,22 +351,26 @@ async function DecodeLinFile(extensionlessFilePath) { // jobline.glass_flag === false // ) .map((jobline) => { - if ( - (jobline.db_price === null || jobline.db_price === 0) && - !!jobline.act_price && - jobline.act_price > 0 - ) { - // log.info( - // "DB Price null/lower than act price", - // jobline.line_desc, - // jobline.db_price, - // jobline.act_price - // ); - jobline.db_price = jobline.act_price; - } + //Removed as a result of conversation with Norm. + // Appears you are calculating based on ‘N.A.’ part values in the Mitchell database. + // Reminder – if Mitchell DB has $0.00 price updates can be tracked, if it has N.A. it cannot calculate RPS value. + + // if ( + // (jobline.db_price === null || jobline.db_price === 0) && + // !!jobline.act_price && + // jobline.act_price > 0 + // ) { + // // log.info( + // // "DB Price null/lower than act price", + // // jobline.line_desc, + // // jobline.db_price, + // // jobline.act_price + // // ); + // jobline.db_price = jobline.act_price; + // } if ( - jobline.db_price && + jobline.db_price > 0 && jobline.act_price && jobline.act_price > jobline.db_price ) { @@ -388,11 +392,12 @@ async function DecodeLinFile(extensionlessFilePath) { jobline.line_desc.toLowerCase().startsWith("hazardous") || jobline.line_desc.toLowerCase().startsWith("detail") || jobline.line_desc.toLowerCase().startsWith("clean") || - jobline.part_type.toUpperCase() === "PAG" || + // jobline.part_type.toUpperCase() === "PAG" || jobline.part_type.toUpperCase() === "PAS" || jobline.part_type.toUpperCase() === "PASL" || jobline.part_type.toUpperCase() === "PAE" || - jobline.glass_flag === true + //jobline.glass_flag === true || + jobline.db_price === 0 ) jobline.ignore = true; diff --git a/hasura/migrations/1605053333239_alter_table_public_users_add_column_id/down.yaml b/hasura/migrations/1605053333239_alter_table_public_users_add_column_id/down.yaml new file mode 100644 index 0000000..032a708 --- /dev/null +++ b/hasura/migrations/1605053333239_alter_table_public_users_add_column_id/down.yaml @@ -0,0 +1,5 @@ +- args: + cascade: false + read_only: false + sql: ALTER TABLE "public"."users" DROP COLUMN "id"; + type: run_sql diff --git a/hasura/migrations/1605053333239_alter_table_public_users_add_column_id/up.yaml b/hasura/migrations/1605053333239_alter_table_public_users_add_column_id/up.yaml new file mode 100644 index 0000000..2a4b2b5 --- /dev/null +++ b/hasura/migrations/1605053333239_alter_table_public_users_add_column_id/up.yaml @@ -0,0 +1,10 @@ +- args: + cascade: false + read_only: false + sql: CREATE EXTENSION IF NOT EXISTS pgcrypto; + type: run_sql +- args: + cascade: false + read_only: false + sql: ALTER TABLE "public"."users" ADD COLUMN "id" uuid NULL UNIQUE DEFAULT gen_random_uuid(); + type: run_sql diff --git a/hasura/migrations/1605053392992_update_permission_user_public_table_users/down.yaml b/hasura/migrations/1605053392992_update_permission_user_public_table_users/down.yaml new file mode 100644 index 0000000..6613a78 --- /dev/null +++ b/hasura/migrations/1605053392992_update_permission_user_public_table_users/down.yaml @@ -0,0 +1,23 @@ +- args: + role: user + table: + name: users + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + columns: + - authid + - email + - created_at + - updated_at + computed_fields: [] + filter: + authid: + _eq: X-Hasura-User-Id + role: user + table: + name: users + schema: public + type: create_select_permission diff --git a/hasura/migrations/1605053392992_update_permission_user_public_table_users/up.yaml b/hasura/migrations/1605053392992_update_permission_user_public_table_users/up.yaml new file mode 100644 index 0000000..a055b70 --- /dev/null +++ b/hasura/migrations/1605053392992_update_permission_user_public_table_users/up.yaml @@ -0,0 +1,24 @@ +- args: + role: user + table: + name: users + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + columns: + - authid + - created_at + - email + - id + - updated_at + computed_fields: [] + filter: + authid: + _eq: X-Hasura-User-Id + role: user + table: + name: users + schema: public + type: create_select_permission diff --git a/hasura/migrations/metadata.yaml b/hasura/migrations/metadata.yaml index 26f5753..97056b2 100644 --- a/hasura/migrations/metadata.yaml +++ b/hasura/migrations/metadata.yaml @@ -317,8 +317,9 @@ tables: permission: columns: - authid - - email - created_at + - email + - id - updated_at filter: authid: