Skip to content

Commit

Permalink
Merge pull request #1487 from Enterprise-CMCS/develop
Browse files Browse the repository at this point in the history
merge development to master
  • Loading branch information
Dark-Knight-1313 authored Jul 12, 2024
2 parents 6fcde78 + 056227e commit b071bff
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 33 deletions.
57 changes: 26 additions & 31 deletions services/app-api/email/stateWithdrawalReceipt.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,33 @@
import dynamoDb from "../libs/dynamodb-lib";
import { USER_ROLE, USER_STATUS, Workflow } from "cmscommonlib";
import { USER_STATUS, Workflow } from "cmscommonlib";

export const getAllActiveStateUserEmailAddresses = async (territory) => {
const stateSubmittingUserRoles = [
USER_ROLE.STATE_SUBMITTER,
USER_ROLE.STATE_SYSTEM_ADMIN,
];
const stateSubmittingUsers = [];

await Promise.all(
stateSubmittingUserRoles.map(async (role) => {
const qParams = {
TableName: process.env.oneMacTableName,
IndexName: "GSI2",
KeyConditionExpression: "GSI2pk = :pk and GSI2sk = :sk",
ExpressionAttributeValues: {
":pk": `${role}#${territory}`,
":sk": USER_STATUS.ACTIVE,
},
ProjectionExpression: "email, fullName",
};
try {
const results = await dynamoDb.query(qParams);
stateSubmittingUsers.push(
results.Items.map(({ fullName, email }) => `${fullName} <${email}>`)
);
} catch (e) {
console.log("query error: ", e.message);
}
})
);
const returnUsers = stateSubmittingUsers.flat();
const qParams = {
TableName: process.env.oneMacTableName,
IndexName: "GSI1",
KeyConditionExpression: "GSI1pk = :pk",
FilterExpression: "#status = :status and territory = :territory",
ExpressionAttributeNames: {
"#status": "status",
},
ExpressionAttributeValues: {
":pk": "USER",
":territory": territory,
":status": USER_STATUS.ACTIVE,
},
ProjectionExpression: "email, fullName",
};

return returnUsers;
try {
const results = await dynamoDb.query(qParams);
const returnUsers = results.Items.map(
({ fullName, email }) => `${fullName} <${email}>`
);
return returnUsers;
} catch (e) {
console.log("query error: ", e.message);
return [];
}
};

/**
Expand Down
7 changes: 5 additions & 2 deletions services/one-stream/package/buildAnyPackage.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,11 @@ export const buildAnyPackage = async (packageId, config) => {
let adminChanges = [];

result.Items.forEach((anEvent) => {
// we ignore all other v's (for now)
if (anEvent.sk.substring(0, 1) === "v") {
// we ignore all other v's (for now) and any email events
if (
anEvent.sk.substring(0, 1) === "v" ||
anEvent.sk.startsWith("Email")
) {
console.log("ignoring: ", anEvent.sk);
return;
}
Expand Down

0 comments on commit b071bff

Please sign in to comment.