Skip to content

Commit

Permalink
Merge branch 'main' into fix-idm
Browse files Browse the repository at this point in the history
  • Loading branch information
13bfrancis authored Feb 6, 2025
2 parents 89b528b + b4962e4 commit 625d324
Show file tree
Hide file tree
Showing 121 changed files with 4,369 additions and 8,883 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,24 @@ jobs:
echo "ERROR: Your branch name, $STAGE_NAME, is not a valid Serverless Framework stage name." && exit 1
fi
test:
runs-on: ubuntu-20.04
needs:
- init
environment:
name: ${{ startsWith(github.ref_name, 'snyk-') && 'snyk' || github.ref_name }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Test
run: run test

deploy:
runs-on: ubuntu-20.04
needs:
- init
- test
environment:
name: ${{ startsWith(github.ref_name, 'snyk-') && 'snyk' || github.ref_name }}
outputs:
Expand Down Expand Up @@ -96,19 +110,6 @@ jobs:
run: |
echo "Kibana URL: ${{ needs.deploy.outputs.kibana-url }}"
test:
runs-on: ubuntu-20.04
needs:
- init
environment:
name: ${{ startsWith(github.ref_name, 'snyk-') && 'snyk' || github.ref_name }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Test
run: run test

e2e:
runs-on: ubuntu-20.04
needs:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ DS_Store

# tests
coverage
.vitest
2 changes: 1 addition & 1 deletion lib/lambda/processEmailsHandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ describe("process emails Handler for seatool", () => {
bootstrapServers: "",
};
await handler(mockEvent, {} as Context, callback);
expect(secSPY).toHaveBeenCalledTimes(2);
expect(secSPY).toHaveBeenCalledTimes(1);
});
it("should not find the item ID and do nothing", async () => {
const callback = vi.fn();
Expand Down
7 changes: 5 additions & 2 deletions lib/lambda/sinkChangelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const processAndIndex = async ({
const result = schema.safeParse(record);

if (result.success) {
if (result.data.adminChangeType === "update-id") {
if (result.data.adminChangeType === "update-id" && "idToBeUpdated" in result.data) {
// Push doc with package being soft deleted
docs.forEach((log) => {
const recordOffset = log.id.split("-").at(-1);
Expand All @@ -97,7 +97,10 @@ const processAndIndex = async ({
packageId: result.data.id,
});
});
} else if (result.data.adminChangeType === "split-spa") {
} else if (
result.data.adminChangeType === "split-spa" &&
"idToBeUpdated" in result.data
) {
// Push doc with new split package
docs.push(result.data);

Expand Down
1 change: 1 addition & 0 deletions lib/lambda/sinkMainProcessors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ describe("insertOneMacRecordsFromKafkaIntoMako", () => {
"respond-to-rai",
respondToRai,
{
authority: "Medicaid SPA",
raiReceivedDate: ISO_DATETIME,
raiWithdrawEnabled: false,
seatoolStatus: SEATOOL_STATUS.SUBMITTED,
Expand Down
9 changes: 6 additions & 3 deletions lib/lambda/submit/submitSplitSPA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { z } from "zod";
EXAMPLE EVENT JSON:
{
"body": {
"packageId": "MD-25-9999",
"packageId": "MD-25-9999"
}
}
*/
Expand All @@ -26,6 +26,8 @@ const sendSubmitSplitSPAMessage = async (currentPackage: ItemResult) => {
throw new Error("Error getting next Split SPA Id");
}

const currentTime = Date.now();

// ID and changeMade are excluded; the rest of the object has to be spread into the new package
const {
id: _id,
Expand All @@ -41,8 +43,9 @@ const sendSubmitSplitSPAMessage = async (currentPackage: ItemResult) => {
id: newId,
idToBeUpdated: currentPackage._id,
...remainingFields,
makoChangedDate: Date.now(),
changedDate: Date.now(),
makoChangedDate: currentTime,
changedDate: currentTime,
timestamp: currentTime,
origin: "OneMAC",
changeMade: "OneMAC Admin has added a package to OneMAC.",
changeReason: "Per request from CMS, this package was added to OneMAC.",
Expand Down
5 changes: 0 additions & 5 deletions lib/lambda/update/adminChangeSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ export const transformUpdateValuesSchema = (offset: number) =>
timestamp: Date.now(),
}));

const currentTime = Date.now();

export const transformedUpdateIdSchema = updateIdAdminChangeSchema.transform((data) => ({
...data,
event: "update-id",
Expand All @@ -64,9 +62,6 @@ export const transformedSplitSPASchema = splitSPAAdminChangeSchema.transform((da
event: "split-spa",
packageId: data.id,
id: `${data.id}`,
timestamp: currentTime,
makoChangedDate: currentTime,
changedDate: currentTime,
}));

export const submitNOSOAdminSchema = z.object({
Expand Down
22 changes: 17 additions & 5 deletions lib/libs/email/content/email-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,17 @@ const PackageDetails = ({ details }: { details: Record<string, ReactNode> }) =>
</Section>
);

const MailboxNotice = ({ type }: { type: "SPA" | "Waiver" }) => (
const MailboxNotice = ({
type,
onWaivers = true,
}: {
type: "SPA" | "Waiver";
onWaivers: boolean;
}) => (
<Text style={{ ...styles.text.description, marginTop: "16px", marginBottom: "16px" }}>
{type === "SPA"
? "This mailbox is for the submittal of State Plan Amendments and non-web based responses to Requests for Additional Information (RAI) on submitted SPAs only."
: "This mailbox is for the submittal of Section 1915(b) and 1915(c) Waivers, responses to Requests for Additional Information (RAI) on Waivers, and extension requests on Waivers only."}
: `This mailbox is for the submittal of Section 1915(b) and 1915(c) Waivers, responses to Requests for Additional Information (RAI)${onWaivers ? " on Waivers" : ""}, and extension requests on Waivers only.`}
{" Any other correspondence will be disregarded."}
</Text>
);
Expand All @@ -230,13 +236,15 @@ const FollowUpNotice = ({
isChip,
includeStateLead = true,
includeDidNotExpect = true,
withDivider = true,
}: {
isChip?: boolean;
includeStateLead?: boolean;
includeDidNotExpect?: boolean;
withDivider?: boolean;
}) => (
<>
<Divider />
{withDivider && <Divider />}
{isChip ? (
<Section>
<Text style={{ marginTop: "8px", fontSize: "14px" }}>
Expand Down Expand Up @@ -288,7 +296,9 @@ const WithdrawRAI: React.FC<WithdrawRAIProps> = ({ variables, relatedEvent }) =>
return (
<Section>
<Heading as="h2">
{`The OneMAC Submission Portal received a request to withdraw a Formal RAI Response. You are receiving this email notification as the Formal RAI was withdrawn by ${variables.submitterName} ${variables.submitterEmail}.`}
The OneMAC Submission Portal received a request to withdraw the Formal RAI Response. You
are receiving this email notification as the Formal RAI was withdrawn by{" "}
{variables.submitterName} {variables.submitterEmail}.
</Heading>
<Text style={styles.text.description}>
Note: The original RAI response details could not be retrieved.
Expand All @@ -300,7 +310,9 @@ const WithdrawRAI: React.FC<WithdrawRAIProps> = ({ variables, relatedEvent }) =>
return (
<Section>
<Heading as="h2">
{`The OneMAC Submission Portal received a request to withdraw the Formal RAI Response ${relatedEvent.id}. You are receiving this email notification as the Formal RAI for ${relatedEvent.id} was withdrawn by ${variables.submitterName} ${variables.submitterEmail}.`}
The OneMAC Submission Portal received a request to withdraw the Formal RAI Response{" "}
{relatedEvent.id}. You are receiving this email notification as the Formal RAI for{" "}
{relatedEvent.id} was withdrawn by {variables.submitterName} {variables.submitterEmail}.
</Heading>
</Section>
);
Expand Down
49 changes: 23 additions & 26 deletions lib/libs/email/content/respondToRai/emailTemplates/ChipSpaCMS.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,27 @@ import {
} from "../../email-components";
import { BaseEmailTemplate } from "../../email-templates";

export const ChipSpaCMSEmail = (props: {
export const ChipSpaCMSEmail = ({
variables,
}: {
variables: Events["RespondToRai"] & CommonEmailVariables;
}) => {
const { variables } = props;
const previewText = `CHIP SPA ${variables.id} RAI Response Submitted`;
const heading = "The OneMAC Submission Portal received a CHIP SPA RAI Response Submission";
return (
<BaseEmailTemplate
previewText={previewText}
heading={heading}
applicationEndpointUrl={variables.applicationEndpointUrl}
footerContent={<BasicFooter />}
>
<LoginInstructions appEndpointURL={variables.applicationEndpointUrl} />
<PackageDetails
details={{
"State or Territory": variables.territory,
Name: variables.submitterName,
"Email Address": variables.submitterEmail,
"CHIP SPA Package ID": variables.id,
Summary: variables.additionalInformation,
}}
/>
<Attachments attachments={variables.attachments} />
</BaseEmailTemplate>
);
};
}) => (
<BaseEmailTemplate
previewText={`RAI Response for ${variables.id} Submitted`}
heading="The OneMAC Submission Portal received a CHIP SPA RAI Response Submission"
applicationEndpointUrl={variables.applicationEndpointUrl}
footerContent={<BasicFooter />}
>
<LoginInstructions appEndpointURL={variables.applicationEndpointUrl} />
<PackageDetails
details={{
"State or Territory": variables.territory,
Name: variables.submitterName,
"Email Address": variables.submitterEmail,
"CHIP SPA Package ID": variables.id,
Summary: variables.additionalInformation,
}}
/>
<Attachments attachments={variables.attachments} />
</BaseEmailTemplate>
);
59 changes: 28 additions & 31 deletions lib/libs/email/content/respondToRai/emailTemplates/ChipSpaState.tsx
Original file line number Diff line number Diff line change
@@ -1,39 +1,36 @@
import { formatNinetyDaysDate } from "shared-utils";
import { CommonEmailVariables, Events } from "shared-types";
import { Text } from "@react-email/components";
import { PackageDetails, BasicFooter } from "../../email-components";
import { PackageDetails, BasicFooter, FollowUpNotice } from "../../email-components";
import { BaseEmailTemplate } from "../../email-templates";
import { styles } from "../../email-styles";

export const ChipSpaStateEmail = (props: {
export const ChipSpaStateEmail = ({
variables,
}: {
variables: Events["RespondToRai"] & CommonEmailVariables;
}) => {
const variables = props.variables;
const previewText = `CHIP SPA ${variables.id} RAI Response Submitted`;
const heading = "The OneMAC Submission Portal received a CHIP SPA RAI Response Submission";
return (
<BaseEmailTemplate
previewText={previewText}
heading={heading}
applicationEndpointUrl={variables.applicationEndpointUrl}
footerContent={<BasicFooter />}
>
<PackageDetails
details={{
"State or Territory": variables.territory,
Name: variables.submitterName,
"Email Address": variables.submitterEmail,
"CHIP SPA Package ID": variables.id,
"90th Day Deadline": formatNinetyDaysDate(variables.timestamp),
Summary: variables.additionalInformation,
}}
/>
<Text style={styles.text.description}>
{`This response confirms receipt of your CHIP State Plan Amendment (SPA) or your response to a
}) => (
<BaseEmailTemplate
previewText={`CHIP SPA ${variables.id} RAI Response Submitted`}
heading="The OneMAC Submission Portal received a CHIP SPA RAI Response Submission"
applicationEndpointUrl={variables.applicationEndpointUrl}
footerContent={<BasicFooter />}
>
<PackageDetails
details={{
"State or Territory": variables.territory,
Name: variables.submitterName,
"Email Address": variables.submitterEmail,
"CHIP SPA Package ID": variables.id,
"90th Day Deadline": formatNinetyDaysDate(variables.timestamp),
Summary: variables.additionalInformation,
}}
/>
<Text style={styles.text.description}>
{`This response confirms receipt of your CHIP State Plan Amendment (SPA) or your response to a
SPA Request for Additional Information (RAI). You can expect a formal response to your
submittal to be issued within 90 days, before ${formatNinetyDaysDate(variables.timestamp)}
.`}
</Text>
</BaseEmailTemplate>
);
};
submittal to be issued within 90 days, before ${formatNinetyDaysDate(variables.timestamp)}.`}
</Text>
<FollowUpNotice isChip withDivider={false} />
</BaseEmailTemplate>
);
50 changes: 23 additions & 27 deletions lib/libs/email/content/respondToRai/emailTemplates/MedSpaCMS.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,27 @@ import {
} from "../../email-components";
import { BaseEmailTemplate } from "../../email-templates";

export const MedSpaCMSEmail = (props: {
export const MedSpaCMSEmail = ({
variables,
}: {
variables: Events["RespondToRai"] & CommonEmailVariables;
}) => {
const variables = props.variables;
const previewText = `Medicaid SPA ${variables.id} RAI Response Submitted`;
const heading = "The OneMAC Submission Portal received a Medicaid SPA RAI Response Submission:";

return (
<BaseEmailTemplate
previewText={previewText}
heading={heading}
applicationEndpointUrl={variables.applicationEndpointUrl}
footerContent={<BasicFooter />}
>
<LoginInstructions appEndpointURL={variables.applicationEndpointUrl} />
<PackageDetails
details={{
"State or Territory": variables.territory,
Name: variables.submitterName,
"Email Address": variables.submitterEmail,
"Medicaid SPA Package ID": variables.id,
Summary: variables.additionalInformation,
}}
/>
<Attachments attachments={variables.attachments} />
</BaseEmailTemplate>
);
};
}) => (
<BaseEmailTemplate
previewText={`Medicaid SPA RAI Response for ${variables.id} Submitted`}
heading="The OneMAC Submission Portal received a Medicaid SPA RAI Response Submission:"
applicationEndpointUrl={variables.applicationEndpointUrl}
footerContent={<BasicFooter />}
>
<LoginInstructions appEndpointURL={variables.applicationEndpointUrl} />
<PackageDetails
details={{
"State or Territory": variables.territory,
Name: variables.submitterName,
"Email Address": variables.submitterEmail,
"Medicaid SPA Package ID": variables.id,
Summary: variables.additionalInformation,
}}
/>
<Attachments attachments={variables.attachments} />
</BaseEmailTemplate>
);
Loading

0 comments on commit 625d324

Please sign in to comment.