This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
frontend/src/services/notification.ts

24 lines
608 B
TypeScript

import AbstractService from '@/services/abstractService'
import NotificationModel from '@/models/notification'
import type {INotification} from '@/modelTypes/INotification'
const paths = {
getAll: '/notifications',
update: '/notifications/{id}',
} as const
export default class NotificationService extends AbstractService<INotification, typeof paths> {
constructor() {
super(paths)
}
modelFactory(data) {
return new NotificationModel(data)
}
beforeUpdate(model) {
model.created = new Date(model.created).toISOString()
model.readAt = new Date(model.readAt).toISOString()
return model
}
}