From 4c98a347f5f471e3f437e7496510beccefe208cc Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 13 Feb 2023 10:37:10 -0800 Subject: [PATCH 1/8] Additional indexes for performance improvements. --- .../1676311861487_create_index_jobs_idx_date_open/down.sql | 1 + .../1676311861487_create_index_jobs_idx_date_open/up.sql | 2 ++ .../1676311892023_create_index_jobs_idx_date_invoiced/down.sql | 1 + .../1676311892023_create_index_jobs_idx_date_invoiced/up.sql | 2 ++ .../1676312062111_create_index_idx_bills_vendorid/down.sql | 1 + .../1676312062111_create_index_idx_bills_vendorid/up.sql | 2 ++ .../down.sql | 1 + .../1676312093483_create_index_idx_parts_orders_vendorid/up.sql | 2 ++ .../1676312128665_create_index_idx_ccc_jobid/down.sql | 1 + .../migrations/1676312128665_create_index_idx_ccc_jobid/up.sql | 2 ++ .../1676312151899_create_index_idx_ccc_courtesycarid/down.sql | 1 + .../1676312151899_create_index_idx_ccc_courtesycarid/up.sql | 2 ++ .../down.sql | 1 + .../up.sql | 2 ++ .../1676312270714_create_index_idx_jobs_actual_in/down.sql | 1 + .../1676312270714_create_index_idx_jobs_actual_in/up.sql | 2 ++ .../1676312432487_create_index_idx_jobs_employee_csr/down.sql | 1 + .../1676312432487_create_index_idx_jobs_employee_csr/up.sql | 2 ++ .../1676312451545_create_index_idx_jobs_body_csr/down.sql | 1 + .../1676312451545_create_index_idx_jobs_body_csr/up.sql | 2 ++ .../down.sql | 1 + .../up.sql | 2 ++ .../down.sql | 1 + .../up.sql | 2 ++ .../down.sql | 1 + .../up.sql | 2 ++ .../1676312770241_create_index_idx_scoreboard_jobid/down.sql | 1 + .../1676312770241_create_index_idx_scoreboard_jobid/up.sql | 2 ++ .../1676312783297_create_index_idx_scoreboard_date/down.sql | 1 + .../1676312783297_create_index_idx_scoreboard_date/up.sql | 2 ++ .../1676312895007_create_index_idx_payments_date/down.sql | 1 + .../1676312895007_create_index_idx_payments_date/up.sql | 2 ++ .../1676313363752_create_index_exportlog_createdat/down.sql | 1 + .../1676313363752_create_index_exportlog_createdat/up.sql | 2 ++ 34 files changed, 51 insertions(+) create mode 100644 hasura/migrations/1676311861487_create_index_jobs_idx_date_open/down.sql create mode 100644 hasura/migrations/1676311861487_create_index_jobs_idx_date_open/up.sql create mode 100644 hasura/migrations/1676311892023_create_index_jobs_idx_date_invoiced/down.sql create mode 100644 hasura/migrations/1676311892023_create_index_jobs_idx_date_invoiced/up.sql create mode 100644 hasura/migrations/1676312062111_create_index_idx_bills_vendorid/down.sql create mode 100644 hasura/migrations/1676312062111_create_index_idx_bills_vendorid/up.sql create mode 100644 hasura/migrations/1676312093483_create_index_idx_parts_orders_vendorid/down.sql create mode 100644 hasura/migrations/1676312093483_create_index_idx_parts_orders_vendorid/up.sql create mode 100644 hasura/migrations/1676312128665_create_index_idx_ccc_jobid/down.sql create mode 100644 hasura/migrations/1676312128665_create_index_idx_ccc_jobid/up.sql create mode 100644 hasura/migrations/1676312151899_create_index_idx_ccc_courtesycarid/down.sql create mode 100644 hasura/migrations/1676312151899_create_index_idx_ccc_courtesycarid/up.sql create mode 100644 hasura/migrations/1676312254069_create_index_idx_jobs_actual_completion/down.sql create mode 100644 hasura/migrations/1676312254069_create_index_idx_jobs_actual_completion/up.sql create mode 100644 hasura/migrations/1676312270714_create_index_idx_jobs_actual_in/down.sql create mode 100644 hasura/migrations/1676312270714_create_index_idx_jobs_actual_in/up.sql create mode 100644 hasura/migrations/1676312432487_create_index_idx_jobs_employee_csr/down.sql create mode 100644 hasura/migrations/1676312432487_create_index_idx_jobs_employee_csr/up.sql create mode 100644 hasura/migrations/1676312451545_create_index_idx_jobs_body_csr/down.sql create mode 100644 hasura/migrations/1676312451545_create_index_idx_jobs_body_csr/up.sql create mode 100644 hasura/migrations/1676312468816_create_index_idx_jobs_employee_refinish/down.sql create mode 100644 hasura/migrations/1676312468816_create_index_idx_jobs_employee_refinish/up.sql create mode 100644 hasura/migrations/1676312526720_create_index_idx_timetickets_employeeid/down.sql create mode 100644 hasura/migrations/1676312526720_create_index_idx_timetickets_employeeid/up.sql create mode 100644 hasura/migrations/1676312560280_create_index_idx_timetickets_cost_center/down.sql create mode 100644 hasura/migrations/1676312560280_create_index_idx_timetickets_cost_center/up.sql create mode 100644 hasura/migrations/1676312770241_create_index_idx_scoreboard_jobid/down.sql create mode 100644 hasura/migrations/1676312770241_create_index_idx_scoreboard_jobid/up.sql create mode 100644 hasura/migrations/1676312783297_create_index_idx_scoreboard_date/down.sql create mode 100644 hasura/migrations/1676312783297_create_index_idx_scoreboard_date/up.sql create mode 100644 hasura/migrations/1676312895007_create_index_idx_payments_date/down.sql create mode 100644 hasura/migrations/1676312895007_create_index_idx_payments_date/up.sql create mode 100644 hasura/migrations/1676313363752_create_index_exportlog_createdat/down.sql create mode 100644 hasura/migrations/1676313363752_create_index_exportlog_createdat/up.sql diff --git a/hasura/migrations/1676311861487_create_index_jobs_idx_date_open/down.sql b/hasura/migrations/1676311861487_create_index_jobs_idx_date_open/down.sql new file mode 100644 index 000000000..b4a6d136e --- /dev/null +++ b/hasura/migrations/1676311861487_create_index_jobs_idx_date_open/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."jobs_idx_date_open"; diff --git a/hasura/migrations/1676311861487_create_index_jobs_idx_date_open/up.sql b/hasura/migrations/1676311861487_create_index_jobs_idx_date_open/up.sql new file mode 100644 index 000000000..d13cafa6c --- /dev/null +++ b/hasura/migrations/1676311861487_create_index_jobs_idx_date_open/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "jobs_idx_date_open" on + "public"."jobs" using btree ("date_open"); diff --git a/hasura/migrations/1676311892023_create_index_jobs_idx_date_invoiced/down.sql b/hasura/migrations/1676311892023_create_index_jobs_idx_date_invoiced/down.sql new file mode 100644 index 000000000..2131c2407 --- /dev/null +++ b/hasura/migrations/1676311892023_create_index_jobs_idx_date_invoiced/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."jobs_idx_date_invoiced"; diff --git a/hasura/migrations/1676311892023_create_index_jobs_idx_date_invoiced/up.sql b/hasura/migrations/1676311892023_create_index_jobs_idx_date_invoiced/up.sql new file mode 100644 index 000000000..946ca1cd4 --- /dev/null +++ b/hasura/migrations/1676311892023_create_index_jobs_idx_date_invoiced/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "jobs_idx_date_invoiced" on + "public"."jobs" using btree ("date_invoiced"); diff --git a/hasura/migrations/1676312062111_create_index_idx_bills_vendorid/down.sql b/hasura/migrations/1676312062111_create_index_idx_bills_vendorid/down.sql new file mode 100644 index 000000000..c918b314b --- /dev/null +++ b/hasura/migrations/1676312062111_create_index_idx_bills_vendorid/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."idx_bills_vendorid"; diff --git a/hasura/migrations/1676312062111_create_index_idx_bills_vendorid/up.sql b/hasura/migrations/1676312062111_create_index_idx_bills_vendorid/up.sql new file mode 100644 index 000000000..b5d6c91b5 --- /dev/null +++ b/hasura/migrations/1676312062111_create_index_idx_bills_vendorid/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "idx_bills_vendorid" on + "public"."bills" using btree ("vendorid"); diff --git a/hasura/migrations/1676312093483_create_index_idx_parts_orders_vendorid/down.sql b/hasura/migrations/1676312093483_create_index_idx_parts_orders_vendorid/down.sql new file mode 100644 index 000000000..10a22a2c1 --- /dev/null +++ b/hasura/migrations/1676312093483_create_index_idx_parts_orders_vendorid/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."idx_parts_orders_vendorid"; diff --git a/hasura/migrations/1676312093483_create_index_idx_parts_orders_vendorid/up.sql b/hasura/migrations/1676312093483_create_index_idx_parts_orders_vendorid/up.sql new file mode 100644 index 000000000..31b330a5c --- /dev/null +++ b/hasura/migrations/1676312093483_create_index_idx_parts_orders_vendorid/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "idx_parts_orders_vendorid" on + "public"."parts_orders" using btree ("vendorid"); diff --git a/hasura/migrations/1676312128665_create_index_idx_ccc_jobid/down.sql b/hasura/migrations/1676312128665_create_index_idx_ccc_jobid/down.sql new file mode 100644 index 000000000..ef80b76b5 --- /dev/null +++ b/hasura/migrations/1676312128665_create_index_idx_ccc_jobid/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."idx_ccc_jobid"; diff --git a/hasura/migrations/1676312128665_create_index_idx_ccc_jobid/up.sql b/hasura/migrations/1676312128665_create_index_idx_ccc_jobid/up.sql new file mode 100644 index 000000000..cf652183b --- /dev/null +++ b/hasura/migrations/1676312128665_create_index_idx_ccc_jobid/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "idx_ccc_jobid" on + "public"."cccontracts" using btree ("jobid"); diff --git a/hasura/migrations/1676312151899_create_index_idx_ccc_courtesycarid/down.sql b/hasura/migrations/1676312151899_create_index_idx_ccc_courtesycarid/down.sql new file mode 100644 index 000000000..578ff779d --- /dev/null +++ b/hasura/migrations/1676312151899_create_index_idx_ccc_courtesycarid/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."idx_ccc_courtesycarid"; diff --git a/hasura/migrations/1676312151899_create_index_idx_ccc_courtesycarid/up.sql b/hasura/migrations/1676312151899_create_index_idx_ccc_courtesycarid/up.sql new file mode 100644 index 000000000..0f9a67fb1 --- /dev/null +++ b/hasura/migrations/1676312151899_create_index_idx_ccc_courtesycarid/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "idx_ccc_courtesycarid" on + "public"."cccontracts" using btree ("courtesycarid"); diff --git a/hasura/migrations/1676312254069_create_index_idx_jobs_actual_completion/down.sql b/hasura/migrations/1676312254069_create_index_idx_jobs_actual_completion/down.sql new file mode 100644 index 000000000..90ab9e278 --- /dev/null +++ b/hasura/migrations/1676312254069_create_index_idx_jobs_actual_completion/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."idx_jobs_actual_completion"; diff --git a/hasura/migrations/1676312254069_create_index_idx_jobs_actual_completion/up.sql b/hasura/migrations/1676312254069_create_index_idx_jobs_actual_completion/up.sql new file mode 100644 index 000000000..c017e456e --- /dev/null +++ b/hasura/migrations/1676312254069_create_index_idx_jobs_actual_completion/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "idx_jobs_actual_completion" on + "public"."jobs" using btree ("actual_completion"); diff --git a/hasura/migrations/1676312270714_create_index_idx_jobs_actual_in/down.sql b/hasura/migrations/1676312270714_create_index_idx_jobs_actual_in/down.sql new file mode 100644 index 000000000..35622d565 --- /dev/null +++ b/hasura/migrations/1676312270714_create_index_idx_jobs_actual_in/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."idx_jobs_actual_in"; diff --git a/hasura/migrations/1676312270714_create_index_idx_jobs_actual_in/up.sql b/hasura/migrations/1676312270714_create_index_idx_jobs_actual_in/up.sql new file mode 100644 index 000000000..126131e83 --- /dev/null +++ b/hasura/migrations/1676312270714_create_index_idx_jobs_actual_in/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "idx_jobs_actual_in" on + "public"."jobs" using btree ("actual_in"); diff --git a/hasura/migrations/1676312432487_create_index_idx_jobs_employee_csr/down.sql b/hasura/migrations/1676312432487_create_index_idx_jobs_employee_csr/down.sql new file mode 100644 index 000000000..0c68e5bc6 --- /dev/null +++ b/hasura/migrations/1676312432487_create_index_idx_jobs_employee_csr/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."idx_jobs_employee_csr"; diff --git a/hasura/migrations/1676312432487_create_index_idx_jobs_employee_csr/up.sql b/hasura/migrations/1676312432487_create_index_idx_jobs_employee_csr/up.sql new file mode 100644 index 000000000..43c24db44 --- /dev/null +++ b/hasura/migrations/1676312432487_create_index_idx_jobs_employee_csr/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "idx_jobs_employee_csr" on + "public"."jobs" using btree ("employee_csr"); diff --git a/hasura/migrations/1676312451545_create_index_idx_jobs_body_csr/down.sql b/hasura/migrations/1676312451545_create_index_idx_jobs_body_csr/down.sql new file mode 100644 index 000000000..459da62c8 --- /dev/null +++ b/hasura/migrations/1676312451545_create_index_idx_jobs_body_csr/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."idx_jobs_body_csr"; diff --git a/hasura/migrations/1676312451545_create_index_idx_jobs_body_csr/up.sql b/hasura/migrations/1676312451545_create_index_idx_jobs_body_csr/up.sql new file mode 100644 index 000000000..c86c53041 --- /dev/null +++ b/hasura/migrations/1676312451545_create_index_idx_jobs_body_csr/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "idx_jobs_body_csr" on + "public"."jobs" using btree ("employee_body"); diff --git a/hasura/migrations/1676312468816_create_index_idx_jobs_employee_refinish/down.sql b/hasura/migrations/1676312468816_create_index_idx_jobs_employee_refinish/down.sql new file mode 100644 index 000000000..1197ee8a5 --- /dev/null +++ b/hasura/migrations/1676312468816_create_index_idx_jobs_employee_refinish/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."idx_jobs_employee_refinish"; diff --git a/hasura/migrations/1676312468816_create_index_idx_jobs_employee_refinish/up.sql b/hasura/migrations/1676312468816_create_index_idx_jobs_employee_refinish/up.sql new file mode 100644 index 000000000..d740ff652 --- /dev/null +++ b/hasura/migrations/1676312468816_create_index_idx_jobs_employee_refinish/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "idx_jobs_employee_refinish" on + "public"."jobs" using btree ("employee_refinish"); diff --git a/hasura/migrations/1676312526720_create_index_idx_timetickets_employeeid/down.sql b/hasura/migrations/1676312526720_create_index_idx_timetickets_employeeid/down.sql new file mode 100644 index 000000000..2fbbfaeee --- /dev/null +++ b/hasura/migrations/1676312526720_create_index_idx_timetickets_employeeid/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."idx_timetickets_employeeid"; diff --git a/hasura/migrations/1676312526720_create_index_idx_timetickets_employeeid/up.sql b/hasura/migrations/1676312526720_create_index_idx_timetickets_employeeid/up.sql new file mode 100644 index 000000000..29643ac97 --- /dev/null +++ b/hasura/migrations/1676312526720_create_index_idx_timetickets_employeeid/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "idx_timetickets_employeeid" on + "public"."timetickets" using btree ("employeeid"); diff --git a/hasura/migrations/1676312560280_create_index_idx_timetickets_cost_center/down.sql b/hasura/migrations/1676312560280_create_index_idx_timetickets_cost_center/down.sql new file mode 100644 index 000000000..1347b458b --- /dev/null +++ b/hasura/migrations/1676312560280_create_index_idx_timetickets_cost_center/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."idx_timetickets_cost_center"; diff --git a/hasura/migrations/1676312560280_create_index_idx_timetickets_cost_center/up.sql b/hasura/migrations/1676312560280_create_index_idx_timetickets_cost_center/up.sql new file mode 100644 index 000000000..360b1b7b1 --- /dev/null +++ b/hasura/migrations/1676312560280_create_index_idx_timetickets_cost_center/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "idx_timetickets_cost_center" on + "public"."timetickets" using btree ("cost_center"); diff --git a/hasura/migrations/1676312770241_create_index_idx_scoreboard_jobid/down.sql b/hasura/migrations/1676312770241_create_index_idx_scoreboard_jobid/down.sql new file mode 100644 index 000000000..4bcb3fb3b --- /dev/null +++ b/hasura/migrations/1676312770241_create_index_idx_scoreboard_jobid/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."idx_scoreboard_jobid"; diff --git a/hasura/migrations/1676312770241_create_index_idx_scoreboard_jobid/up.sql b/hasura/migrations/1676312770241_create_index_idx_scoreboard_jobid/up.sql new file mode 100644 index 000000000..dd2ebd94b --- /dev/null +++ b/hasura/migrations/1676312770241_create_index_idx_scoreboard_jobid/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "idx_scoreboard_jobid" on + "public"."scoreboard" using btree ("jobid"); diff --git a/hasura/migrations/1676312783297_create_index_idx_scoreboard_date/down.sql b/hasura/migrations/1676312783297_create_index_idx_scoreboard_date/down.sql new file mode 100644 index 000000000..9e8280044 --- /dev/null +++ b/hasura/migrations/1676312783297_create_index_idx_scoreboard_date/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."idx_scoreboard_date"; diff --git a/hasura/migrations/1676312783297_create_index_idx_scoreboard_date/up.sql b/hasura/migrations/1676312783297_create_index_idx_scoreboard_date/up.sql new file mode 100644 index 000000000..a1bba7bc2 --- /dev/null +++ b/hasura/migrations/1676312783297_create_index_idx_scoreboard_date/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "idx_scoreboard_date" on + "public"."scoreboard" using btree ("date"); diff --git a/hasura/migrations/1676312895007_create_index_idx_payments_date/down.sql b/hasura/migrations/1676312895007_create_index_idx_payments_date/down.sql new file mode 100644 index 000000000..b6dd8dd9b --- /dev/null +++ b/hasura/migrations/1676312895007_create_index_idx_payments_date/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."idx_payments_date"; diff --git a/hasura/migrations/1676312895007_create_index_idx_payments_date/up.sql b/hasura/migrations/1676312895007_create_index_idx_payments_date/up.sql new file mode 100644 index 000000000..4092265bd --- /dev/null +++ b/hasura/migrations/1676312895007_create_index_idx_payments_date/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "idx_payments_date" on + "public"."payments" using btree ("date"); diff --git a/hasura/migrations/1676313363752_create_index_exportlog_createdat/down.sql b/hasura/migrations/1676313363752_create_index_exportlog_createdat/down.sql new file mode 100644 index 000000000..8d1d6d86c --- /dev/null +++ b/hasura/migrations/1676313363752_create_index_exportlog_createdat/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."exportlog_createdat"; diff --git a/hasura/migrations/1676313363752_create_index_exportlog_createdat/up.sql b/hasura/migrations/1676313363752_create_index_exportlog_createdat/up.sql new file mode 100644 index 000000000..acf610ce7 --- /dev/null +++ b/hasura/migrations/1676313363752_create_index_exportlog_createdat/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "exportlog_createdat" on + "public"."exportlog" using btree ("created_at"); From bf34765e6bd78e767cdfbf9c4b544ea0dc748801 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 13 Feb 2023 11:21:59 -0800 Subject: [PATCH 2/8] Additional Hasura Indexes. --- .../1676314283711_create_index_idx_transitions_jobid/down.sql | 1 + .../1676314283711_create_index_idx_transitions_jobid/up.sql | 2 ++ .../1676314300650_create_index_idx_transitions_start/down.sql | 1 + .../1676314300650_create_index_idx_transitions_start/up.sql | 2 ++ .../1676314314574_create_index_idx_transitions_end/down.sql | 1 + .../1676314314574_create_index_idx_transitions_end/up.sql | 2 ++ .../1676314562876_create_index_idx_audit_bodyshopid/down.sql | 1 + .../1676314562876_create_index_idx_audit_bodyshopid/up.sql | 2 ++ .../1676314573827_create_index_idx_audit_jobid/down.sql | 1 + .../1676314573827_create_index_idx_audit_jobid/up.sql | 2 ++ .../1676314593147_create_index_idx_audit_billid/down.sql | 1 + .../1676314593147_create_index_idx_audit_billid/up.sql | 2 ++ 12 files changed, 18 insertions(+) create mode 100644 hasura/migrations/1676314283711_create_index_idx_transitions_jobid/down.sql create mode 100644 hasura/migrations/1676314283711_create_index_idx_transitions_jobid/up.sql create mode 100644 hasura/migrations/1676314300650_create_index_idx_transitions_start/down.sql create mode 100644 hasura/migrations/1676314300650_create_index_idx_transitions_start/up.sql create mode 100644 hasura/migrations/1676314314574_create_index_idx_transitions_end/down.sql create mode 100644 hasura/migrations/1676314314574_create_index_idx_transitions_end/up.sql create mode 100644 hasura/migrations/1676314562876_create_index_idx_audit_bodyshopid/down.sql create mode 100644 hasura/migrations/1676314562876_create_index_idx_audit_bodyshopid/up.sql create mode 100644 hasura/migrations/1676314573827_create_index_idx_audit_jobid/down.sql create mode 100644 hasura/migrations/1676314573827_create_index_idx_audit_jobid/up.sql create mode 100644 hasura/migrations/1676314593147_create_index_idx_audit_billid/down.sql create mode 100644 hasura/migrations/1676314593147_create_index_idx_audit_billid/up.sql diff --git a/hasura/migrations/1676314283711_create_index_idx_transitions_jobid/down.sql b/hasura/migrations/1676314283711_create_index_idx_transitions_jobid/down.sql new file mode 100644 index 000000000..6db0598c0 --- /dev/null +++ b/hasura/migrations/1676314283711_create_index_idx_transitions_jobid/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."idx_transitions_jobid"; diff --git a/hasura/migrations/1676314283711_create_index_idx_transitions_jobid/up.sql b/hasura/migrations/1676314283711_create_index_idx_transitions_jobid/up.sql new file mode 100644 index 000000000..fa0805f87 --- /dev/null +++ b/hasura/migrations/1676314283711_create_index_idx_transitions_jobid/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "idx_transitions_jobid" on + "public"."transitions" using btree ("jobid"); diff --git a/hasura/migrations/1676314300650_create_index_idx_transitions_start/down.sql b/hasura/migrations/1676314300650_create_index_idx_transitions_start/down.sql new file mode 100644 index 000000000..83ac00b80 --- /dev/null +++ b/hasura/migrations/1676314300650_create_index_idx_transitions_start/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."idx_transitions_start"; diff --git a/hasura/migrations/1676314300650_create_index_idx_transitions_start/up.sql b/hasura/migrations/1676314300650_create_index_idx_transitions_start/up.sql new file mode 100644 index 000000000..1105a9bfb --- /dev/null +++ b/hasura/migrations/1676314300650_create_index_idx_transitions_start/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "idx_transitions_start" on + "public"."transitions" using btree ("start"); diff --git a/hasura/migrations/1676314314574_create_index_idx_transitions_end/down.sql b/hasura/migrations/1676314314574_create_index_idx_transitions_end/down.sql new file mode 100644 index 000000000..e5910f089 --- /dev/null +++ b/hasura/migrations/1676314314574_create_index_idx_transitions_end/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."idx_transitions_end"; diff --git a/hasura/migrations/1676314314574_create_index_idx_transitions_end/up.sql b/hasura/migrations/1676314314574_create_index_idx_transitions_end/up.sql new file mode 100644 index 000000000..53b208383 --- /dev/null +++ b/hasura/migrations/1676314314574_create_index_idx_transitions_end/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "idx_transitions_end" on + "public"."transitions" using btree ("end"); diff --git a/hasura/migrations/1676314562876_create_index_idx_audit_bodyshopid/down.sql b/hasura/migrations/1676314562876_create_index_idx_audit_bodyshopid/down.sql new file mode 100644 index 000000000..705f82c31 --- /dev/null +++ b/hasura/migrations/1676314562876_create_index_idx_audit_bodyshopid/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."idx_audit_bodyshopid"; diff --git a/hasura/migrations/1676314562876_create_index_idx_audit_bodyshopid/up.sql b/hasura/migrations/1676314562876_create_index_idx_audit_bodyshopid/up.sql new file mode 100644 index 000000000..4d0f4ffbc --- /dev/null +++ b/hasura/migrations/1676314562876_create_index_idx_audit_bodyshopid/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "idx_audit_bodyshopid" on + "public"."audit_trail" using btree ("bodyshopid"); diff --git a/hasura/migrations/1676314573827_create_index_idx_audit_jobid/down.sql b/hasura/migrations/1676314573827_create_index_idx_audit_jobid/down.sql new file mode 100644 index 000000000..935c7dc0f --- /dev/null +++ b/hasura/migrations/1676314573827_create_index_idx_audit_jobid/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."idx_audit_jobid"; diff --git a/hasura/migrations/1676314573827_create_index_idx_audit_jobid/up.sql b/hasura/migrations/1676314573827_create_index_idx_audit_jobid/up.sql new file mode 100644 index 000000000..dd88a8429 --- /dev/null +++ b/hasura/migrations/1676314573827_create_index_idx_audit_jobid/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "idx_audit_jobid" on + "public"."audit_trail" using btree ("jobid"); diff --git a/hasura/migrations/1676314593147_create_index_idx_audit_billid/down.sql b/hasura/migrations/1676314593147_create_index_idx_audit_billid/down.sql new file mode 100644 index 000000000..cc231b035 --- /dev/null +++ b/hasura/migrations/1676314593147_create_index_idx_audit_billid/down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS "public"."idx_audit_billid"; diff --git a/hasura/migrations/1676314593147_create_index_idx_audit_billid/up.sql b/hasura/migrations/1676314593147_create_index_idx_audit_billid/up.sql new file mode 100644 index 000000000..88c77ecd7 --- /dev/null +++ b/hasura/migrations/1676314593147_create_index_idx_audit_billid/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX "idx_audit_billid" on + "public"."audit_trail" using btree ("billid"); From 24da0207e51b9318ec1b8edd04d0e587574d2a8e Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Tue, 14 Feb 2023 11:30:09 -0800 Subject: [PATCH 3/8] IO-2173 Client Fusion - Job Line Discount not allowed Adjust client job-line-upsert-modal to allow for discounts as markups were only allowed before. Convert prt_dsmk_p over to prt_dsmk_m on save of modal for both markup/discount for handling and viewing --- .../job-lines-upsert-modal.component.jsx | 2 +- .../job-lines-upsert-modal.container.jsx | 21 +++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx b/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx index 4fed7188b..fdf5207db 100644 --- a/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx +++ b/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.component.jsx @@ -289,7 +289,7 @@ export function JobLinesUpsertModalComponent({ name="prt_dsmk_p" initialValue={0} > - + = 0 ? 1 : -1) + .toFormat(0.0), + }), }, ], }, @@ -68,7 +77,15 @@ function JobLinesUpsertModalContainer({ const r = await updateJobLine({ variables: { lineId: jobLineEditModal.context.id, - line: values, + line: { + ...values, + prt_dsmk_m: Dinero({ + amount: Math.round(values.act_price * 100), + }) + .percentage(Math.abs(values.prt_dsmk_p || 0)) + .multiply(values.prt_dsmk_p >= 0 ? 1 : -1) + .toFormat(0.0), + }, }, refetchQueries: ["GET_LINE_TICKET_BY_PK"], }); From c2bf6841e1f08c5c52eba79c5a52a7b2dffa1be4 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 14 Feb 2023 15:05:09 -0800 Subject: [PATCH 4/8] Documentation updates. --- README.MD | 13 +------------ .../1676337846761_run_sql_migration/down.sql | 11 +++++++++++ .../1676337846761_run_sql_migration/up.sql | 9 +++++++++ server/email/sendemail.js | 2 +- 4 files changed, 22 insertions(+), 13 deletions(-) create mode 100644 hasura/migrations/1676337846761_run_sql_migration/down.sql create mode 100644 hasura/migrations/1676337846761_run_sql_migration/up.sql diff --git a/README.MD b/README.MD index 6dc22d38b..27be64f0a 100644 --- a/README.MD +++ b/README.MD @@ -1,14 +1,3 @@ -Yarn Dependency Management: -To force upgrades for some packages: -yarn upgrade-interactive --latest - -To Start Hasura CLI: -npx hasura console - -Migrating to Staging: -npx hasura migrate apply --endpoint https://db.imex.online/ --admin-secret 'Production-ImEXOnline!@#' -npx hasura migrate apply --endpoint https://db.test.bodyshop.app/ --admin-secret 'Test-ImEXOnlineBySnaptSoftware!' - NGROK TEsting: ./ngrok.exe http http://localhost:4000 -host-header="localhost:4000" @@ -21,4 +10,4 @@ hasura migrate apply --version "1620771761757" --skip-execution --endpoint https hasura migrate status --endpoint https://db.imex.online/ --admin-secret 'Production-ImEXOnline!@#' Generate the license file: -$ generate-license-file --input package.json --output third-party-licenses.txt --overwrite +$ generate-license-file --input package.json --output third-party-licenses.txt --overwrite \ No newline at end of file diff --git a/hasura/migrations/1676337846761_run_sql_migration/down.sql b/hasura/migrations/1676337846761_run_sql_migration/down.sql new file mode 100644 index 000000000..dfab8b8c8 --- /dev/null +++ b/hasura/migrations/1676337846761_run_sql_migration/down.sql @@ -0,0 +1,11 @@ +-- Could not auto-generate a down migration. +-- Please write an appropriate down migration for the SQL below: +-- CREATE INDEX idx_phonebook_firstname ON public.phonebook USING gin (firstname public.gin_trgm_ops); +-- CREATE INDEX idx_phonebook_lastname ON public.phonebook USING gin (lastname public.gin_trgm_ops); +-- CREATE INDEX idx_phonebook_company ON public.phonebook USING gin (company public.gin_trgm_ops); +-- CREATE INDEX idx_phonebook_address1 ON public.phonebook USING gin (address1 public.gin_trgm_ops); +-- CREATE INDEX idx_phonebook_phone1 ON public.phonebook USING gin (phone1 public.gin_trgm_ops); +-- CREATE INDEX idx_phonebook_phone2 ON public.phonebook USING gin (phone2 public.gin_trgm_ops); +-- CREATE INDEX idx_phonebook_email ON public.phonebook USING gin (email public.gin_trgm_ops); +-- CREATE INDEX idx_phonebook_category ON public.phonebook USING gin (category public.gin_trgm_ops); +-- CREATE INDEX idx_vendor_name ON public.vendors USING gin (name public.gin_trgm_ops); diff --git a/hasura/migrations/1676337846761_run_sql_migration/up.sql b/hasura/migrations/1676337846761_run_sql_migration/up.sql new file mode 100644 index 000000000..c469df083 --- /dev/null +++ b/hasura/migrations/1676337846761_run_sql_migration/up.sql @@ -0,0 +1,9 @@ +CREATE INDEX idx_phonebook_firstname ON public.phonebook USING gin (firstname public.gin_trgm_ops); +CREATE INDEX idx_phonebook_lastname ON public.phonebook USING gin (lastname public.gin_trgm_ops); +CREATE INDEX idx_phonebook_company ON public.phonebook USING gin (company public.gin_trgm_ops); +CREATE INDEX idx_phonebook_address1 ON public.phonebook USING gin (address1 public.gin_trgm_ops); +CREATE INDEX idx_phonebook_phone1 ON public.phonebook USING gin (phone1 public.gin_trgm_ops); +CREATE INDEX idx_phonebook_phone2 ON public.phonebook USING gin (phone2 public.gin_trgm_ops); +CREATE INDEX idx_phonebook_email ON public.phonebook USING gin (email public.gin_trgm_ops); +CREATE INDEX idx_phonebook_category ON public.phonebook USING gin (category public.gin_trgm_ops); +CREATE INDEX idx_vendor_name ON public.vendors USING gin (name public.gin_trgm_ops); diff --git a/server/email/sendemail.js b/server/email/sendemail.js index 28c0adf5d..046ca16ee 100644 --- a/server/email/sendemail.js +++ b/server/email/sendemail.js @@ -28,7 +28,7 @@ exports.sendServerEmail = async function ({ subject, text }) { transporter.sendMail( { from: `ImEX Online API - ${process.env.NODE_ENV} `, - to: ["patrick@snapt.ca"], + to: ["patrick@imexsystems.ca"], subject: subject, text: text, ses: { From 3650cacb51de64afb861d29e12f592062c16046b Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Thu, 16 Feb 2023 17:23:09 -0800 Subject: [PATCH 5/8] IO-2173 Job Line Discount Correct for when new line is added with no part --- .../job-lines-upsert-modal/job-lines-upsert-modal.container.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.container.jsx b/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.container.jsx index 006459959..f4c7d87a4 100644 --- a/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.container.jsx +++ b/client/src/components/job-lines-upsert-modal/job-lines-upsert-modal.container.jsx @@ -44,7 +44,7 @@ function JobLinesUpsertModalContainer({ ...UndefinedToNull({ ...values, prt_dsmk_m: Dinero({ - amount: Math.round(values.act_price * 100), + amount: Math.round((values.act_price || 0) * 100), }) .percentage(Math.abs(values.prt_dsmk_p || 0)) .multiply(values.prt_dsmk_p >= 0 ? 1 : -1) From ae4cff98e7b8b01b82cdc4dacc7888dbf8973d31 Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Thu, 16 Feb 2023 17:26:57 -0800 Subject: [PATCH 6/8] IO-2175 Category Dropdown Clear Allow for clear and correct for Select allowClear sending undefined and convert that to null. Overload UndefinedtoNull to have an array of keys --- .../jobs-detail-general/jobs-detail-general.component.jsx | 2 +- client/src/pages/jobs-detail/jobs-detail.page.component.jsx | 3 ++- client/src/utils/undefinedtonull.js | 6 +++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/client/src/components/jobs-detail-general/jobs-detail-general.component.jsx b/client/src/components/jobs-detail-general/jobs-detail-general.component.jsx index 0e59129c8..90c659aac 100644 --- a/client/src/components/jobs-detail-general/jobs-detail-general.component.jsx +++ b/client/src/components/jobs-detail-general/jobs-detail-general.component.jsx @@ -256,7 +256,7 @@ export function JobsDetailGeneral({ bodyshop, jobRO, job, form }) { - {bodyshop.md_categories.map((s) => ( {s} diff --git a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx index f2614e9c9..5533666a1 100644 --- a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx +++ b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx @@ -51,6 +51,7 @@ import JobAuditTrail from "../../components/job-audit-trail/job-audit-trail.comp import AuditTrailMapping from "../../utils/AuditTrailMappings"; import { insertAuditTrail } from "../../redux/application/application.actions"; import JobsDocumentsLocalGallery from "../../components/jobs-documents-local-gallery/jobs-documents-local-gallery.container"; +import UndefinedToNull from "../../utils/undefinedtonull"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -96,7 +97,7 @@ export function JobsDetailPage({ variables: { jobId: job.id, job: { - ...values, + ...UndefinedToNull(values, ["alt_transport", "category", "referral_source"]), parts_tax_rates: { ...job.parts_tax_rates, ...values.parts_tax_rates, diff --git a/client/src/utils/undefinedtonull.js b/client/src/utils/undefinedtonull.js index 841701c8c..7da68e931 100644 --- a/client/src/utils/undefinedtonull.js +++ b/client/src/utils/undefinedtonull.js @@ -1,6 +1,10 @@ -export default function UndefinedToNull(obj) { +export default function UndefinedToNull(obj, keys) { Object.keys(obj).forEach((key) => { + if (keys && keys.indexOf(key) >= 0) { + if (obj[key] === undefined) obj[key] = null; + } else { if (obj[key] === undefined) obj[key] = null; + } }); return obj; } From 623ee8fbb19abda0a924e98df9b5ec3785ca2da9 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Wed, 22 Feb 2023 08:02:10 -0800 Subject: [PATCH 7/8] WIP TotalsUpdates. --- .circleci/config.yml | 5 +- client/.env.production | 8 +-- client/.env.test | 4 +- .../job-totals-table.component.jsx | 3 +- .../jobs-available-table.container.jsx | 6 +-- job-totals-testing-util.js | 2 +- server/job/job-totals.js | 52 ++++++++++--------- 7 files changed, 43 insertions(+), 37 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 265807436..07882fa41 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -66,8 +66,9 @@ jobs: - aws-s3/sync: from: build - to: "s3://rome-online-production/" + to: "s3://imex-online-production/" - jira/notify + rome-api-deploy: docker: - image: "cimg/base:stable" @@ -128,7 +129,7 @@ jobs: - aws-s3/sync: from: build - to: "s3://imex-online-production/" + to: "s3://rome-online-production/" - jira/notify test-hasura-migrate: diff --git a/client/.env.production b/client/.env.production index 7a58e4591..81d504796 100644 --- a/client/.env.production +++ b/client/.env.production @@ -1,12 +1,12 @@ -REACT_APP_GRAPHQL_ENDPOINT=https://db.imex.online/v1/graphql -REACT_APP_GRAPHQL_ENDPOINT_WS=wss://db.imex.online/v1/graphql +REACT_APP_GRAPHQL_ENDPOINT=https://db.test.bodyshop.app/v1/graphql +REACT_APP_GRAPHQL_ENDPOINT_WS=wss://db.test.bodyshop.app/v1/graphql REACT_APP_GA_CODE=231103507 -REACT_APP_FIREBASE_CONFIG={"apiKey":"AIzaSyDSezy-jGJreo7ulgpLdlpOwAOrgcaEkhU","authDomain":"imex-prod.firebaseapp.com","databaseURL":"https://imex-prod.firebaseio.com","projectId":"imex-prod","storageBucket":"imex-prod.appspot.com","messagingSenderId":"253497221485","appId":"1:253497221485:web:3c81c483b94db84b227a64","measurementId":"G-NTWBKG2L0M"} +REACT_APP_FIREBASE_CONFIG={ "apiKey": "AIzaSyAuLQR9SV5LsVxjU8wh9hvFLdhcAHU6cxE", "authDomain": "rome-prod-1.firebaseapp.com", "projectId": "rome-prod-1", "storageBucket": "rome-prod-1.appspot.com", "messagingSenderId": "147786367145", "appId": "1:147786367145:web:9d4cba68071c3f29a8a9b8", "measurementId": "G-G8Z9DRHTZS"} REACT_APP_CLOUDINARY_ENDPOINT_API=https://api.cloudinary.com/v1_1/bodyshop REACT_APP_CLOUDINARY_ENDPOINT=https://res.cloudinary.com/bodyshop REACT_APP_CLOUDINARY_API_KEY=473322739956866 REACT_APP_CLOUDINARY_THUMB_TRANSFORMATIONS=c_fill,h_250,w_250 -REACT_APP_FIREBASE_PUBLIC_VAPID_KEY='BMgZT1NZztW2DsJl8Mg2L04hgY9FzAg6b8fbzgNAfww2VDzH3VE63Ot9EaP_U7KWS2JT-7HPHaw0T_Tw_5vkZc8' +REACT_APP_FIREBASE_PUBLIC_VAPID_KEY='BP1B7ZTYpn-KMt6nOxlld6aS8Skt3Q7ZLEqP0hAvGHxG4UojPYiXZ6kPlzZkUC5jH-EcWXomTLtmadAIxurfcHo' REACT_APP_STRIPE_PUBLIC_KEY=pk_test_51GqB4TJl3nQjrZ0wCQWAxAhlNF8jKe0tipIa6ExBaxwJGitwvFsIZUEua4dUzaMIAuXp4qwYHXx7lgjyQSwP0Pe900vzm38C7g REACT_APP_AXIOS_BASE_API_URL=https://api.imex.online/ REACT_APP_REPORTS_SERVER_URL=https://reports.imex.online diff --git a/client/.env.test b/client/.env.test index c6403dee6..6768939ff 100644 --- a/client/.env.test +++ b/client/.env.test @@ -8,7 +8,7 @@ REACT_APP_CLOUDINARY_API_KEY=473322739956866 REACT_APP_CLOUDINARY_THUMB_TRANSFORMATIONS=c_fill,h_250,w_250 REACT_APP_FIREBASE_PUBLIC_VAPID_KEY='BN2GcDPjipR5MTEosO5dT4CfQ3cmrdBIsI4juoOQrRijn_5aRiHlwj1mlq0W145mOusx6xynEKl_tvYJhpCc9lo' REACT_APP_STRIPE_PUBLIC_KEY=pk_test_51GqB4TJl3nQjrZ0wCQWAxAhlNF8jKe0tipIa6ExBaxwJGitwvFsIZUEua4dUzaMIAuXp4qwYHXx7lgjyQSwP0Pe900vzm38C7g -REACT_APP_AXIOS_BASE_API_URL=https://api.test.imex.online/ -REACT_APP_REPORTS_SERVER_URL=https://reports3.test.imex.online +REACT_APP_AXIOS_BASE_API_URL=https://api.romeonline.io/ +REACT_APP_REPORTS_SERVER_URL=https://reports.romeonline.io REACT_APP_IS_TEST=true REACT_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc \ No newline at end of file diff --git a/client/src/components/job-totals-table/job-totals-table.component.jsx b/client/src/components/job-totals-table/job-totals-table.component.jsx index ecfd6bccc..49536ce22 100644 --- a/client/src/components/job-totals-table/job-totals-table.component.jsx +++ b/client/src/components/job-totals-table/job-totals-table.component.jsx @@ -67,7 +67,8 @@ export function JobsTotalsTableComponent({ jobRO, currentUser, job }) { - {currentUser.email.includes("@imex.") && ( + {(currentUser.email.includes("@imex.") || + currentUser.email.includes("@rome.")) && ( diff --git a/client/src/components/jobs-available-table/jobs-available-table.container.jsx b/client/src/components/jobs-available-table/jobs-available-table.container.jsx index 1d864300f..6f894644e 100644 --- a/client/src/components/jobs-available-table/jobs-available-table.container.jsx +++ b/client/src/components/jobs-available-table/jobs-available-table.container.jsx @@ -497,7 +497,7 @@ async function CheckTaxRates(estData, bodyshop) { //IO-1387 If a sublet line is NOT R&R, use the labor tax. If it is, use the sublet tax rate. //Currently limited to SK shops only. - //if (bodyshop.region_config === "CA_SK") { + if (bodyshop.region_config === "CA_SK") { estData.joblines.data.forEach((jl, index) => { if ( (jl.part_type === "PASL" || jl.part_type === "PAS") && @@ -512,7 +512,7 @@ async function CheckTaxRates(estData, bodyshop) { estData.joblines.data[index].tax_part = true; } }); - //} + } } async function ResolveCCCLineIssues(estData, bodyshop) { @@ -523,7 +523,7 @@ async function ResolveCCCLineIssues(estData, bodyshop) { if (line.misc_amt && line.misc_amt !== 0) { line.act_price = line.misc_amt; line.part_type = "PAS"; - line.tax_part = line.misc_tax; + line.tax_part = !!line.misc_tax; } }); diff --git a/job-totals-testing-util.js b/job-totals-testing-util.js index bbf13d99f..7217fe418 100644 --- a/job-totals-testing-util.js +++ b/job-totals-testing-util.js @@ -20,7 +20,7 @@ require("dotenv").config({ async function RunTheTest() { const bodyshopids = ["6c63a820-542c-497e-8c82-0cc38fb2bbca"]; - const bearerToken = `Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImQwNWI0MDljNmYyMmM0MDNlMWY5MWY5ODY3YWM0OTJhOTA2MTk1NTgiLCJ0eXAiOiJKV1QifQ.eyJuYW1lIjoiUGF0cmljayBGaWMgKERFVikiLCJodHRwczovL2hhc3VyYS5pby9qd3QvY2xhaW1zIjp7IngtaGFzdXJhLWRlZmF1bHQtcm9sZSI6InVzZXIiLCJ4LWhhc3VyYS1hbGxvd2VkLXJvbGVzIjpbInVzZXIiXSwieC1oYXN1cmEtdXNlci1pZCI6ImhOSjhBRHB0REhRQkRFcXNCOFFNWVRqaURuZjEifSwiaXNzIjoiaHR0cHM6Ly9zZWN1cmV0b2tlbi5nb29nbGUuY29tL2ltZXgtZGV2IiwiYXVkIjoiaW1leC1kZXYiLCJhdXRoX3RpbWUiOjE2NzQ1OTgwMTEsInVzZXJfaWQiOiJoTko4QURwdERIUUJERXFzQjhRTVlUamlEbmYxIiwic3ViIjoiaE5KOEFEcHRESFFCREVxc0I4UU1ZVGppRG5mMSIsImlhdCI6MTY3NDc3ODM3NCwiZXhwIjoxNjc0NzgxOTc0LCJlbWFpbCI6InBhdHJpY2tAaW1leC5kZXYiLCJlbWFpbF92ZXJpZmllZCI6ZmFsc2UsImZpcmViYXNlIjp7ImlkZW50aXRpZXMiOnsiZW1haWwiOlsicGF0cmlja0BpbWV4LmRldiJdfSwic2lnbl9pbl9wcm92aWRlciI6InBhc3N3b3JkIn19.d6uLsEMeaG68m5jzageh5Wlesp-nPNARwic6QKZFoJbAk20Lr2nO7DOUQcsPlFQyFeoGTEG8mugkAfPAVkI76a7SlrgxsjesncO5DPfpKXPr3dIacmzW832ZYayMNZQFoWLmjYxI7WSEXhzxwaKOKdrjFYUQVo4urMyB1IiaNeZAUhIHhE6tTcxhbfHt7YYkMlWriKCTXfu-9L6EEkSXBOH1EaDOWLJ5bqjBdFjwgywalB8nShsmSi0F1AWoaXzXxVKb2RiPzRjByq2VbRhUXzV2EJIEG9Glxr1aQ7S8x-RlRkdgQgN1OHO3P3-SbMoz-7KZEjpc7H-FB1Dj5iXLhQ`; + const bearerToken = `Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImFlYjMxMjdiMjRjZTg2MDJjODEyNDUxZThmZTczZDU4MjkyMDg4N2MiLCJ0eXAiOiJKV1QifQ.eyJodHRwczovL2hhc3VyYS5pby9qd3QvY2xhaW1zIjp7IngtaGFzdXJhLWRlZmF1bHQtcm9sZSI6InVzZXIiLCJ4LWhhc3VyYS1hbGxvd2VkLXJvbGVzIjpbInVzZXIiXSwieC1oYXN1cmEtdXNlci1pZCI6InQ2WW0xTkRsQ0RPUFpyM0Y5Ymd1V0g0TGhTWDIifSwiaXNzIjoiaHR0cHM6Ly9zZWN1cmV0b2tlbi5nb29nbGUuY29tL3JvbWUtcHJvZC0xIiwiYXVkIjoicm9tZS1wcm9kLTEiLCJhdXRoX3RpbWUiOjE2NzY0ODIxOTYsInVzZXJfaWQiOiJ0NlltMU5EbENET1BacjNGOWJndVdINExoU1gyIiwic3ViIjoidDZZbTFORGxDRE9QWnIzRjliZ3VXSDRMaFNYMiIsImlhdCI6MTY3NjU4NzYxNSwiZXhwIjoxNjc2NTkxMjE1LCJlbWFpbCI6InBhdHJpY2tAcm9tZS5kZXYiLCJlbWFpbF92ZXJpZmllZCI6ZmFsc2UsImZpcmViYXNlIjp7ImlkZW50aXRpZXMiOnsiZW1haWwiOlsicGF0cmlja0Byb21lLmRldiJdfSwic2lnbl9pbl9wcm92aWRlciI6InBhc3N3b3JkIn19.53cLDjRthvAWUOKjSmdMII78MxD1s-mkEbG9z9KVxLB18NsKS-iZMAfIZcYb-LXZGscH8O-jR0OSyMgXitc-mv6xYV6bAGcO7gUgxwMKqnbh9-pK_uyGQ5LQ-yxMG2F397ObJu3fyB1RZ1e8LRYkIpV9LwAm4XiHQdGAfYyFDA2fSOS-9x9k6im07hAYsEeIx2hNr-8vVaEpkCENF2JFpJ9qjtfp6pRnbwQY2VA8nsJly1oOz56GLhb5f1m2Ta22eVqAye9of5EXmNSTsvDkAv7Xs3NNuNbHu8fM76tAuKPniurMNV5VwJZX7RhsjFelmoUFFTVOj6JVL-Sw-vs65A`; const { jobs } = await client.request( gql` query GET_JOBS($bodyshopids: [uuid!]!) { diff --git a/server/job/job-totals.js b/server/job/job-totals.js index 7f16ff1f3..74eead012 100644 --- a/server/job/job-totals.js +++ b/server/job/job-totals.js @@ -687,13 +687,15 @@ function CalculateTaxesTotals(job, otherTotals) { val.prt_dsmk_m && val.prt_dsmk_m !== 0 && DiscountNotAlreadyCounted(val, job.joblines) - ? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) }) - : Dinero({ - amount: Math.round(val.act_price * 100), - }) - .multiply(val.part_qty || 0) - .percentage(Math.abs(val.prt_dsmk_p || 0)) - .multiply(val.prt_dsmk_p > 0 ? 1 : -1) + ? val.prt_dsmk_m + ? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) }) + : Dinero({ + amount: Math.round(val.act_price * 100), + }) + .multiply(val.part_qty || 0) + .percentage(Math.abs(val.prt_dsmk_p || 0)) + .multiply(val.prt_dsmk_p > 0 ? 1 : -1) + : Dinero() ) .percentage( ((job.parts_tax_rates && @@ -711,8 +713,9 @@ function CalculateTaxesTotals(job, otherTotals) { ) ); } + console.log(statePartsTax.toFormat(), val.line_desc); }); - + console.log("State Parts Tax", statePartsTax.toFormat()); let ret = { subtotal: subtotal, federal_tax: subtotal @@ -738,22 +741,22 @@ function CalculateTaxesTotals(job, otherTotals) { .add( otherTotals.additional.storage.percentage((job.tax_str_rt || 0) * 100) ) - .add(additionalItemsTax), - // .add( - // otherTotals.rates.mapa.hasMapaLine === false //If parts and materials were not added as lines, we must calculate the taxes on them. - // ? otherTotals.rates.mapa.total.percentage( - // (job.tax_paint_mat_rt || 0) * 100 - // ) - // : Dinero() - // ) - // .add( - // otherTotals.rates.mash.hasMashLine === false //If parts and materials were not added as lines, we must calculate the taxes on them. - // ? otherTotals.rates.mash.total.percentage( - // (job.tax_paint_mat_rt || 0) * 100 - // ) - // : Dinero() - // ), - // .add(otherTotals.additional.pvrt), + .add(additionalItemsTax) + .add( + otherTotals.rates.mapa.hasMapaLine === false //If parts and materials were not added as lines, we must calculate the taxes on them. + ? otherTotals.rates.mapa.total.percentage( + (job.tax_paint_mat_rt || 0) * 100 + ) + : Dinero() + ) + .add( + otherTotals.rates.mash.hasMashLine === false //If parts and materials were not added as lines, we must calculate the taxes on them. + ? otherTotals.rates.mash.total.percentage( + (job.tax_paint_mat_rt || 0) * 100 + ) + : Dinero() + ), + local_tax: subtotal.percentage((job.local_tax_rate || 0) * 100), }; ret.total_repairs = ret.subtotal @@ -796,6 +799,7 @@ function DiscountNotAlreadyCounted(jobline, joblines) { (jobline.prt_dsmk_m / (jobline.act_price - jobline.prt_dsmk_m)) * 100 ) === Math.abs(jobline.prt_dsmk_p) ) { + console.log(jobline.line_desc, "Already had the discount counted."); return false; } From d88c925a682614008dcc56270184a141767feb17 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Fri, 24 Feb 2023 16:04:04 -0800 Subject: [PATCH 8/8] Environment setup and email white labeling. --- client/.env.production | 8 ++++---- client/src/landing/data.source.js | 2 +- client/src/redux/email/email.reducer.js | 2 +- client/src/utils/TemplateConstants.js | 2 +- server/email/sendemail.js | 14 +++++++------- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/client/.env.production b/client/.env.production index 81d504796..bfb387f8c 100644 --- a/client/.env.production +++ b/client/.env.production @@ -1,5 +1,5 @@ -REACT_APP_GRAPHQL_ENDPOINT=https://db.test.bodyshop.app/v1/graphql -REACT_APP_GRAPHQL_ENDPOINT_WS=wss://db.test.bodyshop.app/v1/graphql +REACT_APP_GRAPHQL_ENDPOINT=https://db.romeonline.io/v1/graphql +REACT_APP_GRAPHQL_ENDPOINT_WS=wss://db.romeonline.io/v1/graphql REACT_APP_GA_CODE=231103507 REACT_APP_FIREBASE_CONFIG={ "apiKey": "AIzaSyAuLQR9SV5LsVxjU8wh9hvFLdhcAHU6cxE", "authDomain": "rome-prod-1.firebaseapp.com", "projectId": "rome-prod-1", "storageBucket": "rome-prod-1.appspot.com", "messagingSenderId": "147786367145", "appId": "1:147786367145:web:9d4cba68071c3f29a8a9b8", "measurementId": "G-G8Z9DRHTZS"} REACT_APP_CLOUDINARY_ENDPOINT_API=https://api.cloudinary.com/v1_1/bodyshop @@ -8,6 +8,6 @@ REACT_APP_CLOUDINARY_API_KEY=473322739956866 REACT_APP_CLOUDINARY_THUMB_TRANSFORMATIONS=c_fill,h_250,w_250 REACT_APP_FIREBASE_PUBLIC_VAPID_KEY='BP1B7ZTYpn-KMt6nOxlld6aS8Skt3Q7ZLEqP0hAvGHxG4UojPYiXZ6kPlzZkUC5jH-EcWXomTLtmadAIxurfcHo' REACT_APP_STRIPE_PUBLIC_KEY=pk_test_51GqB4TJl3nQjrZ0wCQWAxAhlNF8jKe0tipIa6ExBaxwJGitwvFsIZUEua4dUzaMIAuXp4qwYHXx7lgjyQSwP0Pe900vzm38C7g -REACT_APP_AXIOS_BASE_API_URL=https://api.imex.online/ -REACT_APP_REPORTS_SERVER_URL=https://reports.imex.online +REACT_APP_AXIOS_BASE_API_URL=https://api.romeonline.io/ +REACT_APP_REPORTS_SERVER_URL=https://reports.romeonline.io REACT_APP_SPLIT_API=et9pjkik6bn67he5evpmpr1agoo7gactphgk \ No newline at end of file diff --git a/client/src/landing/data.source.js b/client/src/landing/data.source.js index 257d14c46..a50c1b9a8 100644 --- a/client/src/landing/data.source.js +++ b/client/src/landing/data.source.js @@ -1064,7 +1064,7 @@ export const Footer10DataSource = { className: "copyright", children: ( - ©2023 ImEX Systems + ©2023 Rome Technologies ), }, diff --git a/client/src/redux/email/email.reducer.js b/client/src/redux/email/email.reducer.js index df0a1d14e..5c114bc62 100644 --- a/client/src/redux/email/email.reducer.js +++ b/client/src/redux/email/email.reducer.js @@ -3,7 +3,7 @@ import EmailActionTypes from "./email.types"; const INITIAL_STATE = { emailConfig: { messageOptions: { - from: { name: "ShopName", address: "noreply@bodyshop.app" }, + from: { name: "ShopName", address: "noreply@romeonline.io" }, to: null, replyTo: null, }, diff --git a/client/src/utils/TemplateConstants.js b/client/src/utils/TemplateConstants.js index ca5ebf39b..aab4b9069 100644 --- a/client/src/utils/TemplateConstants.js +++ b/client/src/utils/TemplateConstants.js @@ -2,7 +2,7 @@ import i18n from "i18next"; //import { store } from "../redux/store"; export const EmailSettings = { fromNameDefault: "Rome Online", - fromAddress: "noreply@imex.online", + fromAddress: "noreply@rome.online", }; export const TemplateList = (type, context) => { diff --git a/server/email/sendemail.js b/server/email/sendemail.js index ceabb9532..0a847df77 100644 --- a/server/email/sendemail.js +++ b/server/email/sendemail.js @@ -15,7 +15,7 @@ const queries = require("../graphql-client/queries"); const ses = new aws.SES({ apiVersion: "latest", - region: "ca-central-1", + region: "us-east-2", }); let transporter = nodemailer.createTransport({ @@ -27,7 +27,7 @@ exports.sendServerEmail = async function ({ subject, text }) { try { transporter.sendMail( { - from: `ImEX Online API - ${process.env.NODE_ENV} `, + from: `Rome Online API - ${process.env.NODE_ENV} `, to: ["patrick@imexsystems.ca"], subject: subject, text: text, @@ -55,7 +55,7 @@ exports.sendTaskEmail = async function ({ to, subject, text, attachments }) { try { transporter.sendMail( { - from: `ImEX Online `, + from: `Rome Online `, to: to, subject: subject, text: text, @@ -227,7 +227,7 @@ exports.emailBounce = async function (req, res, next) { } }); messageId = message.mail.messageId; - if (replyTo === "noreply@imex.online") { + if (replyTo === "noreply@romeonline.io") { res.sendStatus(200); return; } @@ -239,10 +239,10 @@ exports.emailBounce = async function (req, res, next) { }); transporter.sendMail( { - from: `ImEX Online `, + from: `Rome Online `, to: replyTo, - subject: `ImEX Online Bounced Email - RE: ${subject}`, - text: `ImEX Online has tried to deliver an email with the subject: ${subject} to the intended recipients but encountered an error. + subject: `Rome Online Bounced Email - RE: ${subject}`, + text: `Rome Online has tried to deliver an email with the subject: ${subject} to the intended recipients but encountered an error. ${body.bounce?.bouncedRecipients.map( (r) =>