Fix undefined notificationResult and bypass Prisma TS errors with casting
This commit is contained in:
@@ -68,7 +68,8 @@ export async function POST(request: Request) {
|
||||
|
||||
// 3. Bildirim Gönder (Telegram)
|
||||
let tgStatus = 'SKIPPED';
|
||||
if (mapping.user.telegramEnabled && mapping.user.telegramId) {
|
||||
const user = mapping.user as any;
|
||||
if (user.telegramEnabled && user.telegramId) {
|
||||
const tgResult = await sendTelegramNotification(
|
||||
mapping.userId,
|
||||
to,
|
||||
@@ -81,8 +82,8 @@ export async function POST(request: Request) {
|
||||
|
||||
// 4. Bildirim Gönder (WhatsApp)
|
||||
let waStatus = 'SKIPPED';
|
||||
if (mapping.user.whatsappEnabled && (mapping.user.whatsappNumber || process.env.DEFAULT_WHATSAPP_NUMBER)) {
|
||||
const waNumber = mapping.user.whatsappNumber || process.env.DEFAULT_WHATSAPP_NUMBER;
|
||||
if (user.whatsappEnabled && (user.whatsappNumber || process.env.DEFAULT_WHATSAPP_NUMBER)) {
|
||||
const waNumber = user.whatsappNumber || process.env.DEFAULT_WHATSAPP_NUMBER;
|
||||
const waMessage = `📩 *Yeni E-posta*\n\n*Gönderen:* ${mailData.from}\n*Konu:* ${mailData.subject}\n*Alıcı:* ${to}\n\n_AyrisMail Central_`;
|
||||
|
||||
const waResult = await sendWA(waNumber, waMessage, mapping.userId);
|
||||
@@ -103,7 +104,8 @@ export async function POST(request: Request) {
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
notification: notificationResult.status,
|
||||
tgStatus,
|
||||
waStatus,
|
||||
subject: mailData.subject
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user