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:
@ -33,7 +33,7 @@
|
||||
<td>{{ a.file.getHumanSize() }}</td>
|
||||
<td>{{ a.file.mime }}</td>
|
||||
<td v-tooltip="formatDate(a.created)">{{ formatDateSince(a.created) }}</td>
|
||||
<td><user :user="a.created_by" :avatar-size="30"/></td>
|
||||
<td><user :user="a.createdBy" :avatar-size="30"/></td>
|
||||
<td>
|
||||
<div class="buttons has-addons">
|
||||
<a class="button is-primary noshadow" @click="downloadAttachment(a)" v-tooltip="'Download this attachment'">
|
||||
@ -153,7 +153,7 @@
|
||||
this.uploadFiles(this.$refs.files.files)
|
||||
},
|
||||
uploadFiles(files) {
|
||||
const attachmentModel = new AttachmentModel({task_id: this.taskID})
|
||||
const attachmentModel = new AttachmentModel({taskId: this.taskID})
|
||||
this.attachmentService.create(attachmentModel, files)
|
||||
.then(r => {
|
||||
if(r.success !== null) {
|
||||
|
@ -94,9 +94,9 @@
|
||||
},
|
||||
created() {
|
||||
this.taskCommentService = new TaskCommentService()
|
||||
this.newComment = new TaskCommentModel({task_id: this.taskID})
|
||||
this.commentEdit = new TaskCommentModel({task_id: this.taskID})
|
||||
this.commentToDelete = new TaskCommentModel({task_id: this.taskID})
|
||||
this.newComment = new TaskCommentModel({taskId: this.taskID})
|
||||
this.commentEdit = new TaskCommentModel({taskId: this.taskID})
|
||||
this.commentToDelete = new TaskCommentModel({taskId: this.taskID})
|
||||
this.comments = []
|
||||
},
|
||||
mounted() {
|
||||
@ -109,7 +109,7 @@
|
||||
},
|
||||
methods: {
|
||||
loadComments() {
|
||||
this.taskCommentService.getAll({task_id: this.taskID})
|
||||
this.taskCommentService.getAll({taskId: this.taskID})
|
||||
.then(r => {
|
||||
this.$set(this, 'comments', r)
|
||||
})
|
||||
@ -143,7 +143,7 @@
|
||||
if (this.commentEdit.comment === '') {
|
||||
return
|
||||
}
|
||||
this.commentEdit.task_id = this.taskID
|
||||
this.commentEdit.taskId = this.taskID
|
||||
this.taskCommentService.update(this.commentEdit)
|
||||
.then(r => {
|
||||
for (const c in this.comments) {
|
||||
|
@ -84,7 +84,7 @@
|
||||
},
|
||||
methods: {
|
||||
addAssignee(user) {
|
||||
const taskAssignee = new TaskAssigneeModel({user_id: user.id, task_id: this.taskID})
|
||||
const taskAssignee = new TaskAssigneeModel({userId: user.id, taskId: this.taskID})
|
||||
this.taskAssigneeService.create(taskAssignee)
|
||||
.then(() => {
|
||||
this.success({message: 'The user was successfully assigned.'}, this)
|
||||
@ -94,7 +94,7 @@
|
||||
})
|
||||
},
|
||||
removeAssignee(user) {
|
||||
const taskAssignee = new TaskAssigneeModel({user_id: user.id, task_id: this.taskID})
|
||||
const taskAssignee = new TaskAssigneeModel({userId: user.id, taskId: this.taskID})
|
||||
this.taskAssigneeService.delete(taskAssignee)
|
||||
.then(() => {
|
||||
// Remove the assignee from the list
|
||||
@ -115,7 +115,7 @@
|
||||
return
|
||||
}
|
||||
|
||||
this.listUserService.getAll({listID: this.listID}, {s: query})
|
||||
this.listUserService.getAll({listId: this.listID}, {s: query})
|
||||
.then(response => {
|
||||
// Filter the results to not include users who are already assigned
|
||||
this.$set(this, 'foundUsers', differenceWith(response, this.assignees, (first, second) => {
|
||||
|
@ -22,7 +22,7 @@
|
||||
>
|
||||
<template slot="tag" slot-scope="{ option }">
|
||||
<span class="tag"
|
||||
:style="{'background': option.hex_color, 'color': option.textColor}">
|
||||
:style="{'background': option.hexColor, 'color': option.textColor}">
|
||||
<span>{{ option.title }}</span>
|
||||
<a class="delete is-small" @click="removeLabel(option)"></a>
|
||||
</span>
|
||||
@ -108,7 +108,7 @@
|
||||
this.$set(this, 'foundLabels', [])
|
||||
},
|
||||
addLabel(label) {
|
||||
let labelTask = new LabelTaskModel({taskID: this.taskID, label_id: label.id})
|
||||
let labelTask = new LabelTaskModel({taskID: this.taskID, labelId: label.id})
|
||||
this.labelTaskService.create(labelTask)
|
||||
.then(() => {
|
||||
this.success({message: 'The label was successfully added.'}, this)
|
||||
@ -119,7 +119,7 @@
|
||||
})
|
||||
},
|
||||
removeLabel(label) {
|
||||
let labelTask = new LabelTaskModel({taskID: this.taskID, label_id: label.id})
|
||||
let labelTask = new LabelTaskModel({taskID: this.taskID, labelId: label.id})
|
||||
this.labelTaskService.delete(labelTask)
|
||||
.then(() => {
|
||||
// Remove the label from the list
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="label-wrapper">
|
||||
<span class="tag" v-for="label in labels" :style="{'background': label.hex_color, 'color': label.textColor}" :key="label.id">
|
||||
<span class="tag" v-for="label in labels" :style="{'background': label.hexColor, 'color': label.textColor}" :key="label.id">
|
||||
<span>{{ label.title }}</span>
|
||||
</span>
|
||||
</div>
|
||||
|
@ -54,7 +54,7 @@
|
||||
{{t.text}}
|
||||
</span>
|
||||
</router-link>
|
||||
<a class="remove" @click="() => {showDeleteModal = true; relationToDelete = {relation_kind: kind, other_task_id: t.id}}">
|
||||
<a class="remove" @click="() => {showDeleteModal = true; relationToDelete = {relationKind: kind, otherTaskId: t.id}}">
|
||||
<icon icon="trash-alt"/>
|
||||
</a>
|
||||
</div>
|
||||
@ -156,9 +156,9 @@
|
||||
},
|
||||
addTaskRelation() {
|
||||
let rel = new TaskRelationModel({
|
||||
task_id: this.taskID,
|
||||
other_task_id: this.newTaskRelationTask.id,
|
||||
relation_kind: this.newTaskRelationKind,
|
||||
taskId: this.taskID,
|
||||
otherTaskId: this.newTaskRelationTask.id,
|
||||
relationKind: this.newTaskRelationKind,
|
||||
})
|
||||
this.taskRelationService.create(rel)
|
||||
.then(() => {
|
||||
@ -176,15 +176,15 @@
|
||||
},
|
||||
removeTaskRelation() {
|
||||
let rel = new TaskRelationModel({
|
||||
relation_kind: this.relationToDelete.relation_kind,
|
||||
task_id: this.taskID,
|
||||
other_task_id: this.relationToDelete.other_task_id,
|
||||
relationKind: this.relationToDelete.relationKind,
|
||||
taskId: this.taskID,
|
||||
otherTaskId: this.relationToDelete.otherTaskId,
|
||||
})
|
||||
this.taskRelationService.delete(rel)
|
||||
.then(r => {
|
||||
Object.keys(this.relatedTasks).forEach(relationKind => {
|
||||
for (const t in this.relatedTasks[relationKind]) {
|
||||
if (this.relatedTasks[relationKind][t].id === this.relationToDelete.other_task_id && relationKind === this.relationToDelete.relation_kind) {
|
||||
if (this.relatedTasks[relationKind][t].id === this.relationToDelete.otherTaskId && relationKind === this.relationToDelete.relationKind) {
|
||||
this.relatedTasks[relationKind].splice(t, 1)
|
||||
}
|
||||
}
|
||||
@ -199,7 +199,7 @@
|
||||
})
|
||||
},
|
||||
createAndRelateTask(text) {
|
||||
const newTask = new TaskModel({text: text, listID: this.listId})
|
||||
const newTask = new TaskModel({text: text, listId: this.listId})
|
||||
this.taskService.create(newTask)
|
||||
.then(r => {
|
||||
this.newTaskRelationTask = r
|
||||
|
@ -3,9 +3,9 @@
|
||||
<fancycheckbox v-model="task.done" @change="markAsDone" :disabled="isArchived"/>
|
||||
<router-link :to="{ name: 'taskDetailView', params: { id: task.id } }" class="tasktext" :class="{ 'done': task.done}">
|
||||
<!-- Show any parent tasks to make it clear this task is a sub task of something -->
|
||||
<span class="parent-tasks" v-if="typeof task.related_tasks.parenttask !== 'undefined'">
|
||||
<template v-for="(pt, i) in task.related_tasks.parenttask">
|
||||
{{ pt.text }}<template v-if="(i + 1) < task.related_tasks.parenttask.length">, </template>
|
||||
<span class="parent-tasks" v-if="typeof task.relatedTasks.parenttask !== 'undefined'">
|
||||
<template v-for="(pt, i) in task.relatedTasks.parenttask">
|
||||
{{ pt.text }}<template v-if="(i + 1) < task.relatedTasks.parenttask.length">, </template>
|
||||
</template>
|
||||
>
|
||||
</span>
|
||||
|
Reference in New Issue
Block a user