From f49f5be11f0b7c4c0f4fac626c3ebd45526f0d83 Mon Sep 17 00:00:00 2001 From: Sawit Koseeyaumporn Date: Tue, 26 Nov 2024 01:34:11 +0700 Subject: [PATCH] add: noti from sending the messages --- src/controllers/messageController.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/controllers/messageController.ts b/src/controllers/messageController.ts index 9da19f5..ae0f94c 100644 --- a/src/controllers/messageController.ts +++ b/src/controllers/messageController.ts @@ -31,7 +31,16 @@ export const messageController = new Elysia({ prefix: "/message" }) }, }); + // Also send a notification to the receiver + await prisma.notification.create({ + data: { + UserID: receiverID, + NotificationContent: "You have a new message from " + sender.UserName, + }}); + return newMessage; + + }, { body: t.Object({