Merge branch 'main' into MED-85

This commit is contained in:
2025-08-29 11:45:36 +03:00
18 changed files with 366 additions and 126 deletions

View File

@@ -6,6 +6,7 @@ import { emailSchema } from '@/lib/validations/email.schema';
import { renderDoctorSummaryReceivedEmail } from '@kit/email-templates';
import { getMailer } from '@kit/mailers';
import { enhanceAction } from '@kit/next/actions';
import { getLogger } from '@kit/shared/logger';
export const sendDoctorSummaryCompletedEmail = async (
language: string,
@@ -49,12 +50,24 @@ export const sendCompanyOfferEmail = async (
export const sendEmail = enhanceAction(
async ({ subject, html, to }) => {
const mailer = await getMailer();
await mailer.sendEmail({
const log = await getLogger();
if (!process.env.EMAIL_USER) {
log.error('Sending email failed, as no sender found in env.')
throw new Error('No email user configured');
}
const result = await mailer.sendEmail({
from: process.env.EMAIL_USER,
to,
subject,
html,
});
log.info(
`Sent email with subject "${subject}", result: ${JSON.stringify(result)}`,
);
return {};
},
{