Skip to content

Commit

Permalink
fix: fix issue with deletion provisioned email for public cloud (#2267)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kolezhanchik authored Mar 12, 2024
1 parent 1300784 commit ae056b1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions app/api/public-cloud/provision/[licencePlate]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { $Enums, DecisionStatus, Prisma, PublicCloudRequestedProject } from '@pr
import prisma from '@/core/prisma';
import { string, z } from 'zod';
import { PublicCloudRequestedProjectWithContacts } from '@/services/nats/public-cloud';
import { sendProvisionedEmails } from '@/services/ches/public-cloud/email-handler';
import { sendProvisionedEmails, sendDeleteRequestApprovalEmails } from '@/services/ches/public-cloud/email-handler';
import { wrapAsync } from '@/helpers/runtime';

const ParamsSchema = z.object({
Expand Down Expand Up @@ -81,7 +81,11 @@ export async function PUT(req: NextRequest, { params }: { params: Params }) {
},
});

wrapAsync(() => sendProvisionedEmails(project as PublicCloudRequestedProjectWithContacts));
wrapAsync(() => {
if (request.type === $Enums.RequestType.DELETE) {
sendDeleteRequestApprovalEmails(project as PublicCloudRequestedProjectWithContacts);
} else sendProvisionedEmails(project as PublicCloudRequestedProjectWithContacts);
});

return new NextResponse(`Successfully marked ${licencePlate} as provisioned.`, { status: 200 });
} catch (error: any) {
Expand Down
2 changes: 1 addition & 1 deletion emails/_components/Edit/ContactChanges.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export default function ContactChanges({
) : (
<Text className="mb-1">No Current Expense Authority</Text>
)}
<Text className="font-semibold mb-0">{requestedLabel}Expense Authority</Text>
<Text className="font-semibold mb-0">{requestedLabel} Expense Authority</Text>
<Text className="mb-1 mt-2">
{expenseAuthorityRequested?.firstName} {expenseAuthorityRequested?.lastName}
</Text>
Expand Down
1 change: 1 addition & 0 deletions emails/_components/Edit/utils/compare-projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const publicCloudFieldsToCompare: Array<keyof PublicCloudProject> = [
'projectOwnerId',
'primaryTechnicalLeadId',
'secondaryTechnicalLeadId',
'expenseAuthorityId',
'accountCoding',
'budget',
];
Expand Down
5 changes: 4 additions & 1 deletion emails/_templates/public-cloud/EditSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ const EditSummaryTemplate = ({ request, comment }: EmailProp) => {
/>
</div>
)}
{(changed.projectOwnerId || changed.primaryTechnicalLeadId || changed.secondaryTechnicalLeadId) && (
{(changed.projectOwnerId ||
changed.primaryTechnicalLeadId ||
changed.secondaryTechnicalLeadId ||
changed.expenseAuthorityId) && (
<div className="pb-6 mt-4 mb-4 border-solid border-0 border-b-1 border-slate-300">
<ContactChanges
poCurrent={current.projectOwner}
Expand Down

0 comments on commit ae056b1

Please sign in to comment.