feat: add properties to models

This commit is contained in:
Dominik Pschenitschni 2022-06-23 03:22:21 +02:00
parent 74ad6e65e8
commit 797de0c543
No known key found for this signature in database
GPG key ID: B257AC0149F43A77
33 changed files with 367 additions and 186 deletions

View file

@ -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)
}