improve doctor email audit logs
This commit is contained in:
@@ -12,9 +12,13 @@ export default async function sendOpenJobsEmails() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const doctorAccounts = await getDoctorAccounts();
|
const doctorAccounts = await getDoctorAccounts();
|
||||||
const doctorEmails: string[] = doctorAccounts
|
const doctorEmails = doctorAccounts
|
||||||
.map(({ email }) => email)
|
.map(({ email }) => email)
|
||||||
.filter((email): email is string => !!email);
|
.filter((email) => !!email);
|
||||||
|
|
||||||
|
if (doctorEmails !== null) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
await sendEmailFromTemplate(
|
await sendEmailFromTemplate(
|
||||||
renderNewJobsAvailableEmail,
|
renderNewJobsAvailableEmail,
|
||||||
@@ -24,4 +28,6 @@ export default async function sendOpenJobsEmails() {
|
|||||||
},
|
},
|
||||||
doctorEmails,
|
doctorEmails,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return doctorAccounts.filter((email) => !!email).map(({ id }) => id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,13 +19,14 @@ export const POST = async (request: NextRequest) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await sendOpenJobsEmails();
|
const doctors = await sendOpenJobsEmails();
|
||||||
console.info(
|
console.info(
|
||||||
'Successfully sent out open job notification emails to doctors.',
|
'Successfully sent out open job notification emails to doctors',
|
||||||
);
|
);
|
||||||
await createNotificationLog({
|
await createNotificationLog({
|
||||||
action: NotificationAction.DOCTOR_NEW_JOBS,
|
action: NotificationAction.DOCTOR_NEW_JOBS,
|
||||||
status: 'SUCCESS',
|
status: 'SUCCESS',
|
||||||
|
comment: `doctors that received email: ${doctors}`,
|
||||||
});
|
});
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ const MembershipConfirmationNotification: React.FC<{
|
|||||||
descriptionKey="account:membershipConfirmation:successDescription"
|
descriptionKey="account:membershipConfirmation:successDescription"
|
||||||
buttonProps={{
|
buttonProps={{
|
||||||
buttonTitleKey: 'account:membershipConfirmation:successButton',
|
buttonTitleKey: 'account:membershipConfirmation:successButton',
|
||||||
href: pathsConfig.app.home,
|
href: pathsConfig.app.selectPackage,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ async function SelectPackagePage() {
|
|||||||
<Scale className="size-4 stroke-[1.5px]" />
|
<Scale className="size-4 stroke-[1.5px]" />
|
||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
|
countryCode={countryCode}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<SelectAnalysisPackages
|
<SelectAnalysisPackages
|
||||||
|
|||||||
Reference in New Issue
Block a user