diff --git a/src/modules/notifications/providers/notifications.service.ts b/src/modules/notifications/providers/notifications.service.ts index 22377f9..48a0a88 100755 --- a/src/modules/notifications/providers/notifications.service.ts +++ b/src/modules/notifications/providers/notifications.service.ts @@ -95,7 +95,9 @@ export class NotificationsService { //************************ */ async getAllNotifications(queryDto: SearchNotificationQueryDto, recipientId: string) { - return await this.notificationRepository.getAllNotifications(queryDto, recipientId); + const [notifications, count] = await this.notificationRepository.getAllNotifications(queryDto, recipientId); + const notificationCount = await this.countUserNotifications(recipientId); + return { notifications, notificationCount, count, paginate: true }; } //************************ */ diff --git a/src/modules/notifications/repositories/notifications.repository.ts b/src/modules/notifications/repositories/notifications.repository.ts index 1bb1ce6..fb08b6b 100755 --- a/src/modules/notifications/repositories/notifications.repository.ts +++ b/src/modules/notifications/repositories/notifications.repository.ts @@ -21,8 +21,6 @@ export class NotificationRepository extends Repository { queryBuilder.andWhere("notification.isRead = :isRead", { isRead: queryDto.isRead === 1 }); } - const [notifications, count] = await queryBuilder.orderBy("notification.createdAt", "DESC").skip(skip).take(limit).getManyAndCount(); - - return { notifications, count, paginate: true }; + return queryBuilder.orderBy("notification.createdAt", "DESC").skip(skip).take(limit).getManyAndCount(); } }