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); 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