From c2bf6841e1f08c5c52eba79c5a52a7b2dffa1be4 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 14 Feb 2023 15:05:09 -0800 Subject: [PATCH 1/3] 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 2/3] 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 3/3] 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; }