1
0

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: https://kolaente.dev/vikunja/frontend/pulls/105
This commit is contained in:
konrad
2020-04-12 21:54:46 +00:00
parent de36296bac
commit 4a413e7f3c
60 changed files with 296 additions and 189 deletions

View File

@ -52,7 +52,7 @@
</div>
</td>
<td>
{{ s.shared_by.username }}
{{ s.sharedBy.username }}
</td>
<td class="type">
<template v-if="s.right === rights.ADMIN">
@ -145,7 +145,7 @@
return
}
this.linkShareService.getAll({listID: this.listID})
this.linkShareService.getAll({listId: this.listID})
.then(r => {
this.linkShares = r
})
@ -154,7 +154,7 @@
})
},
add() {
let newLinkShare = new LinkShareModel({right: this.selectedRight, listID: this.listID})
let newLinkShare = new LinkShareModel({right: this.selectedRight, listId: this.listID})
this.linkShareService.create(newLinkShare)
.then(() => {
this.selectedRight = rights.READ
@ -166,7 +166,7 @@
})
},
remove() {
let linkshare = new LinkShareModel({id: this.linkIDToDelete, listID: this.listID})
let linkshare = new LinkShareModel({id: this.linkIDToDelete, listId: this.listID})
this.linkShareService.delete(linkshare)
.then(() => {
this.success({message: 'The link share was successfully deleted'}, this)

View File

@ -28,7 +28,7 @@
auth.linkShareAuth(this.$route.params.share)
.then((r) => {
this.loading = false
router.push({name: 'showList', params: {id: r.list_id}})
router.push({name: 'showList', params: {id: r.listId}})
})
.catch(e => {
this.error(e, this)

View File

@ -175,7 +175,7 @@
if (this.type === 'list') {
this.typeString = `list`
this.stuffService = new UserListService()
this.stuffModel = new UserListModel({listID: this.id})
this.stuffModel = new UserListModel({listId: this.id})
} else if (this.type === 'namespace') {
this.typeString = `namespace`
this.stuffService = new UserNamespaceService()
@ -192,7 +192,7 @@
if (this.type === 'list') {
this.typeString = `list`
this.stuffService = new TeamListService()
this.stuffModel = new TeamListModel({listID: this.id})
this.stuffModel = new TeamListModel({listId: this.id})
} else if (this.type === 'namespace') {
this.typeString = `namespace`
this.stuffService = new TeamNamespaceService()
@ -219,17 +219,17 @@
deleteSharable() {
if (this.shareType === 'user') {
this.stuffModel.userID = this.sharable.username
this.stuffModel.userId = this.sharable.username
} else if (this.shareType === 'team') {
this.stuffModel.teamID = this.sharable.id
this.stuffModel.teamId = this.sharable.id
}
this.stuffService.delete(this.stuffModel)
.then(() => {
this.showDeleteModal = false
for (const i in this.sharables) {
if (
(this.sharables[i].id === this.stuffModel.userID && this.shareType === 'user') ||
(this.sharables[i].id === this.stuffModel.teamID && this.shareType === 'team')
(this.sharables[i].id === this.stuffModel.userId && this.shareType === 'user') ||
(this.sharables[i].id === this.stuffModel.teamId && this.shareType === 'team')
) {
this.sharables.splice(i, 1)
}
@ -250,9 +250,9 @@
}
if (this.shareType === 'user') {
this.stuffModel.userID = this.sharable.username
this.stuffModel.userId = this.sharable.username
} else if (this.shareType === 'team') {
this.stuffModel.teamID = this.sharable.id
this.stuffModel.teamId = this.sharable.id
}
this.stuffService.create(this.stuffModel)
@ -275,17 +275,17 @@
if (this.shareType === 'user') {
this.stuffModel.userID = sharable.username
this.stuffModel.userId = sharable.username
} else if (this.shareType === 'team') {
this.stuffModel.teamID = sharable.id
this.stuffModel.teamId = sharable.id
}
this.stuffService.update(this.stuffModel)
.then(r => {
for (const i in this.sharables) {
if (
(this.sharables[i].id === this.stuffModel.userID && this.shareType === 'user') ||
(this.sharables[i].id === this.stuffModel.teamID && this.shareType === 'team')
(this.sharables[i].id === this.stuffModel.userId && this.shareType === 'user') ||
(this.sharables[i].id === this.stuffModel.teamId && this.shareType === 'team')
) {
this.$set(this.sharables[i], 'right', r.right)
}