diff --git a/app/api/job/send-open-jobs-emails/route.ts b/app/api/job/send-open-jobs-emails/route.ts index a18d3c6..1efd956 100644 --- a/app/api/job/send-open-jobs-emails/route.ts +++ b/app/api/job/send-open-jobs-emails/route.ts @@ -20,13 +20,14 @@ export const POST = async (request: NextRequest) => { try { const doctors = await sendOpenJobsEmails(); + const doctorIds = doctors?.join(', ') ?? '-'; console.info( - 'Successfully sent out open job notification emails to doctors', + `Successfully sent out open job notification emails to doctorIds: ${doctorIds}`, ); await createNotificationLog({ action: NotificationAction.DOCTOR_NEW_JOBS, status: 'SUCCESS', - comment: `doctors that received email: ${doctors}`, + comment: `doctors that received email: ${doctorIds}`, }); return NextResponse.json( { @@ -35,7 +36,7 @@ export const POST = async (request: NextRequest) => { }, { status: 200 }, ); - } catch (e: any) { + } catch (e) { console.error( 'Error sending out open job notification emails to doctors.', e, @@ -43,7 +44,7 @@ export const POST = async (request: NextRequest) => { await createNotificationLog({ action: NotificationAction.DOCTOR_NEW_JOBS, status: 'FAIL', - comment: e?.message, + comment: e instanceof Error ? e.message : 'Unknown error', }); return NextResponse.json( {