import type { Collection } from 'pinia-orm' import Notification from '~/models/Core/Notification' import BaseRepository from '~/stores/repositories/BaseRepository' class NotificationRepository extends BaseRepository { use = Notification /** * On récupère les Notifications via le store */ public getNotifications(): Collection { return this.getQuery() .orderBy('createDate', 'desc') .get() as Collection } /** * Retourne les notifications non lues */ public getUnreadNotifications(): Collection { return this.getQuery() .where((val) => val.notificationUsers?.length === 0) .orderBy('createDate', 'desc') .get() as Collection } } export default NotificationRepository