Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/notification/controller/notification.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/notification/fcm/controller/push.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions src/notification/repository/notification.repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ class NotificationRepository {

// 알림 목록 조회 (최신순)
const notifications = await prisma.notification.findMany({
where: { userId: BigInt(userId) },
where: { userId: userId },
orderBy: { createdAt: 'desc' }, // 최신순 정렬
skip: offset,
take: limit
});

// 전체 개수 조회 (페이지네이션 정보 계산용)
const total = await prisma.notification.count({
where: { userId: BigInt(userId) }
where: { userId: userId }
});

return { items: notifications, total };
Expand Down Expand Up @@ -71,7 +71,7 @@ class NotificationRepository {
async markAllNotificationsAsRead(userId) {
return await prisma.notification.updateMany({
where: {
userId: BigInt(userId),
userId: userId,
isRead: false
},
data: {
Expand All @@ -93,7 +93,7 @@ class NotificationRepository {
return await prisma.notification.deleteMany({
where: {
id: { in: bigIntIds },
userId: BigInt(userId) // 본인의 알림만 삭제 가능
userId: userId // 본인의 알림만 삭제 가능
}
});
}
Expand All @@ -105,7 +105,7 @@ class NotificationRepository {
*/
async deleteAllNotificationsByUserId(userId) {
return await prisma.notification.deleteMany({
where: { userId: BigInt(userId) }
where: { userId: userId }
});
}

Expand All @@ -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
Expand Down