vikunja-frontend/src/models/bucket.ts
Dominik Pschenitschni 1a11b43ca8 feat: improve models
2022-09-13 14:59:02 +00:00

32 lines
No EOL
769 B
TypeScript

import AbstractModel from './abstractModel'
import UserModel from './user'
import TaskModel from './task'
import type {IBucket} from '@/modelTypes/IBucket'
import type {ITask} from '@/modelTypes/ITask'
import type {IUser} from '@/modelTypes/IUser'
export default class BucketModel extends AbstractModel<IBucket> implements IBucket {
id = 0
title = ''
listId = ''
limit = 0
tasks: ITask[] = []
isDoneBucket = false
position = 0
createdBy: IUser = null
created: Date = null
updated: Date = null
constructor(data: Partial<IBucket>) {
super()
this.assignData(data)
this.tasks = this.tasks.map(t => new TaskModel(t))
this.createdBy = new UserModel(this.createdBy)
this.created = new Date(this.created)
this.updated = new Date(this.updated)
}
}