From 0bd717e8bdf892ce74818e730bcbdf5f913db769 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Thu, 6 Mar 2025 08:41:33 +0700 Subject: [PATCH] fix: delete still appear in result --- src/controllers/00-notification-controller.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/controllers/00-notification-controller.ts b/src/controllers/00-notification-controller.ts index 8a953af..4f00bcf 100644 --- a/src/controllers/00-notification-controller.ts +++ b/src/controllers/00-notification-controller.ts @@ -59,9 +59,13 @@ export class NotificationController extends Controller { }, ], NOT: { - readByUser: { some: { id: req.user.sub } }, - deleteByUser: { some: { id: req.user.sub } }, - createdAt: { lte: dayjs().subtract(7, "days").toDate() }, + OR: [ + { + readByUser: { some: { id: req.user.sub } }, + createdAt: { lte: dayjs().subtract(7, "days").toDate() }, + }, + { deleteByUser: { some: { id: req.user.sub } } }, + ], }, }; const [result, total] = await prisma.$transaction([ @@ -166,7 +170,7 @@ export class NotificationController extends Controller { where: { id: notificationId }, data: { deleteByUser: { - disconnect: { id: req.user.sub }, + connect: { id: req.user.sub }, }, }, });