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/userList.js
konrad 4a413e7f3c
All checks were successful
continuous-integration/drone/push Build is passing
Make all api fields snake_case (#105)
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: #105
2020-04-12 21:54:46 +00:00

29 lines
679 B
JavaScript

import AbstractService from './abstractService'
import UserListModel from '../models/userList'
import UserModel from '../models/user'
import {formatISO} from 'date-fns'
export default class UserListService extends AbstractService {
constructor() {
super({
create: '/lists/{listId}/users',
getAll: '/lists/{listId}/users',
update: '/lists/{listId}/users/{userId}',
delete: '/lists/{listId}/users/{userId}',
})
}
processModel(model) {
model.created = formatISO(model.created)
model.updated = formatISO(model.updated)
return model
}
modelFactory(data) {
return new UserListModel(data)
}
modelGetAllFactory(data) {
return new UserModel(data)
}
}