feat(notifications): send branded transactional emails for shop events
Deploy Canina / deploy (push) Failing after 1m57s
Deploy Canina / deploy (push) Failing after 1m57s
Add Canina-branded welcome, contact confirmation/admin notify, and order created/paid/shipped emails via support@canina.ir without blocking the SMS flows.
This commit is contained in:
1 parent
6fbbd7140d
commit
625c3f5ce2
19 files changed
+331
-20
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { Injectable, Logger, OnModuleInit, OnModuleDestroy } from '@nestjs/common';
|
||||
import { PrismaService } from '../prisma/prisma.service';
|
||||
import { EmailService } from './email.service';
|
||||
import { renderCaninaNotificationEmail } from './email-layout';
|
||||
import { SmsService } from '../common/services/sms.service';
|
||||
|
||||
export interface EnqueueOptions {
|
||||
@@ -104,11 +105,12 @@ export class NotificationsQueueService implements OnModuleInit, OnModuleDestroy
|
||||
try {
|
||||
if (item.channel === 'EMAIL') {
|
||||
const payloadObj = (item.payload as Record<string, any>) || {};
|
||||
const subject = item.subject || 'اطلاعیه کنینا ایران';
|
||||
const res = await this.emailService.sendMail({
|
||||
to: item.recipient,
|
||||
subject: item.subject || 'اطلاعیه کنینا ایران',
|
||||
subject,
|
||||
text: item.content,
|
||||
html: payloadObj.html || `<div style="font-family:Tahoma,sans-serif;direction:rtl;padding:20px;">${item.content.replace(/\n/g, '<br/>')}</div>`,
|
||||
html: payloadObj.html || renderCaninaNotificationEmail(subject, item.content || ''),
|
||||
});
|
||||
|
||||
if (res.success) {
|
||||
|
||||
Reference in new issue
Block a user