Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge development to master #1487

Merged
merged 2 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading