feat: add properties to models
This commit is contained in:
parent
74ad6e65e8
commit
797de0c543
33 changed files with 367 additions and 186 deletions
|
|
@ -4,6 +4,18 @@ import UserModel from './user'
|
|||
import SubscriptionModel from '@/models/subscription'
|
||||
|
||||
export default class NamespaceModel extends AbstractModel {
|
||||
id: number
|
||||
title: string
|
||||
description: string
|
||||
owner: UserModel
|
||||
lists: ListModel[]
|
||||
isArchived: boolean
|
||||
hexColor: string
|
||||
subscription: SubscriptionModel
|
||||
|
||||
created: Date
|
||||
updated: Date
|
||||
|
||||
constructor(data) {
|
||||
super(data)
|
||||
|
||||
|
|
@ -11,7 +23,6 @@ export default class NamespaceModel extends AbstractModel {
|
|||
this.hexColor = '#' + this.hexColor
|
||||
}
|
||||
|
||||
/** @type {ListModel[]} */
|
||||
this.lists = this.lists.map(l => {
|
||||
return new ListModel(l)
|
||||
})
|
||||
|
|
@ -22,15 +33,6 @@ export default class NamespaceModel extends AbstractModel {
|
|||
this.subscription = new SubscriptionModel(this.subscription)
|
||||
}
|
||||
|
||||
/** @type {number} */
|
||||
this.id
|
||||
|
||||
/** @type {string} */
|
||||
this.title
|
||||
|
||||
/** @type {boolean} */
|
||||
this.isArchived
|
||||
|
||||
this.created = new Date(this.created)
|
||||
this.updated = new Date(this.updated)
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue