Fix id params not being named correctly

This commit is contained in:
kolaente 2020-04-17 12:19:53 +02:00
parent 588b87fb96
commit e7c1c98c6a
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
25 changed files with 74 additions and 74 deletions

View File

@ -74,7 +74,7 @@ const getBearerToken = async () => {
// Notification action
self.addEventListener('notificationclick', function(event) {
const taskID = event.notification.data.taskID
const taskId = event.notification.data.taskId
event.notification.close()
switch (event.action) {
@ -87,14 +87,14 @@ self.addEventListener('notificationclick', function(event) {
getBearerToken()
.then(token => {
fetch(`${config.VIKUNJA_API_BASE_URL}tasks/${taskID}`, {
fetch(`${config.VIKUNJA_API_BASE_URL}tasks/${taskId}`, {
method: 'post',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`,
},
body: JSON.stringify({id: taskID, done: true})
body: JSON.stringify({id: taskId, done: true})
})
.then(r => r.json())
.then(r => {
@ -107,7 +107,7 @@ self.addEventListener('notificationclick', function(event) {
})
break
case 'show-task':
clients.openWindow(`/tasks/${taskID}`)
clients.openWindow(`/tasks/${taskId}`)
break
}
})

View File

@ -68,7 +68,7 @@
<component :is="manageUsersComponent" :id="list.id" type="list" shareType="user" :userIsAdmin="userIsAdmin"></component>
<component :is="manageTeamsComponent" :id="list.id" type="list" shareType="team" :userIsAdmin="userIsAdmin"></component>
<link-sharing :list-i-d="$route.params.id"/>
<link-sharing :list-id="$route.params.id"/>
<modal
v-if="showDeleteModal"

View File

@ -65,7 +65,7 @@
}
this.showError = false
this.list.namespaceID = this.$route.params.id
this.list.namespaceId = this.$route.params.id
this.listService.create(this.list)
.then(response => {
this.$parent.loadNamespaces()

View File

@ -37,7 +37,7 @@
export default {
data() {
return {
listID: this.$route.params.id,
listId: this.$route.params.id,
listService: ListService,
list: ListModel,
}

View File

@ -75,7 +75,7 @@
</template>
</td>
<td class="actions">
<button @click="linkIDToDelete = s.id; showDeleteModal = true" class="button is-danger icon-only">
<button @click="linkIdToDelete = s.id; showDeleteModal = true" class="button is-danger icon-only">
<span class="icon">
<icon icon="trash-alt"/>
</span>
@ -110,7 +110,7 @@
export default {
name: 'linkSharing',
props: {
listID: {
listId: {
default: 0,
required: true,
},
@ -123,7 +123,7 @@
rights: rights,
selectedRight: rights.READ,
showDeleteModal: false,
linkIDToDelete: 0,
linkIdToDelete: 0,
}
},
beforeMount() {
@ -134,18 +134,18 @@
this.load()
},
watch: {
listID: () => { // watch it
listId: () => { // watch it
this.load()
}
},
methods: {
load() {
// If listID == 0 the list on the calling component wasn't already loaded, so we just bail out here
if (this.listID === 0) {
// If listId == 0 the list on the calling component wasn't already loaded, so we just bail out here
if (this.listId === 0) {
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

@ -179,7 +179,7 @@
} else if (this.type === 'namespace') {
this.typeString = `namespace`
this.stuffService = new UserNamespaceService()
this.stuffModel = new UserNamespaceModel({namespaceID: this.id})
this.stuffModel = new UserNamespaceModel({namespaceId: this.id})
} else {
throw new Error('Unknown type: ' + this.type)
}
@ -196,7 +196,7 @@
} else if (this.type === 'namespace') {
this.typeString = `namespace`
this.stuffService = new TeamNamespaceService()
this.stuffModel = new TeamNamespaceModel({namespaceID: this.id})
this.stuffModel = new TeamNamespaceModel({namespaceId: this.id})
} else {
throw new Error('Unknown type: ' + this.type)
}

View File

@ -113,7 +113,7 @@
name: 'ListView',
data() {
return {
listID: this.$route.params.id,
listId: this.$route.params.id,
taskService: TaskService,
list: {},
isTaskEdit: false,
@ -172,11 +172,11 @@
},
editTask(id) {
// Find the selected task and set it to the current object
let theTask = this.getTaskByID(id) // Somehow this does not work if we directly assign this to this.taskEditTask
let theTask = this.getTaskById(id) // Somehow this does not work if we directly assign this to this.taskEditTask
this.taskEditTask = theTask
this.isTaskEdit = true
},
getTaskByID(id) {
getTaskById(id) {
for (const t in this.tasks) {
if (this.tasks[t].id === parseInt(id)) {
return this.tasks[t]

View File

@ -27,8 +27,8 @@
Assignees
</div>
<edit-assignees
:task-i-d="task.id"
:list-i-d="task.listId"
:task-id="task.id"
:list-id="task.listId"
:initial-assignees="task.assignees"
ref="assignees"
/>
@ -150,7 +150,7 @@
</span>
Labels
</div>
<edit-labels :task-i-d="taskID" v-model="task.labels" ref="labels"/>
<edit-labels :task-id="taskId" v-model="task.labels" ref="labels"/>
</div>
<!-- Description -->
@ -177,7 +177,7 @@
<!-- Attachments -->
<div class="content attachments has-top-border" v-if="activeFields.attachments">
<attachments
:task-i-d="taskID"
:task-id="taskId"
:initial-attachments="task.attachments"
ref="attachments"
/>
@ -192,7 +192,7 @@
Related Tasks
</h3>
<related-tasks
:task-i-d="taskID"
:task-id="taskId"
:list-id="task.listId"
:initial-related-tasks="task.relatedTasks"
:show-no-relations-notice="true"
@ -201,7 +201,7 @@
</div>
<!-- Comments -->
<comments :task-i-d="taskID"/>
<comments :task-id="taskId"/>
</div>
<div class="column is-one-fifth action-buttons">
<a class="button is-outlined noshadow has-no-border" :class="{'is-success': !task.done}" @click="toggleTaskDone()">
@ -319,7 +319,7 @@
},
data() {
return {
taskID: Number(this.$route.params.id),
taskId: Number(this.$route.params.id),
taskService: TaskService,
task: TaskModel,
relationKinds: relationKinds,
@ -365,8 +365,8 @@
},
methods: {
loadTask() {
this.taskID = Number(this.$route.params.id)
this.taskService.get({id: this.taskID})
this.taskId = Number(this.$route.params.id)
this.taskService.get({id: this.taskId})
.then(r => {
this.$set(this, 'task', r)
this.setListAndNamespaceTitleFromParent()

View File

@ -114,20 +114,20 @@
<div class="field has-addons">
<div class="control is-expanded">
<edit-assignees :task-i-d="taskEditTask.id" :list-i-d="taskEditTask.listId" :initial-assignees="taskEditTask.assignees"/>
<edit-assignees :task-id="taskEditTask.id" :list-id="taskEditTask.listId" :initial-assignees="taskEditTask.assignees"/>
</div>
</div>
<div class="field">
<label class="label">Labels</label>
<div class="control">
<edit-labels :task-i-d="taskEditTask.id" v-model="taskEditTask.labels"/>
<edit-labels :task-id="taskEditTask.id" v-model="taskEditTask.labels"/>
</div>
</div>
<related-tasks
class="is-narrow"
:task-i-d="task.id"
:task-id="task.id"
:list-id="task.listId"
:initial-related-tasks="task.relatedTasks"
/>
@ -161,7 +161,7 @@
name: 'edit-task',
data() {
return {
listID: this.$route.params.id,
listId: this.$route.params.id,
listService: ListService,
taskService: TaskService,

View File

@ -96,7 +96,7 @@
}
},
props: {
taskID: {
taskId: {
required: true,
type: Number,
},
@ -153,7 +153,7 @@
this.uploadFiles(this.$refs.files.files)
},
uploadFiles(files) {
const attachmentModel = new AttachmentModel({taskId: this.taskID})
const attachmentModel = new AttachmentModel({taskId: this.taskId})
this.attachmentService.create(attachmentModel, files)
.then(r => {
if(r.success !== null) {

View File

@ -72,7 +72,7 @@
export default {
name: 'comments',
props: {
taskID: {
taskId: {
type: Number,
required: true,
}
@ -94,22 +94,22 @@
},
created() {
this.taskCommentService = new TaskCommentService()
this.newComment = new TaskCommentModel({taskId: this.taskID})
this.commentEdit = new TaskCommentModel({taskId: this.taskID})
this.commentToDelete = new TaskCommentModel({taskId: 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() {
this.loadComments()
},
watch: {
taskID() {
taskId() {
this.loadComments()
}
},
methods: {
loadComments() {
this.taskCommentService.getAll({taskId: 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.taskId = this.taskID
this.commentEdit.taskId = this.taskId
this.taskCommentService.update(this.commentEdit)
.then(r => {
for (const c in this.comments) {

View File

@ -49,11 +49,11 @@
multiselect,
},
props: {
taskID: {
taskId: {
type: Number,
required: true,
},
listID: {
listId: {
type: Number,
required: true,
},
@ -84,7 +84,7 @@
},
methods: {
addAssignee(user) {
const taskAssignee = new TaskAssigneeModel({userId: user.id, taskId: 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({userId: user.id, taskId: 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) => {

View File

@ -50,7 +50,7 @@
default: () => [],
type: Array,
},
taskID: {
taskId: {
type: Number,
required: true,
},
@ -108,7 +108,7 @@
this.$set(this, 'foundLabels', [])
},
addLabel(label) {
let labelTask = new LabelTaskModel({taskID: this.taskID, labelId: 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, labelId: label.id})
let labelTask = new LabelTaskModel({taskId: this.taskId, labelId: label.id})
this.labelTaskService.delete(labelTask)
.then(() => {
// Remove the label from the list

View File

@ -105,7 +105,7 @@
multiselect,
},
props: {
taskID: {
taskId: {
type: Number,
required: true,
},
@ -156,7 +156,7 @@
},
addTaskRelation() {
let rel = new TaskRelationModel({
taskId: this.taskID,
taskId: this.taskId,
otherTaskId: this.newTaskRelationTask.id,
relationKind: this.newTaskRelationKind,
})
@ -177,7 +177,7 @@
removeTaskRelation() {
let rel = new TaskRelationModel({
relationKind: this.relationToDelete.relationKind,
taskId: this.taskID,
taskId: this.taskId,
otherTaskId: this.relationToDelete.otherTaskId,
})
this.taskRelationService.delete(rel)

View File

@ -4,7 +4,7 @@ export default class LabelTask extends AbstractModel {
defaults() {
return {
id: 0,
taskID: 0,
taskId: 0,
labelId: 0,
}
}

View File

@ -21,7 +21,7 @@ export default class ListModel extends AbstractModel {
right: 0,
sharedBy: UserModel,
sharingType: 0,
listID: 0,
listId: 0,
created: null,
updated: null,

View File

@ -30,7 +30,7 @@ export default class ListModel extends AbstractModel {
description: '',
owner: UserModel,
tasks: [],
namespaceID: 0,
namespaceId: 0,
isArchived: false,
hexColor: '',

View File

@ -80,7 +80,7 @@ export default class TaskModel extends AbstractModel {
endDate: 0,
repeatAfter: 0,
reminderDates: [],
parentTaskID: 0,
parentTaskId: 0,
hexColor: '',
percentDone: 0,
relatedTasks: {},
@ -196,7 +196,7 @@ export default class TaskModel extends AbstractModel {
showTrigger: new TimestampTrigger(date),
badge: '/images/icons/badge-monochrome.png',
icon: '/images/icons/android-chrome-512x512.png',
data: {taskID: this.id},
data: {taskId: this.id},
actions: [
{
action: 'mark-as-done',

View File

@ -6,7 +6,7 @@ export default class TeamNamespaceModel extends TeamShareBaseModel {
return merge(
super.defaults(),
{
namespaceID: 0,
namespaceId: 0,
}
)
}

View File

@ -7,7 +7,7 @@ export default class UserNamespaceModel extends UserShareBaseModel {
return merge(
super.defaults(),
{
namespaceID: 0,
namespaceId: 0,
}
)
}

View File

@ -4,9 +4,9 @@ import LabelTask from "../models/labelTask";
export default class LabelTaskService extends AbstractService {
constructor() {
super({
create: '/tasks/{taskID}/labels',
getAll: '/tasks/{taskID}/labels',
delete: '/tasks/{taskID}/labels/{labelId}',
create: '/tasks/{taskId}/labels',
getAll: '/tasks/{taskId}/labels',
delete: '/tasks/{taskId}/labels/{labelId}',
})
}

View File

@ -6,7 +6,7 @@ import {formatISO} from 'date-fns'
export default class ListService extends AbstractService {
constructor() {
super({
create: '/namespaces/{namespaceID}/lists',
create: '/namespaces/{namespaceId}/lists',
get: '/lists/{id}',
update: '/lists/{id}',
delete: '/lists/{id}',

View File

@ -21,7 +21,7 @@ export default class TeamMemberService extends AbstractService {
}
beforeCreate(model) {
model.userId = model.id // The api wants to get the user id as user_ID
model.userId = model.id // The api wants to get the user id as user_Id
model.admin = model.admin === null ? false : model.admin
return model
}

View File

@ -6,10 +6,10 @@ import {formatISO} from 'date-fns'
export default class TeamNamespaceService extends AbstractService {
constructor() {
super({
create: '/namespaces/{namespaceID}/teams',
getAll: '/namespaces/{namespaceID}/teams',
update: '/namespaces/{namespaceID}/teams/{teamId}',
delete: '/namespaces/{namespaceID}/teams/{teamId}',
create: '/namespaces/{namespaceId}/teams',
getAll: '/namespaces/{namespaceId}/teams',
update: '/namespaces/{namespaceId}/teams/{teamId}',
delete: '/namespaces/{namespaceId}/teams/{teamId}',
})
}

View File

@ -6,10 +6,10 @@ import {formatISO} from 'date-fns'
export default class UserNamespaceService extends AbstractService {
constructor() {
super({
create: '/namespaces/{namespaceID}/users',
getAll: '/namespaces/{namespaceID}/users',
update: '/namespaces/{namespaceID}/users/{userId}',
delete: '/namespaces/{namespaceID}/users/{userId}',
create: '/namespaces/{namespaceId}/users',
getAll: '/namespaces/{namespaceId}/users',
update: '/namespaces/{namespaceId}/users/{userId}',
delete: '/namespaces/{namespaceId}/users/{userId}',
})
}