chore: first

This commit is contained in:
Mahyargdz
2025-05-11 10:27:30 +03:30
commit 4e563c497d
102 changed files with 18602 additions and 0 deletions
@@ -0,0 +1,19 @@
import { EntityRepository } from "@mikro-orm/postgresql";
import { PaginationUtils } from "../../utils/providers/pagination.utils";
import { SearchNotificationQueryDto } from "../DTO/search-notification-query.dto";
import { Notification } from "../entities/notification.entity";
export class NotificationRepository extends EntityRepository<Notification> {
async getAllNotifications(queryDto: SearchNotificationQueryDto, recipientId: string) {
const { skip, limit } = PaginationUtils(queryDto);
const qb = this.qb("notification").where({ recipientId });
if (queryDto.isRead !== undefined) {
qb.andWhere({ isRead: queryDto.isRead === 1 });
}
return qb.orderBy({ createdAt: "DESC" }).offset(skip).limit(limit).getResultAndCount();
}
}