From bb4a6393fcc6a0bf30476847c994b15c3c437b3b Mon Sep 17 00:00:00 2001 From: modzivv Date: Fri, 1 Aug 2025 02:06:13 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=EC=95=8C=EB=A6=BC=20=EC=BB=A8?= =?UTF-8?q?=ED=8A=B8=EB=A1=A4=EB=9F=AC=20userId=20=ED=95=84=EB=93=9C?= =?UTF-8?q?=EB=AA=85=20=EC=B0=B8=EC=A1=B0=20=EC=98=A4=EB=A5=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20#111?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/notification/controller/notification.controller.js | 10 +++++----- src/notification/fcm/controller/push.controller.js | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/notification/controller/notification.controller.js b/src/notification/controller/notification.controller.js index a42f6f2..c0f5e6b 100644 --- a/src/notification/controller/notification.controller.js +++ b/src/notification/controller/notification.controller.js @@ -18,7 +18,7 @@ class NotificationController { async getNotifications(req, res, next) { try { // 현재 로그인한 사용자 ID - const userId = BigInt(req.user.id); + const userId = BigInt(req.user.userId); // 쿼리 파라미터에서 페이지네이션 정보 추출 const page = req.query.page || 1; @@ -57,7 +57,7 @@ class NotificationController { const notificationId = BigInt(req.params.notificationId); // 현재 로그인한 사용자 ID - const userId = BigInt(req.user.id); + const userId = BigInt(req.user.userId); // 알림 읽음 처리 서비스 호출 const result = await notificationService.markNotificationAsRead(notificationId, userId); @@ -86,7 +86,7 @@ class NotificationController { async markAllNotificationsAsRead(req, res, next) { try { // 현재 로그인한 사용자 ID - const userId = BigInt(req.user.id); + const userId = BigInt(req.user.userId); // 모든 알림 읽음 처리 서비스 호출 const result = await notificationService.markAllNotificationsAsRead(userId); @@ -113,7 +113,7 @@ class NotificationController { const { notification_ids } = req.body; // 현재 로그인한 사용자 ID - const userId = BigInt(req.user.id); + const userId = BigInt(req.user.userId); // 선택 알림 삭제 서비스 호출 const result = await notificationService.deleteNotificationsByIds(notification_ids, userId); @@ -140,7 +140,7 @@ class NotificationController { async deleteAllNotifications(req, res, next) { try { // 현재 로그인한 사용자 ID - const userId = BigInt(req.user.id); + const userId = BigInt(req.user.userId); // 전체 알림 삭제 서비스 호출 const result = await notificationService.deleteAllNotifications(userId); diff --git a/src/notification/fcm/controller/push.controller.js b/src/notification/fcm/controller/push.controller.js index fc59113..f8185b0 100644 --- a/src/notification/fcm/controller/push.controller.js +++ b/src/notification/fcm/controller/push.controller.js @@ -20,7 +20,7 @@ class PushController { async registerPushToken(req, res, next) { try { // 현재 로그인한 사용자 ID - const userId = BigInt(req.user.id); + const userId = BigInt(req.user.userId); // 요청 본문 데이터를 DTO로 구조화 const tokenDto = new PushTokenRegisterDto(req.body); @@ -52,7 +52,7 @@ class PushController { async deletePushToken(req, res, next) { try { // 현재 로그인한 사용자 ID - const userId = BigInt(req.user.id); + const userId = BigInt(req.user.userId); // FCM 토큰 삭제 서비스 호출 const result = await pushService.deletePushToken(userId); From d4f3f0c6664d803dc7b413a18ab60569861eba82 Mon Sep 17 00:00:00 2001 From: modzivv Date: Fri, 1 Aug 2025 02:07:07 +0900 Subject: [PATCH 2/2] =?UTF-8?q?refactor:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20BigInt=20=EB=B3=80=ED=99=98=20=EC=A0=9C=EA=B1=B0=20?= =?UTF-8?q?#111?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/notification.repository.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/notification/repository/notification.repository.js b/src/notification/repository/notification.repository.js index dbfbfec..6e9917b 100644 --- a/src/notification/repository/notification.repository.js +++ b/src/notification/repository/notification.repository.js @@ -15,7 +15,7 @@ class NotificationRepository { // 알림 목록 조회 (최신순) const notifications = await prisma.notification.findMany({ - where: { userId: BigInt(userId) }, + where: { userId: userId }, orderBy: { createdAt: 'desc' }, // 최신순 정렬 skip: offset, take: limit @@ -23,7 +23,7 @@ class NotificationRepository { // 전체 개수 조회 (페이지네이션 정보 계산용) const total = await prisma.notification.count({ - where: { userId: BigInt(userId) } + where: { userId: userId } }); return { items: notifications, total }; @@ -71,7 +71,7 @@ class NotificationRepository { async markAllNotificationsAsRead(userId) { return await prisma.notification.updateMany({ where: { - userId: BigInt(userId), + userId: userId, isRead: false }, data: { @@ -93,7 +93,7 @@ class NotificationRepository { return await prisma.notification.deleteMany({ where: { id: { in: bigIntIds }, - userId: BigInt(userId) // 본인의 알림만 삭제 가능 + userId: userId // 본인의 알림만 삭제 가능 } }); } @@ -105,7 +105,7 @@ class NotificationRepository { */ async deleteAllNotificationsByUserId(userId) { return await prisma.notification.deleteMany({ - where: { userId: BigInt(userId) } + where: { userId: userId } }); } @@ -116,7 +116,7 @@ class NotificationRepository { */ async findUserById(userId) { return await prisma.user.findUnique({ - where: { id: BigInt(userId) }, + where: { id: userId }, select: { id: true, nickname: true