2021-02-21 15:13:58 +00:00
|
|
|
import AbstractService from '@/services/abstractService'
|
2022-09-06 09:36:01 +00:00
|
|
|
import NotificationModel from '@/models/notification'
|
|
|
|
import type {INotification} from '@/modelTypes/INotification'
|
2021-02-21 15:13:58 +00:00
|
|
|
|
2022-07-21 16:56:31 +00:00
|
|
|
export default class NotificationService extends AbstractService<INotification> {
|
2021-02-21 15:13:58 +00:00
|
|
|
constructor() {
|
|
|
|
super({
|
|
|
|
getAll: '/notifications',
|
|
|
|
update: '/notifications/{id}',
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
modelFactory(data) {
|
|
|
|
return new NotificationModel(data)
|
|
|
|
}
|
|
|
|
|
|
|
|
beforeUpdate(model) {
|
2023-01-03 14:20:06 +00:00
|
|
|
model.created = new Date(model.created).toISOString()
|
|
|
|
model.readAt = new Date(model.readAt).toISOString()
|
2021-02-21 15:13:58 +00:00
|
|
|
return model
|
|
|
|
}
|
|
|
|
}
|