improve doctor email audit logs

This commit is contained in:
Danel Kungla
2025-10-10 16:14:36 +03:00
parent 6aa5149789
commit f74c5a2fc6
4 changed files with 13 additions and 5 deletions

View File

@@ -12,9 +12,13 @@ export default async function sendOpenJobsEmails() {
}
const doctorAccounts = await getDoctorAccounts();
const doctorEmails: string[] = doctorAccounts
const doctorEmails = doctorAccounts
.map(({ email }) => email)
.filter((email): email is string => !!email);
.filter((email) => !!email);
if (doctorEmails !== null) {
return [];
}
await sendEmailFromTemplate(
renderNewJobsAvailableEmail,
@@ -24,4 +28,6 @@ export default async function sendOpenJobsEmails() {
},
doctorEmails,
);
return doctorAccounts.filter((email) => !!email).map(({ id }) => id);
}

View File

@@ -19,13 +19,14 @@ export const POST = async (request: NextRequest) => {
}
try {
await sendOpenJobsEmails();
const doctors = await sendOpenJobsEmails();
console.info(
'Successfully sent out open job notification emails to doctors.',
'Successfully sent out open job notification emails to doctors',
);
await createNotificationLog({
action: NotificationAction.DOCTOR_NEW_JOBS,
status: 'SUCCESS',
comment: `doctors that received email: ${doctors}`,
});
return NextResponse.json(
{

View File

@@ -25,7 +25,7 @@ const MembershipConfirmationNotification: React.FC<{
descriptionKey="account:membershipConfirmation:successDescription"
buttonProps={{
buttonTitleKey: 'account:membershipConfirmation:successButton',
href: pathsConfig.app.home,
href: pathsConfig.app.selectPackage,
}}
/>
);

View File

@@ -48,6 +48,7 @@ async function SelectPackagePage() {
<Scale className="size-4 stroke-[1.5px]" />
</Button>
}
countryCode={countryCode}
/>
</div>
<SelectAnalysisPackages