2022-08-14 12:15:09 +02:00
|
|
|
import AbstractModel, { type IAbstract } from './abstractModel'
|
2022-07-21 00:42:36 +02:00
|
|
|
import UserModel, { type IUser } from './user'
|
|
|
|
import TaskModel, { type ITask } from './task'
|
2020-04-25 23:11:34 +00:00
|
|
|
|
2022-08-14 12:15:09 +02:00
|
|
|
export interface IBucket extends IAbstract {
|
2022-06-23 03:22:21 +02:00
|
|
|
id: number
|
|
|
|
title: string
|
|
|
|
listId: number
|
|
|
|
limit: number
|
2022-07-21 00:42:36 +02:00
|
|
|
tasks: ITask[]
|
2022-06-23 03:22:21 +02:00
|
|
|
isDoneBucket: boolean
|
|
|
|
position: number
|
|
|
|
|
2022-07-21 00:42:36 +02:00
|
|
|
createdBy: IUser
|
|
|
|
created: Date
|
|
|
|
updated: Date
|
|
|
|
}
|
|
|
|
|
|
|
|
export default class BucketModel extends AbstractModel implements IBucket {
|
2022-08-14 12:15:45 +02:00
|
|
|
id = 0
|
|
|
|
title = ''
|
|
|
|
listId = ''
|
|
|
|
limit = 0
|
|
|
|
tasks: ITask[] = []
|
|
|
|
isDoneBucket: false
|
|
|
|
position: 0
|
2022-07-21 00:42:36 +02:00
|
|
|
|
2022-08-14 12:15:45 +02:00
|
|
|
createdBy: IUser = null
|
|
|
|
created: Date = null
|
|
|
|
updated: Date = null
|
2022-06-23 03:22:21 +02:00
|
|
|
|
2022-08-14 12:15:45 +02:00
|
|
|
constructor(data: Partial<IBucket>) {
|
|
|
|
super()
|
|
|
|
this.assignData(data)
|
2020-04-25 23:11:34 +00:00
|
|
|
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|