IO-3166-Global-Notifications-Part-2: checkpoint

This commit is contained in:
Dave Richer
2025-03-11 11:57:16 -04:00
parent 8d36ad3589
commit d6df5af1a4

View File

@@ -258,8 +258,17 @@ const jobStatusChangeBuilder = (data) => {
const newMediaAddedReassignedBuilder = (data) => {
// Determine if it's an image or document
const mediaType = data?.data?.type?.startsWith("image") ? "Image" : "Document";
// Determine if it's added or updated
const action = data.isNew ? "added" : "updated";
// Determine the action
let action;
if (data.isNew) {
action = "added"; // New media
} else if (data.changedFields?.jobid && data.changedFields.jobid.old !== data.changedFields.jobid.new) {
action = "reassigned to Job";
} else {
action = "updated";
}
// Construct the body string
const body = `An ${mediaType} has been ${action}.`;