TASK22211: normalize hash and metadata endpoint contracts

This commit is contained in:
2026-03-23 12:14:17 +00:00
parent cb69bbe732
commit 722ef9846a
4 changed files with 134 additions and 13 deletions
+23 -5
View File
@@ -17,6 +17,8 @@
* description: hello world
*/
import { respondError, respondSuccess } from "../middleware/apiResponse";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
@@ -24,16 +26,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/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=OptionSet,GlobalOptionSet&$count=true";
const pickListData = require("../../../data/picklistdata/pinswg_" +
whichForm +
".json");
try {
const pickListData = require(
"../../../data/picklistdata/pinswg_" + whichForm + ".json"
);
return res.status(200).json(pickListData);
return respondSuccess(res, pickListData);
} catch (error) {
return respondError(res, {
status: 404,
code: "PICKLISTS_NOT_FOUND",
message: "Picklist data not found for requested form"
});
}
}