feat: rename js files to ts
This commit is contained in:

committed by
kolaente

parent
4cff3ebee1
commit
15b67136fe
36
src/services/namespace.ts
Normal file
36
src/services/namespace.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import AbstractService from './abstractService'
|
||||
import NamespaceModel from '../models/namespace'
|
||||
import {formatISO} from 'date-fns'
|
||||
import {colorFromHex} from '@/helpers/color/colorFromHex'
|
||||
|
||||
export default class NamespaceService extends AbstractService {
|
||||
constructor() {
|
||||
super({
|
||||
create: '/namespaces',
|
||||
get: '/namespaces/{id}',
|
||||
getAll: '/namespaces',
|
||||
update: '/namespaces/{id}',
|
||||
delete: '/namespaces/{id}',
|
||||
})
|
||||
}
|
||||
|
||||
processModel(model) {
|
||||
model.created = formatISO(new Date(model.created))
|
||||
model.updated = formatISO(new Date(model.updated))
|
||||
return model
|
||||
}
|
||||
|
||||
modelFactory(data) {
|
||||
return new NamespaceModel(data)
|
||||
}
|
||||
|
||||
beforeUpdate(namespace) {
|
||||
namespace.hexColor = colorFromHex(namespace.hexColor)
|
||||
return namespace
|
||||
}
|
||||
|
||||
beforeCreate(namespace) {
|
||||
namespace.hexColor = colorFromHex(namespace.hexColor)
|
||||
return namespace
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user