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

View File

@ -68,7 +68,7 @@
<component :is="manageUsersComponent" :id="list.id" type="list" shareType="user" :userIsAdmin="userIsAdmin"></component> <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> <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 <modal
v-if="showDeleteModal" v-if="showDeleteModal"

View File

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

View File

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

View File

@ -75,7 +75,7 @@
</template> </template>
</td> </td>
<td class="actions"> <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"> <span class="icon">
<icon icon="trash-alt"/> <icon icon="trash-alt"/>
</span> </span>
@ -110,7 +110,7 @@
export default { export default {
name: 'linkSharing', name: 'linkSharing',
props: { props: {
listID: { listId: {
default: 0, default: 0,
required: true, required: true,
}, },
@ -123,7 +123,7 @@
rights: rights, rights: rights,
selectedRight: rights.READ, selectedRight: rights.READ,
showDeleteModal: false, showDeleteModal: false,
linkIDToDelete: 0, linkIdToDelete: 0,
} }
}, },
beforeMount() { beforeMount() {
@ -134,18 +134,18 @@
this.load() this.load()
}, },
watch: { watch: {
listID: () => { // watch it listId: () => { // watch it
this.load() this.load()
} }
}, },
methods: { methods: {
load() { load() {
// If listID == 0 the list on the calling component wasn't already loaded, so we just bail out here // If listId == 0 the list on the calling component wasn't already loaded, so we just bail out here
if (this.listID === 0) { if (this.listId === 0) {
return return
} }
this.linkShareService.getAll({listId: this.listID}) this.linkShareService.getAll({listId: this.listId})
.then(r => { .then(r => {
this.linkShares = r this.linkShares = r
}) })
@ -154,7 +154,7 @@
}) })
}, },
add() { 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) this.linkShareService.create(newLinkShare)
.then(() => { .then(() => {
this.selectedRight = rights.READ this.selectedRight = rights.READ
@ -166,7 +166,7 @@
}) })
}, },
remove() { 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) this.linkShareService.delete(linkshare)
.then(() => { .then(() => {
this.success({message: 'The link share was successfully deleted'}, this) this.success({message: 'The link share was successfully deleted'}, this)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -72,7 +72,7 @@
export default { export default {
name: 'comments', name: 'comments',
props: { props: {
taskID: { taskId: {
type: Number, type: Number,
required: true, required: true,
} }
@ -94,22 +94,22 @@
}, },
created() { created() {
this.taskCommentService = new TaskCommentService() this.taskCommentService = new TaskCommentService()
this.newComment = new TaskCommentModel({taskId: this.taskID}) this.newComment = new TaskCommentModel({taskId: this.taskId})
this.commentEdit = new TaskCommentModel({taskId: this.taskID}) this.commentEdit = new TaskCommentModel({taskId: this.taskId})
this.commentToDelete = new TaskCommentModel({taskId: this.taskID}) this.commentToDelete = new TaskCommentModel({taskId: this.taskId})
this.comments = [] this.comments = []
}, },
mounted() { mounted() {
this.loadComments() this.loadComments()
}, },
watch: { watch: {
taskID() { taskId() {
this.loadComments() this.loadComments()
} }
}, },
methods: { methods: {
loadComments() { loadComments() {
this.taskCommentService.getAll({taskId: this.taskID}) this.taskCommentService.getAll({taskId: this.taskId})
.then(r => { .then(r => {
this.$set(this, 'comments', r) this.$set(this, 'comments', r)
}) })
@ -143,7 +143,7 @@
if (this.commentEdit.comment === '') { if (this.commentEdit.comment === '') {
return return
} }
this.commentEdit.taskId = this.taskID this.commentEdit.taskId = this.taskId
this.taskCommentService.update(this.commentEdit) this.taskCommentService.update(this.commentEdit)
.then(r => { .then(r => {
for (const c in this.comments) { for (const c in this.comments) {

View File

@ -49,11 +49,11 @@
multiselect, multiselect,
}, },
props: { props: {
taskID: { taskId: {
type: Number, type: Number,
required: true, required: true,
}, },
listID: { listId: {
type: Number, type: Number,
required: true, required: true,
}, },
@ -84,7 +84,7 @@
}, },
methods: { methods: {
addAssignee(user) { 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) this.taskAssigneeService.create(taskAssignee)
.then(() => { .then(() => {
this.success({message: 'The user was successfully assigned.'}, this) this.success({message: 'The user was successfully assigned.'}, this)
@ -94,7 +94,7 @@
}) })
}, },
removeAssignee(user) { 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) this.taskAssigneeService.delete(taskAssignee)
.then(() => { .then(() => {
// Remove the assignee from the list // Remove the assignee from the list
@ -115,7 +115,7 @@
return return
} }
this.listUserService.getAll({listId: this.listID}, {s: query}) this.listUserService.getAll({listId: this.listId}, {s: query})
.then(response => { .then(response => {
// Filter the results to not include users who are already assigned // Filter the results to not include users who are already assigned
this.$set(this, 'foundUsers', differenceWith(response, this.assignees, (first, second) => { this.$set(this, 'foundUsers', differenceWith(response, this.assignees, (first, second) => {

View File

@ -50,7 +50,7 @@
default: () => [], default: () => [],
type: Array, type: Array,
}, },
taskID: { taskId: {
type: Number, type: Number,
required: true, required: true,
}, },
@ -108,7 +108,7 @@
this.$set(this, 'foundLabels', []) this.$set(this, 'foundLabels', [])
}, },
addLabel(label) { 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) this.labelTaskService.create(labelTask)
.then(() => { .then(() => {
this.success({message: 'The label was successfully added.'}, this) this.success({message: 'The label was successfully added.'}, this)
@ -119,7 +119,7 @@
}) })
}, },
removeLabel(label) { 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) this.labelTaskService.delete(labelTask)
.then(() => { .then(() => {
// Remove the label from the list // Remove the label from the list

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,7 +21,7 @@ export default class TeamMemberService extends AbstractService {
} }
beforeCreate(model) { 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 model.admin = model.admin === null ? false : model.admin
return model return model
} }

View File

@ -6,10 +6,10 @@ import {formatISO} from 'date-fns'
export default class TeamNamespaceService extends AbstractService { export default class TeamNamespaceService extends AbstractService {
constructor() { constructor() {
super({ super({
create: '/namespaces/{namespaceID}/teams', create: '/namespaces/{namespaceId}/teams',
getAll: '/namespaces/{namespaceID}/teams', getAll: '/namespaces/{namespaceId}/teams',
update: '/namespaces/{namespaceID}/teams/{teamId}', update: '/namespaces/{namespaceId}/teams/{teamId}',
delete: '/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 { export default class UserNamespaceService extends AbstractService {
constructor() { constructor() {
super({ super({
create: '/namespaces/{namespaceID}/users', create: '/namespaces/{namespaceId}/users',
getAll: '/namespaces/{namespaceID}/users', getAll: '/namespaces/{namespaceId}/users',
update: '/namespaces/{namespaceID}/users/{userId}', update: '/namespaces/{namespaceId}/users/{userId}',
delete: '/namespaces/{namespaceID}/users/{userId}', delete: '/namespaces/{namespaceId}/users/{userId}',
}) })
} }