chore: add notification count to user get all notification

This commit is contained in:
mahyargdz
2025-05-31 16:08:54 +03:30
parent 74eede394e
commit 3f3d4d976a
2 changed files with 4 additions and 4 deletions
@@ -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 };
}
//************************ */
@@ -21,8 +21,6 @@ export class NotificationRepository extends Repository<Notification> {
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();
}
}