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