| 12345678910111213141516171819202122232425262728 |
- 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<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
|