From 8a4dc88283a0b5b655d165c5fdf5f747f8c6fc9d Mon Sep 17 00:00:00 2001 From: Courtney Myers Date: Tue, 12 Sep 2023 13:24:09 -0400 Subject: [PATCH 1/5] Roll back @formio/uswds package update to v2.4.8 as v2.5.0 caused the tooltips to not display properly --- app/client/package-lock.json | 14 +++++++------- app/client/package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/client/package-lock.json b/app/client/package-lock.json index 189915a0..c137139b 100644 --- a/app/client/package-lock.json +++ b/app/client/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@formio/premium": "1.18.4", "@formio/react": "5.2.3", - "@formio/uswds": "2.5.0", + "@formio/uswds": "2.4.8", "@headlessui/react": "1.7.17", "@heroicons/react": "2.0.18", "@radix-ui/react-tooltip": "1.0.6", @@ -2163,9 +2163,9 @@ "integrity": "sha512-RwMEVXkyz+B6RivflrrKIqvvnGR/eZDLQs74u67StcrzO6n3/5D2J8XqTQRSUzQzr5QV6Wq0eZ51z/+mGm6THw==" }, "node_modules/@formio/uswds": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@formio/uswds/-/uswds-2.5.0.tgz", - "integrity": "sha512-txxuS0ddD/M+/BWDT9tUEHKoJQ5y3GaQaKt/i4vBgpDcO/vKR1USEcnrUrPUSSbTv1ffH4PSHmc9vCB0YTAsvw==" + "version": "2.4.8", + "resolved": "https://registry.npmjs.org/@formio/uswds/-/uswds-2.4.8.tgz", + "integrity": "sha512-sBEwGxbcs52w9yZQV2Bg8Z89e5aV4fqH1b+UxeM31KduXlqLuG7KHMbd6ZA8ifyUiR8bGwBoZXGHSlXhTIlgMQ==" }, "node_modules/@formio/vanilla-text-mask": { "version": "5.1.1", @@ -25035,9 +25035,9 @@ "integrity": "sha512-RwMEVXkyz+B6RivflrrKIqvvnGR/eZDLQs74u67StcrzO6n3/5D2J8XqTQRSUzQzr5QV6Wq0eZ51z/+mGm6THw==" }, "@formio/uswds": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@formio/uswds/-/uswds-2.5.0.tgz", - "integrity": "sha512-txxuS0ddD/M+/BWDT9tUEHKoJQ5y3GaQaKt/i4vBgpDcO/vKR1USEcnrUrPUSSbTv1ffH4PSHmc9vCB0YTAsvw==" + "version": "2.4.8", + "resolved": "https://registry.npmjs.org/@formio/uswds/-/uswds-2.4.8.tgz", + "integrity": "sha512-sBEwGxbcs52w9yZQV2Bg8Z89e5aV4fqH1b+UxeM31KduXlqLuG7KHMbd6ZA8ifyUiR8bGwBoZXGHSlXhTIlgMQ==" }, "@formio/vanilla-text-mask": { "version": "5.1.1", diff --git a/app/client/package.json b/app/client/package.json index bf1e41cf..6c5a9efc 100644 --- a/app/client/package.json +++ b/app/client/package.json @@ -19,7 +19,7 @@ "dependencies": { "@formio/premium": "1.18.4", "@formio/react": "5.2.3", - "@formio/uswds": "2.5.0", + "@formio/uswds": "2.4.8", "@headlessui/react": "1.7.17", "@heroicons/react": "2.0.18", "@radix-ui/react-tooltip": "1.0.6", From 2c8c82396eb9e3e9ab49ccede57d456adb7b6071 Mon Sep 17 00:00:00 2001 From: Courtney Myers Date: Tue, 12 Sep 2023 14:19:27 -0400 Subject: [PATCH 2/5] Inject SAM.gov POC emails into a brand new 2023 FRF submission --- app/client/src/routes/frfNew.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/client/src/routes/frfNew.tsx b/app/client/src/routes/frfNew.tsx index 48032f8d..1d46993a 100644 --- a/app/client/src/routes/frfNew.tsx +++ b/app/client/src/routes/frfNew.tsx @@ -67,6 +67,10 @@ function createInitialSubmissionData(options: { _user_title: title, _user_name: name, _bap_entity_combo_key: comboKey, + _bap_elec_bus_poc_email: entity.ELEC_BUS_POC_EMAIL__c, + _bap_alt_elec_bus_poc_email: entity.ALT_ELEC_BUS_POC_EMAIL__c, + _bap_govt_bus_poc_email: entity.GOVT_BUS_POC_EMAIL__c, + _bap_alt_govt_bus_poc_email: entity.ALT_GOVT_BUS_POC_EMAIL__c, _bap_applicant_email: email, _bap_applicant_title: title, _bap_applicant_name: name, From 5fbba39e9f831eb4c8eb8496a907566979c020c3 Mon Sep 17 00:00:00 2001 From: Courtney Myers Date: Tue, 12 Sep 2023 16:38:31 -0400 Subject: [PATCH 3/5] Update status API endpoints to reflect formio API endpoints organized by year and BAP endpoint naming change, and add new 2023 FRF status endpoint --- app/server/app/routes/status.js | 47 ++++++++++++++++++++------------- docs/csb-openapi.json | 28 ++++++++++++++------ 2 files changed, 48 insertions(+), 27 deletions(-) diff --git a/app/server/app/routes/status.js b/app/server/app/routes/status.js index cb1f0ffd..966e32af 100644 --- a/app/server/app/routes/status.js +++ b/app/server/app/routes/status.js @@ -3,13 +3,21 @@ const express = require("express"); const { axiosFormio, formUrl } = require("../config/formio"); const { getSamEntities } = require("../utilities/bap"); +/** + * Verify that schema has type of form and a title exists + * (confirming Formio returned a valid schema). + */ +function verifySchema(schema) { + return schema.type === "form" && !!schema.title; +} + const router = express.Router(); router.get("/app", (req, res) => { return res.json({ status: true }); }); -router.get("/bap-sam-data", (req, res) => { +router.get("/bap/sam", (req, res) => { getSamEntities(req, "bap.sam.data.status@erg.com") .then((bapRes) => { if (!Array.isArray(bapRes)) { @@ -24,16 +32,12 @@ router.get("/bap-sam-data", (req, res) => { }); }); -router.get("/formio-application-schema", (req, res) => { +router.get("/formio/2022/frf", (req, res) => { axiosFormio(req) .get(formUrl["2022"].frf) .then((axiosRes) => axiosRes.data) .then((schema) => { - /** - * Verify that schema has type of form and a title exists - * (confirming Formio returned a valid schema). - */ - return res.json({ status: schema.type === "form" && !!schema.title }); + return res.json({ status: verifySchema(schema) }); }) .catch((error) => { // NOTE: error is logged in axiosFormio response interceptor @@ -41,16 +45,12 @@ router.get("/formio-application-schema", (req, res) => { }); }); -router.get("/formio-payment-request-schema", (req, res) => { +router.get("/formio/2022/prf", (req, res) => { axiosFormio(req) .get(formUrl["2022"].prf) .then((axiosRes) => axiosRes.data) .then((schema) => { - /** - * Verify that schema has type of form and a title exists - * (confirming Formio returned a valid schema). - */ - return res.json({ status: schema.type === "form" && !!schema.title }); + return res.json({ status: verifySchema(schema) }); }) .catch((error) => { // NOTE: error is logged in axiosFormio response interceptor @@ -58,16 +58,25 @@ router.get("/formio-payment-request-schema", (req, res) => { }); }); -router.get("/formio-close-out-schema", (req, res) => { +router.get("/formio/2022/crf", (req, res) => { axiosFormio(req) .get(formUrl["2022"].crf) .then((axiosRes) => axiosRes.data) .then((schema) => { - /** - * Verify that schema has type of form and a title exists - * (confirming Formio returned a valid schema). - */ - return res.json({ status: schema.type === "form" && !!schema.title }); + return res.json({ status: verifySchema(schema) }); + }) + .catch((error) => { + // NOTE: error is logged in axiosFormio response interceptor + return res.json({ status: false }); + }); +}); + +router.get("/formio/2023/frf", (req, res) => { + axiosFormio(req) + .get(formUrl["2023"].frf) + .then((axiosRes) => axiosRes.data) + .then((schema) => { + return res.json({ status: verifySchema(schema) }); }) .catch((error) => { // NOTE: error is logged in axiosFormio response interceptor diff --git a/docs/csb-openapi.json b/docs/csb-openapi.json index 67713a42..5fb5397e 100644 --- a/docs/csb-openapi.json +++ b/docs/csb-openapi.json @@ -118,9 +118,9 @@ "parameters": [{ "$ref": "#/components/parameters/scan" }] } }, - "/status/bap-sam-data": { + "/status/bap/sam": { "get": { - "summary": "/status/bap-sam-data", + "summary": "/status/bap/sam", "responses": { "200": { "description": "OK" @@ -130,9 +130,9 @@ "parameters": [{ "$ref": "#/components/parameters/scan" }] } }, - "/status/formio-application-schema": { + "/status/formio/2022/frf": { "get": { - "summary": "/status/formio-application-schema", + "summary": "/status/formio/2022/frf", "responses": { "200": { "description": "OK" @@ -142,9 +142,9 @@ "parameters": [{ "$ref": "#/components/parameters/scan" }] } }, - "/status/formio-payment-request-schema": { + "/status/formio/2022/prf": { "get": { - "summary": "/status/formio-payment-request-schema", + "summary": "/status/formio/2022/prf", "responses": { "200": { "description": "OK" @@ -154,9 +154,21 @@ "parameters": [{ "$ref": "#/components/parameters/scan" }] } }, - "/status/formio-close-out-schema": { + "/status/formio/2022/crf": { "get": { - "summary": "/status/formio-close-out-schema", + "summary": "/status/formio/2022/crf", + "responses": { + "200": { + "description": "OK" + } + }, + "tags": [], + "parameters": [{ "$ref": "#/components/parameters/scan" }] + } + }, + "/status/formio/2023/frf": { + "get": { + "summary": "/status/formio/2023/frf", "responses": { "200": { "description": "OK" From ce635b9ebba7ba3f68491eeacdb8b212d9023ed5 Mon Sep 17 00:00:00 2001 From: Courtney Myers Date: Tue, 12 Sep 2023 16:42:46 -0400 Subject: [PATCH 4/5] Prefix status api routes with /api --- app/server/app/routes/index.js | 2 +- docs/csb-openapi.json | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/server/app/routes/index.js b/app/server/app/routes/index.js index baf90383..19b932c9 100644 --- a/app/server/app/routes/index.js +++ b/app/server/app/routes/index.js @@ -11,6 +11,6 @@ router.use("/api/bap", require("./bap")); router.use("/api/formio/2022", require("./formio2022")); router.use("/api/formio/2023", require("./formio2023")); router.use("/api/help", require("./help")); -router.use("/status", require("./status")); +router.use("/api/status", require("./status")); module.exports = router; diff --git a/docs/csb-openapi.json b/docs/csb-openapi.json index 5fb5397e..645ee64a 100644 --- a/docs/csb-openapi.json +++ b/docs/csb-openapi.json @@ -106,9 +106,9 @@ "parameters": [{ "$ref": "#/components/parameters/scan" }] } }, - "/status/app": { + "/api/status/app": { "get": { - "summary": "/status/app", + "summary": "/api/status/app", "responses": { "200": { "description": "OK" @@ -118,9 +118,9 @@ "parameters": [{ "$ref": "#/components/parameters/scan" }] } }, - "/status/bap/sam": { + "/api/status/bap/sam": { "get": { - "summary": "/status/bap/sam", + "summary": "/api/status/bap/sam", "responses": { "200": { "description": "OK" @@ -130,9 +130,9 @@ "parameters": [{ "$ref": "#/components/parameters/scan" }] } }, - "/status/formio/2022/frf": { + "/api/status/formio/2022/frf": { "get": { - "summary": "/status/formio/2022/frf", + "summary": "/api/status/formio/2022/frf", "responses": { "200": { "description": "OK" @@ -142,9 +142,9 @@ "parameters": [{ "$ref": "#/components/parameters/scan" }] } }, - "/status/formio/2022/prf": { + "/api/status/formio/2022/prf": { "get": { - "summary": "/status/formio/2022/prf", + "summary": "/api/status/formio/2022/prf", "responses": { "200": { "description": "OK" @@ -154,9 +154,9 @@ "parameters": [{ "$ref": "#/components/parameters/scan" }] } }, - "/status/formio/2022/crf": { + "/api/status/formio/2022/crf": { "get": { - "summary": "/status/formio/2022/crf", + "summary": "/api/status/formio/2022/crf", "responses": { "200": { "description": "OK" @@ -166,9 +166,9 @@ "parameters": [{ "$ref": "#/components/parameters/scan" }] } }, - "/status/formio/2023/frf": { + "/api/status/formio/2023/frf": { "get": { - "summary": "/status/formio/2023/frf", + "summary": "/api/status/formio/2023/frf", "responses": { "200": { "description": "OK" From 8e794d7b1899c6dabbcb938a69a54775733c467e Mon Sep 17 00:00:00 2001 From: Courtney Myers Date: Wed, 13 Sep 2023 09:40:39 -0400 Subject: [PATCH 5/5] Update CRF submissions Salesforce 'Record_Type_Name__c' value for CRF submissions to be 'CSB Close Out Request' to match value being returned from the BAP --- app/client/src/utilities.tsx | 4 ++-- app/server/app/routes/help.js | 4 ++-- app/server/app/utilities/bap.js | 38 +++++++++++++++++---------------- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/app/client/src/utilities.tsx b/app/client/src/utilities.tsx index 20ebe997..e4b5aa83 100644 --- a/app/client/src/utilities.tsx +++ b/app/client/src/utilities.tsx @@ -78,7 +78,7 @@ type BapFormSubmission = { Record_Type_Name__c: | "CSB Funding Request" | "CSB Payment Request" - | "CSB Closeout Request"; + | "CSB Close Out Request"; Parent_CSB_Rebate__r: { CSB_Funding_Request_Status__c: string; CSB_Payment_Request_Status__c: string; @@ -356,7 +356,7 @@ export function useSubmissionsQueries(rebateYear: RebateYear) { ? "frfs" : submission.Record_Type_Name__c === "CSB Payment Request" ? "prfs" - : submission.Record_Type_Name__c === "CSB Closeout Request" + : submission.Record_Type_Name__c === "CSB Close Out Request" ? "crfs" : null; diff --git a/app/server/app/routes/help.js b/app/server/app/routes/help.js index f23b2f00..9ac26e78 100644 --- a/app/server/app/routes/help.js +++ b/app/server/app/routes/help.js @@ -113,7 +113,7 @@ router.get("/formio/:rebateYear/:formType/:id", (req, res) => { ? Parent_CSB_Rebate__r?.CSB_Funding_Request_Status__c : Record_Type_Name__c === "CSB Payment Request" ? Parent_CSB_Rebate__r?.CSB_Payment_Request_Status__c - : Record_Type_Name__c === "CSB Closeout Request" + : Record_Type_Name__c === "CSB Close Out Request" ? Parent_CSB_Rebate__r?.CSB_Closeout_Request_Status__c : "", }, @@ -125,7 +125,7 @@ router.get("/formio/:rebateYear/:formType/:id", (req, res) => { const errorMessage = `Error getting ${rebateYear} ${formName} submission '${CSB_Form_ID__c}'.`; return res.status(errorStatus).json({ message: errorMessage }); }); - } + }, ); }); diff --git a/app/server/app/utilities/bap.js b/app/server/app/utilities/bap.js index a53b9573..62ccd8a1 100644 --- a/app/server/app/utilities/bap.js +++ b/app/server/app/utilities/bap.js @@ -305,7 +305,7 @@ async function queryForSamEntities(req, email) { PHYSICAL_ADDRESS_PROVINCE_OR_STATE__c: 1, PHYSICAL_ADDRESS_ZIPPOSTAL_CODE__c: 1, PHYSICAL_ADDRESS_ZIP_CODE_4__c: 1, - } + }, ) .execute(async (err, records) => ((await err) ? err : records)); } @@ -360,7 +360,7 @@ async function queryForBapFormSubmissionData(req, formType, rebateId, mongoId) { { // "*": 1, Id: 1, // Salesforce record ID - } + }, ) .limit(1) .execute(async (err, records) => ((await err) ? err : records)); @@ -374,7 +374,9 @@ async function queryForBapFormSubmissionData(req, formType, rebateId, mongoId) { // CSB_Review_Item_ID__c, // Parent_Rebate_ID__c, // Record_Type_Name__c, - // Parent_CSB_Rebate__r.CSB_Funding_Request_Status__c + // Parent_CSB_Rebate__r.CSB_Funding_Request_Status__c, + // Parent_CSB_Rebate__r.CSB_Payment_Request_Status__c, + // Parent_CSB_Rebate__r.CSB_Closeout_Request_Status__c // FROM // ${BAP_FORMS_TABLE} // WHERE @@ -398,11 +400,11 @@ async function queryForBapFormSubmissionData(req, formType, rebateId, mongoId) { CSB_Modified_Full_String__c: 1, // ISO 8601 date time string CSB_Review_Item_ID__c: 1, // CSB Rebate ID with form/version ID (9 digits) Parent_Rebate_ID__c: 1, // CSB Rebate ID (6 digits) - Record_Type_Name__c: 1, // 'CSB Funding Request' | 'CSB Payment Request' | 'CSB Closeout Request' + Record_Type_Name__c: 1, // 'CSB Funding Request' | 'CSB Payment Request' | 'CSB Close Out Request' "Parent_CSB_Rebate__r.CSB_Funding_Request_Status__c": 1, "Parent_CSB_Rebate__r.CSB_Payment_Request_Status__c": 1, "Parent_CSB_Rebate__r.CSB_Closeout_Request_Status__c": 1, - } + }, ) .execute(async (err, records) => ((await err) ? err : records)); @@ -446,7 +448,7 @@ async function queryForBapFormSubmissionsStatuses(req, comboKeys) { { // "*": 1, Parent_Rebate_ID__c: 1, // CSB Rebate ID (6 digits) - } + }, ) .sort({ CreatedDate: -1 }) .execute(async (err, records) => ((await err) ? err : records)); @@ -491,11 +493,11 @@ async function queryForBapFormSubmissionsStatuses(req, comboKeys) { CSB_Modified_Full_String__c: 1, // ISO 8601 date time string CSB_Review_Item_ID__c: 1, // CSB Rebate ID with form/version ID (9 digits) Parent_Rebate_ID__c: 1, // CSB Rebate ID (6 digits) - Record_Type_Name__c: 1, // 'CSB Funding Request' | 'CSB Payment Request' | 'CSB Closeout Request' + Record_Type_Name__c: 1, // 'CSB Funding Request' | 'CSB Payment Request' | 'CSB Close Out Request' "Parent_CSB_Rebate__r.CSB_Funding_Request_Status__c": 1, "Parent_CSB_Rebate__r.CSB_Payment_Request_Status__c": 1, "Parent_CSB_Rebate__r.CSB_Closeout_Request_Status__c": 1, - } + }, ) .sort({ CreatedDate: -1 }) .execute(async (err, records) => ((await err) ? err : records)); @@ -539,7 +541,7 @@ async function queryBapForPRFData(req, frfReviewItemId) { { // "*": 1, Id: 1, // Salesforce record ID - } + }, ) .limit(1) .execute(async (err, records) => ((await err) ? err : records)); @@ -598,7 +600,7 @@ async function queryBapForPRFData(req, frfReviewItemId) { School_District_Prioritized__c: 1, Total_Rebate_Funds_Requested__c: 1, Total_Infrastructure_Funds__c: 1, - } + }, ) .execute(async (err, records) => ((await err) ? err : records)); @@ -623,7 +625,7 @@ async function queryBapForPRFData(req, frfReviewItemId) { { // "*": 1, Id: 1, // Salesforce record ID - } + }, ) .limit(1) .execute(async (err, records) => ((await err) ? err : records)); @@ -660,7 +662,7 @@ async function queryBapForPRFData(req, frfReviewItemId) { CSB_Fuel_Type__c: 1, CSB_Replacement_Fuel_Type__c: 1, CSB_Funds_Requested__c: 1, - } + }, ) .execute(async (err, records) => ((await err) ? err : records)); @@ -705,7 +707,7 @@ async function queryBapForCRFData(req, frfReviewItemId, prfReviewItemId) { { // "*": 1, Id: 1, // Salesforce record ID - } + }, ) .limit(1) .execute(async (err, records) => ((await err) ? err : records)); @@ -752,7 +754,7 @@ async function queryBapForCRFData(req, frfReviewItemId, prfReviewItemId) { Fleet_Contact_Email__c: 1, "School_District_Contact__r.FirstName": 1, "School_District_Contact__r.LastName": 1, - } + }, ) .execute(async (err, records) => ((await err) ? err : records)); @@ -775,7 +777,7 @@ async function queryBapForCRFData(req, frfReviewItemId, prfReviewItemId) { { // "*": 1, Id: 1, // Salesforce record ID - } + }, ) .limit(1) .execute(async (err, records) => ((await err) ? err : records)); @@ -854,7 +856,7 @@ async function queryBapForCRFData(req, frfReviewItemId, prfReviewItemId) { Total_Level_2_Charger_Costs__c: 1, Total_DC_Fast_Charger_Costs__c: 1, Total_Other_Infrastructure_Costs__c: 1, - } + }, ) .execute(async (err, records) => ((await err) ? err : records)); @@ -879,7 +881,7 @@ async function queryBapForCRFData(req, frfReviewItemId, prfReviewItemId) { { // "*": 1, Id: 1, // Salesforce record ID - } + }, ) .limit(1) .execute(async (err, records) => ((await err) ? err : records)); @@ -936,7 +938,7 @@ async function queryBapForCRFData(req, frfReviewItemId, prfReviewItemId) { New_Bus_GVWR__c: 1, New_Bus_Rebate_Amount__c: 1, New_Bus_Purchase_Price__c: 1, - } + }, ) .execute(async (err, records) => ((await err) ? err : records));