MED-145: send notification to patient when summary completed (#61)

* MED-145: send notification to patient when summary completed

* MED-145: send notification to patient when summary completed

* use aliased imports where possible, revert cart service urls

* save language preference to local db

* remove unnecessary optional chaning
This commit is contained in:
Helena
2025-08-28 13:05:07 +03:00
committed by GitHub
parent 5159325e6d
commit 86dc221cc6
22 changed files with 551 additions and 169 deletions

View File

@@ -1,10 +1,33 @@
'use server';
import { CompanySubmitData } from '@/lib/types/company';
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 { CompanySubmitData } from '../types/company';
import { emailSchema } from '../validations/email.schema';
export const sendDoctorSummaryCompletedEmail = async (
language: string,
recipientName: string,
recipientEmail: string,
orderNr: string,
orderId: number,
) => {
const { html, subject } = await renderDoctorSummaryReceivedEmail({
language,
recipientName,
recipientEmail,
orderNr,
orderId,
});
await sendEmail({
subject,
html,
to: recipientEmail,
});
};
export const sendCompanyOfferEmail = async (
data: CompanySubmitData,
@@ -26,7 +49,6 @@ export const sendCompanyOfferEmail = async (
export const sendEmail = enhanceAction(
async ({ subject, html, to }) => {
const mailer = await getMailer();
await mailer.sendEmail({
to,
subject,