39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
import { respondError, respondSuccess } from "../middleware/apiResponse";
|
|
|
|
const WORDKEY = process.env.HASHKEY;
|
|
|
|
const WEBAPI_URL =
|
|
process.env.RELAY_ROOT ||
|
|
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
|
|
|
export default async function ApiProxy(req, res) {
|
|
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";
|
|
|
|
try {
|
|
const mandatoryFieldsData = require(
|
|
"../../../data/mandatoryfields/pinswg_" + whichForm + ".json"
|
|
);
|
|
|
|
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"
|
|
});
|
|
}
|
|
}
|