-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #358 from USEPA/develop
Sync staging with develop
- Loading branch information
Showing
9 changed files
with
87 additions
and
60 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, "[email protected]") | ||
.then((bapRes) => { | ||
if (!Array.isArray(bapRes)) { | ||
|
@@ -24,50 +32,51 @@ 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 | ||
return res.json({ status: false }); | ||
}); | ||
}); | ||
|
||
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 | ||
return res.json({ status: false }); | ||
}); | ||
}); | ||
|
||
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.