2019-10-28 22:45:37 +01:00
|
|
|
import AbstractModel from './abstractModel'
|
2020-02-08 14:16:06 +01:00
|
|
|
import UserModel from './user'
|
2022-06-23 03:22:21 +02:00
|
|
|
import type TaskModel from './task'
|
|
|
|
|
|
|
|
export const RELATION_KINDS = [
|
|
|
|
'subtask',
|
|
|
|
'parenttask',
|
|
|
|
'related',
|
|
|
|
'duplicates',
|
|
|
|
'blocking',
|
|
|
|
'blocked',
|
|
|
|
'precedes',
|
|
|
|
'follows',
|
|
|
|
'copiedfrom',
|
|
|
|
'copiedto',
|
|
|
|
] as const
|
|
|
|
|
|
|
|
export type RelationKind = typeof RELATION_KINDS[number]
|
2019-10-28 22:45:37 +01:00
|
|
|
|
|
|
|
export default class TaskRelationModel extends AbstractModel {
|
2022-06-23 03:22:21 +02:00
|
|
|
id: number
|
|
|
|
otherTaskId: TaskModel['id']
|
|
|
|
taskId: TaskModel['id']
|
|
|
|
relationKind: RelationKind
|
|
|
|
|
|
|
|
createdBy: UserModel
|
|
|
|
created: Date
|
|
|
|
|
2019-10-28 22:45:37 +01:00
|
|
|
constructor(data) {
|
|
|
|
super(data)
|
2020-04-12 23:54:46 +02:00
|
|
|
this.createdBy = new UserModel(this.createdBy)
|
2020-02-08 14:16:06 +01:00
|
|
|
this.created = new Date(this.created)
|
2019-10-28 22:45:37 +01:00
|
|
|
}
|
2020-09-05 22:35:52 +02:00
|
|
|
|
2019-10-28 22:45:37 +01:00
|
|
|
defaults() {
|
|
|
|
return {
|
|
|
|
id: 0,
|
2020-04-12 23:54:46 +02:00
|
|
|
otherTaskId: 0,
|
|
|
|
taskId: 0,
|
|
|
|
relationKind: '',
|
2019-10-28 22:45:37 +01:00
|
|
|
|
2020-04-12 23:54:46 +02:00
|
|
|
createdBy: UserModel,
|
2020-02-08 14:16:06 +01:00
|
|
|
created: null,
|
2019-10-28 22:45:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|