Subscriptions and notifications for namespaces, tasks and lists (#410)
Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/410 Co-authored-by: konrad <konrad@kola-entertainments.de> Co-committed-by: konrad <konrad@kola-entertainments.de>
This commit is contained in:
@ -2,6 +2,7 @@ import AbstractModel from './abstractModel'
|
||||
import TaskModel from './task'
|
||||
import UserModel from './user'
|
||||
import {getSavedFilterIdFromListId} from '@/helpers/savedFilter'
|
||||
import SubscriptionModel from '@/models/subscription'
|
||||
|
||||
export default class ListModel extends AbstractModel {
|
||||
|
||||
@ -19,6 +20,10 @@ export default class ListModel extends AbstractModel {
|
||||
|
||||
this.owner = new UserModel(this.owner)
|
||||
|
||||
if(typeof this.subscription !== 'undefined' && this.subscription !== null) {
|
||||
this.subscription = new SubscriptionModel(this.subscription)
|
||||
}
|
||||
|
||||
this.created = new Date(this.created)
|
||||
this.updated = new Date(this.updated)
|
||||
}
|
||||
@ -37,6 +42,7 @@ export default class ListModel extends AbstractModel {
|
||||
identifier: '',
|
||||
backgroundInformation: null,
|
||||
isFavorite: false,
|
||||
subscription: null,
|
||||
|
||||
created: null,
|
||||
updated: null,
|
||||
|
@ -1,6 +1,7 @@
|
||||
import AbstractModel from './abstractModel'
|
||||
import ListModel from './list'
|
||||
import UserModel from './user'
|
||||
import SubscriptionModel from '@/models/subscription'
|
||||
|
||||
export default class NamespaceModel extends AbstractModel {
|
||||
constructor(data) {
|
||||
@ -13,8 +14,13 @@ export default class NamespaceModel extends AbstractModel {
|
||||
this.lists = this.lists.map(l => {
|
||||
return new ListModel(l)
|
||||
})
|
||||
|
||||
this.owner = new UserModel(this.owner)
|
||||
|
||||
if(typeof this.subscription !== 'undefined' && this.subscription !== null) {
|
||||
this.subscription = new SubscriptionModel(this.subscription)
|
||||
}
|
||||
|
||||
this.created = new Date(this.created)
|
||||
this.updated = new Date(this.updated)
|
||||
}
|
||||
@ -29,6 +35,7 @@ export default class NamespaceModel extends AbstractModel {
|
||||
lists: [],
|
||||
isArchived: false,
|
||||
hexColor: '',
|
||||
subscription: null,
|
||||
|
||||
created: null,
|
||||
updated: null,
|
||||
|
20
src/models/subscription.js
Normal file
20
src/models/subscription.js
Normal file
@ -0,0 +1,20 @@
|
||||
import AbstractModel from '@/models/abstractModel'
|
||||
import UserModel from '@/models/user'
|
||||
|
||||
export default class SubscriptionModel extends AbstractModel {
|
||||
constructor(data) {
|
||||
super(data)
|
||||
this.user = new UserModel(this.user)
|
||||
this.created = new Date(this.created)
|
||||
}
|
||||
|
||||
defaults() {
|
||||
return {
|
||||
id: 0,
|
||||
entity: '',
|
||||
entityId: 0,
|
||||
created: null,
|
||||
user: {},
|
||||
}
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ import AbstractModel from './abstractModel'
|
||||
import UserModel from './user'
|
||||
import LabelModel from './label'
|
||||
import AttachmentModel from './attachment'
|
||||
import SubscriptionModel from '@/models/subscription'
|
||||
|
||||
const parseDate = date => {
|
||||
if (date && !date.startsWith('0001')) {
|
||||
@ -75,6 +76,10 @@ export default class TaskModel extends AbstractModel {
|
||||
this.identifier = ''
|
||||
}
|
||||
|
||||
if(typeof this.subscription !== 'undefined' && this.subscription !== null) {
|
||||
this.subscription = new SubscriptionModel(this.subscription)
|
||||
}
|
||||
|
||||
this.created = new Date(this.created)
|
||||
this.updated = new Date(this.updated)
|
||||
}
|
||||
@ -104,6 +109,7 @@ export default class TaskModel extends AbstractModel {
|
||||
identifier: '',
|
||||
index: 0,
|
||||
isFavorite: false,
|
||||
subscription: null,
|
||||
|
||||
createdBy: UserModel,
|
||||
created: null,
|
||||
|
Reference in New Issue
Block a user