TASK22057: phase19 endpoint consistency hardening slice

This commit is contained in:
2026-03-14 07:06:57 +00:00
parent fffe1d19dd
commit 598e4a6077
8 changed files with 345 additions and 8 deletions
+22 -4
View File
@@ -86,12 +86,30 @@ const recordExists = async (incidentId, contactId, token) => {
};
export default async function ApiProxy(req, res) {
const token = await getToken();
const data = req.body;
const watchedCaseBind = data?.["pinswg_WatchedCase@odata.bind"];
const contactBind = data?.["pinswg_Contact@odata.bind"];
const incidentId =
data["pinswg_WatchedCase@odata.bind"].match(/\(([^)]+)\)/)[1];
const contactId = data["pinswg_Contact@odata.bind"].match(/\(([^)]+)\)/)[1];
if (
typeof watchedCaseBind !== "string" ||
watchedCaseBind.length === 0 ||
typeof contactBind !== "string" ||
contactBind.length === 0
) {
return res.status(400).json();
}
const watchedCaseMatch = watchedCaseBind.match(/\(([^)]+)\)/);
const contactMatch = contactBind.match(/\(([^)]+)\)/);
if (!watchedCaseMatch || !contactMatch) {
return res.status(400).json();
}
const token = await getToken();
const incidentId = watchedCaseMatch[1];
const contactId = contactMatch[1];
const existingRecord = await recordExists(incidentId, contactId, token);