4a413e7f3c
Change all snake/camelCase mix and match to camelCase everywhere Fix conversion to not interfer with service interceptors Add dynamic conversion between camelCase and snake_case to services Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/105
35 lines
No EOL
780 B
JavaScript
35 lines
No EOL
780 B
JavaScript
import AbstractService from './abstractService'
|
|
import NamespaceModel from '../models/namespace'
|
|
import {formatISO} from 'date-fns'
|
|
|
|
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(model.created)
|
|
model.updated = formatISO(model.updated)
|
|
return model
|
|
}
|
|
|
|
modelFactory(data) {
|
|
return new NamespaceModel(data)
|
|
}
|
|
|
|
beforeUpdate(namespace) {
|
|
namespace.hexColor = namespace.hexColor.substring(1, 7)
|
|
return namespace
|
|
}
|
|
|
|
beforeCreate(namespace) {
|
|
namespace.hexColor = namespace.hexColor.substring(1, 7)
|
|
return namespace
|
|
}
|
|
} |