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 type { ITask } from './task'
|
2020-02-25 20:11:36 +00:00
|
|
|
|
2022-08-14 12:15:09 +02:00
|
|
|
export interface ITaskComment extends IAbstract {
|
2022-06-23 03:22:21 +02:00
|
|
|
id: number
|
2022-07-21 00:42:36 +02:00
|
|
|
taskId: ITask['id']
|
2022-06-23 03:22:21 +02:00
|
|
|
comment: string
|
2022-07-21 00:42:36 +02:00
|
|
|
author: IUser
|
|
|
|
|
|
|
|
created: Date
|
|
|
|
updated: Date
|
|
|
|
}
|
|
|
|
|
|
|
|
export default class TaskCommentModel extends AbstractModel implements ITaskComment {
|
2022-08-13 15:38:41 +02:00
|
|
|
id!: number
|
|
|
|
taskId!: ITask['id']
|
|
|
|
comment!: string
|
2022-07-21 00:42:36 +02:00
|
|
|
author: IUser
|
2022-06-23 03:22:21 +02:00
|
|
|
|
|
|
|
created: Date
|
|
|
|
updated: Date
|
|
|
|
|
2020-02-25 20:11:36 +00:00
|
|
|
constructor(data) {
|
|
|
|
super(data)
|
|
|
|
this.author = new UserModel(this.author)
|
|
|
|
this.created = new Date(this.created)
|
|
|
|
this.updated = new Date(this.updated)
|
|
|
|
}
|
|
|
|
|
|
|
|
defaults() {
|
|
|
|
return {
|
|
|
|
id: 0,
|
2020-04-12 21:54:46 +00:00
|
|
|
taskId: 0,
|
2020-02-25 20:11:36 +00:00
|
|
|
comment: '',
|
|
|
|
author: UserModel,
|
|
|
|
created: null,
|
2022-06-23 03:22:21 +02:00
|
|
|
updated: null,
|
2020-02-25 20:11:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|