TASK22211: normalize hash and metadata endpoint contracts
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { respondError, respondSuccess } from "../middleware/apiResponse";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
@@ -5,16 +7,32 @@ const WEBAPI_URL =
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var whichForm = req.query.whichForm;
|
||||
const whichForm = req.query.whichForm;
|
||||
|
||||
if (typeof whichForm !== "string" || whichForm.trim().length === 0) {
|
||||
return respondError(res, {
|
||||
status: 400,
|
||||
code: "WHICH_FORM_REQUIRED",
|
||||
message: "whichForm is required"
|
||||
});
|
||||
}
|
||||
|
||||
// var queryUrl =
|
||||
// "EntityDefinitions(LogicalName='pinswg_" +
|
||||
// whichForm +
|
||||
// "')/Attributes?$count=true&$select=LogicalName,RequiredLevel";
|
||||
|
||||
const mandatoryFieldsData = require("../../../data/mandatoryfields/pinswg_" +
|
||||
whichForm +
|
||||
".json");
|
||||
try {
|
||||
const mandatoryFieldsData = require(
|
||||
"../../../data/mandatoryfields/pinswg_" + whichForm + ".json"
|
||||
);
|
||||
|
||||
return res.status(200).json(mandatoryFieldsData);
|
||||
return respondSuccess(res, mandatoryFieldsData);
|
||||
} catch (error) {
|
||||
return respondError(res, {
|
||||
status: 404,
|
||||
code: "MANDATORY_FIELDS_NOT_FOUND",
|
||||
message: "Mandatory fields data not found for requested form"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user