TASK22224: aggressive non-file parity bundle

This commit is contained in:
2026-03-23 18:32:49 +00:00
parent ba9beda65e
commit 411190e403
8 changed files with 249 additions and 116 deletions
+14 -16
View File
@@ -22,27 +22,25 @@ function flattenWatchlistEntry(entry) {
}
export default async function ApiProxy(req, res) {
var token = await getToken();
const token = await getToken();
var queryUrl =
const queryUrl =
"pinswg_watchlists?$count=true&$filter=pinswg_emailnotifications ne null&$expand=pinswg_Contact($select=contactid,emailaddress1)&$select=pinswg_emailnotifications,_pinswg_watchedcase_value";
return axios
.get(
try {
const { data } = await axios.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
const flattenedResults = data.value.map(flattenWatchlistEntry);
);
const flattenedResults = data.value.map(flattenWatchlistEntry);
return respondSuccess(res, flattenedResults);
})
.catch((error) => {
consoleLogger(error);
return respondError(res, {
status: 400,
code: "CASE_REF_FETCH_FAILED",
message: "Failed to fetch case references"
});
return respondSuccess(res, flattenedResults);
} catch (error) {
consoleLogger(error);
return respondError(res, {
status: 400,
code: "CASE_REF_FETCH_FAILED",
message: "Failed to fetch case references"
});
}
}
+14 -16
View File
@@ -22,27 +22,25 @@ function flattenWatchlistEntry(entry) {
}
export default async function ApiProxy(req, res) {
var token = await getToken();
const token = await getToken();
var queryUrl =
const queryUrl =
"pinswg_watchlists?$count=true&$filter=pinswg_emailnotifications ne null&$expand=pinswg_Contact($select=contactid,emailaddress1)&$select=pinswg_emailnotifications,_pinswg_watchedcase_value";
return axios
.get(
try {
const { data } = await axios.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
const flattenedResults = data.value.map(flattenWatchlistEntry);
);
const flattenedResults = data.value.map(flattenWatchlistEntry);
return respondSuccess(res, flattenedResults);
})
.catch((error) => {
consoleLogger(error);
return respondError(res, {
status: 400,
code: "MAILING_LIST_FETCH_FAILED",
message: "Failed to fetch mailing list"
});
return respondSuccess(res, flattenedResults);
} catch (error) {
consoleLogger(error);
return respondError(res, {
status: 400,
code: "MAILING_LIST_FETCH_FAILED",
message: "Failed to fetch mailing list"
});
}
}
+14 -15
View File
@@ -31,7 +31,7 @@ import { getPreferredLanguage } from "../../../actions/services/accountService";
import { respondError, respondSuccess } from "../middleware/apiResponse";
export default async function ApiProxy(req, res) {
var data = req.body;
const data = req.body;
const emailAddress = sanitizeString(data?.emailAddress);
if (!isNonEmptyString(emailAddress)) {
@@ -58,7 +58,7 @@ export default async function ApiProxy(req, res) {
}
}
var NotifyClient = require("notifications-node-client").NotifyClient;
const NotifyClient = require("notifications-node-client").NotifyClient;
const notifyClient = new NotifyClient(process.env.NOTIFY_API_KEY);
//const emailReplyToId = process.env.EMAIL_REPLY_TO_ID;
@@ -68,20 +68,19 @@ export default async function ApiProxy(req, res) {
payload: redactSensitive(data)
});
notifyClient
.sendEmail(data.templateId, data.emailAddress, {
try {
await notifyClient.sendEmail(data.templateId, data.emailAddress, {
personalisation: data.personalisation,
reference: data.reference
})
.then(() => {
return respondSuccess(res, data);
})
.catch((error) => {
consoleLogger(error);
return respondError(res, {
status: 400,
code: "EMAIL_NOTIFY_FAILED",
message: "Failed to send notify email"
});
});
return respondSuccess(res, data);
} catch (error) {
consoleLogger(error);
return respondError(res, {
status: 400,
code: "EMAIL_NOTIFY_FAILED",
message: "Failed to send notify email"
});
}
}