From 0688f3fe1ad71431511171f36322e9a7e4efbd5d Mon Sep 17 00:00:00 2001 From: Courtney Myers Date: Thu, 5 Sep 2024 13:57:17 -0400 Subject: [PATCH 1/4] Add new NCES API routes and deprecate old NCES API route in OpenAPI docs --- docs/csb-openapi.json | 61 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/docs/csb-openapi.json b/docs/csb-openapi.json index f0e591e7..f8d1abaa 100644 --- a/docs/csb-openapi.json +++ b/docs/csb-openapi.json @@ -2,7 +2,7 @@ "openapi": "3.0.0", "info": { "title": "epa-csb-server", - "version": "5.0.1", + "version": "6.0.0", "license": { "name": "CC0-1.0" }, @@ -281,6 +281,7 @@ }, "/api/formio/nces/{searchText}": { "get": { + "deprecated": true, "summary": "Search the NCES data with the provided NCES ID and return a match.", "parameters": [ { @@ -602,6 +603,35 @@ } } }, + "/api/formio/2023/nces/{searchText}": { + "get": { + "summary": "search 2023 NCES data with the provided NCES ID and return a match.", + "parameters": [ + { + "in": "path", + "name": "searchText", + "description": "The NCES ID to search for.", + "required": true, + "example": "A999999", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "An object containing the matched NCES data.", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, "/api/formio/2023/s3/{formType}/{mongoId}/{comboKey}/storage/s3": { "get": { "summary": "Download Formio S3 file metadata for a 2023 submission.", @@ -892,6 +922,35 @@ } } }, + "/api/formio/2024/nces/{searchText}": { + "get": { + "summary": "search 2024 NCES data with the provided NCES ID and return a match.", + "parameters": [ + { + "in": "path", + "name": "searchText", + "description": "The NCES ID to search for.", + "required": true, + "example": "A999999", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "An object containing the matched NCES data.", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, "/api/help/formio/submission/{rebateYear}/{formType}/{id}": { "get": { "summary": "Get an existing form's submission data from Formio.", From ce3e5ab1fde46632a7ac2056594cb77bf43b9908 Mon Sep 17 00:00:00 2001 From: Courtney Myers Date: Thu, 5 Sep 2024 14:20:20 -0400 Subject: [PATCH 2/4] Add all new 2024 FRF and Change Request Form API routes to the OpenAPI docs --- docs/csb-openapi.json | 209 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 209 insertions(+) diff --git a/docs/csb-openapi.json b/docs/csb-openapi.json index f8d1abaa..3d541ba6 100644 --- a/docs/csb-openapi.json +++ b/docs/csb-openapi.json @@ -951,6 +951,204 @@ } } }, + "/api/formio/2024/s3/{formType}/{mongoId}/{comboKey}/storage/s3": { + "get": { + "summary": "Download Formio S3 file metadata for a 2024 submission.", + "parameters": [ + { + "$ref": "#/components/parameters/formType" + }, + { + "$ref": "#/components/parameters/mongoId" + }, + { + "$ref": "#/components/parameters/comboKey" + } + ], + "responses": { + "200": { + "description": "OK" + } + } + }, + "post": { + "summary": "Upload Formio S3 file metadata for a 2024 submission.", + "parameters": [ + { + "$ref": "#/components/parameters/formType" + }, + { + "$ref": "#/components/parameters/mongoId" + }, + { + "$ref": "#/components/parameters/comboKey" + } + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/formio/2024/frf-submissions": { + "get": { + "summary": "Get user's 2024 FRF submissions from Formio.", + "parameters": [], + "responses": { + "200": { + "description": "An array of 2024 FRF submissions.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "object" + } + } + } + } + } + } + } + }, + "/api/formio/2024/frf-submission": { + "post": { + "summary": "Post a new 2024 FRF submission to Formio.", + "parameters": [], + "responses": { + "200": { + "description": "The newly created 2024 FRF submission.", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/formio/2024/frf-submission/{mongoId}": { + "get": { + "summary": "Get an existing 2024 FRF's schema and submission data from Formio.", + "parameters": [ + { + "$ref": "#/components/parameters/mongoId" + } + ], + "responses": { + "200": { + "description": "The 2024 FRF schema, form submission, and user access status.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FormioSchemaAndSubmission" + } + } + } + } + } + }, + "post": { + "summary": "Post an update to an existing draft 2024 FRF submission to Formio.", + "parameters": [ + { + "$ref": "#/components/parameters/mongoId" + } + ], + "responses": { + "200": { + "description": "The updated 2024 FRF submission.", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/formio/2024/changes": { + "get": { + "summary": "Get user's 2024 Change Request form submissions from Formio.", + "parameters": [], + "responses": { + "200": { + "description": "An array of 2024 Change Request form submissions.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "object" + } + } + } + } + } + } + } + }, + "/api/formio/2024/change": { + "get": { + "summary": "Get the 2024 Change Request form's schema from Formio.", + "parameters": [], + "responses": { + "200": { + "description": "The 2024 Change Request form's schema.", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + }, + "post": { + "summary": "Post a new 2024 Change Request form submission to Formio.", + "parameters": [], + "responses": { + "200": { + "description": "The newly created 2024 Change Request form submission.", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/formio/2024/change/{mongoId}": { + "get": { + "summary": "Get an existing 2024 Change Request form's schema and submission data from Formio.", + "parameters": [ + { + "$ref": "#/components/parameters/mongoId" + } + ], + "responses": { + "200": { + "description": "The 2024 Change Request form's schema, form submission, and user access status.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FormioSchemaAndSubmission" + } + } + } + } + } + } + }, "/api/help/formio/submission/{rebateYear}/{formType}/{id}": { "get": { "summary": "Get an existing form's submission data from Formio.", @@ -1146,6 +1344,17 @@ } } } + }, + "/api/status/formio/2024/frf": { + "get": { + "summary": "CSB Formio 2024 FRF schema check.", + "parameters": [], + "responses": { + "200": { + "description": "OK" + } + } + } } }, "components": { From 9d21689103982b32e06abbc269ebffc534e34ca6 Mon Sep 17 00:00:00 2001 From: Courtney Myers Date: Thu, 5 Sep 2024 14:22:40 -0400 Subject: [PATCH 3/4] Add 2024 FRF status API endpoint --- app/server/app/routes/status.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/server/app/routes/status.js b/app/server/app/routes/status.js index cc1e7004..6faa3db3 100644 --- a/app/server/app/routes/status.js +++ b/app/server/app/routes/status.js @@ -110,4 +110,17 @@ router.get("/formio/2023/prf", (req, res) => { // }); // }); +router.get("/formio/2024/frf", (req, res) => { + axiosFormio(req) + .get(formUrl["2024"].frf) + .then((axiosRes) => axiosRes.data) + .then((schema) => { + return res.json({ status: verifySchema(schema) }); + }) + .catch((_error) => { + // NOTE: error is logged in axiosFormio response interceptor + return res.json({ status: false }); + }); +}); + module.exports = router; From 745b8282f07a4a2a9cb9232a6e9fe18e93c7dc91 Mon Sep 17 00:00:00 2001 From: Courtney Myers Date: Thu, 5 Sep 2024 14:26:58 -0400 Subject: [PATCH 4/4] Add API status routes for 2023 and 2024 Change Request forms and add routes to OpenAPI docs --- app/server/app/routes/status.js | 52 +++++++++++++++++++++++++++++++++ docs/csb-openapi.json | 22 ++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/app/server/app/routes/status.js b/app/server/app/routes/status.js index 6faa3db3..44d888a9 100644 --- a/app/server/app/routes/status.js +++ b/app/server/app/routes/status.js @@ -110,6 +110,19 @@ router.get("/formio/2023/prf", (req, res) => { // }); // }); +router.get("/formio/2023/change", (req, res) => { + axiosFormio(req) + .get(formUrl["2023"].change) + .then((axiosRes) => axiosRes.data) + .then((schema) => { + return res.json({ status: verifySchema(schema) }); + }) + .catch((_error) => { + // NOTE: error is logged in axiosFormio response interceptor + return res.json({ status: false }); + }); +}); + router.get("/formio/2024/frf", (req, res) => { axiosFormio(req) .get(formUrl["2024"].frf) @@ -123,4 +136,43 @@ router.get("/formio/2024/frf", (req, res) => { }); }); +// router.get("/formio/2024/prf", (req, res) => { +// axiosFormio(req) +// .get(formUrl["2024"].prf) +// .then((axiosRes) => axiosRes.data) +// .then((schema) => { +// return res.json({ status: verifySchema(schema) }); +// }) +// .catch((_error) => { +// // NOTE: error is logged in axiosFormio response interceptor +// return res.json({ status: false }); +// }); +// }); + +// router.get("/formio/2024/crf", (req, res) => { +// axiosFormio(req) +// .get(formUrl["2024"].crf) +// .then((axiosRes) => axiosRes.data) +// .then((schema) => { +// return res.json({ status: verifySchema(schema) }); +// }) +// .catch((_error) => { +// // NOTE: error is logged in axiosFormio response interceptor +// return res.json({ status: false }); +// }); +// }); + +router.get("/formio/2024/change", (req, res) => { + axiosFormio(req) + .get(formUrl["2024"].change) + .then((axiosRes) => axiosRes.data) + .then((schema) => { + return res.json({ status: verifySchema(schema) }); + }) + .catch((_error) => { + // NOTE: error is logged in axiosFormio response interceptor + return res.json({ status: false }); + }); +}); + module.exports = router; diff --git a/docs/csb-openapi.json b/docs/csb-openapi.json index 3d541ba6..c54bcd24 100644 --- a/docs/csb-openapi.json +++ b/docs/csb-openapi.json @@ -1345,6 +1345,17 @@ } } }, + "/api/status/formio/2023/change": { + "get": { + "summary": "CSB Formio 2023 Change Request form schema check.", + "parameters": [], + "responses": { + "200": { + "description": "OK" + } + } + } + }, "/api/status/formio/2024/frf": { "get": { "summary": "CSB Formio 2024 FRF schema check.", @@ -1355,6 +1366,17 @@ } } } + }, + "/api/status/formio/2024/change": { + "get": { + "summary": "CSB Formio 2024 Change Request form schema check.", + "parameters": [], + "responses": { + "200": { + "description": "OK" + } + } + } } }, "components": {