vikunja-frontend/src/models/taskRelation.ts

46 lines
814 B
TypeScript
Raw Normal View History

import AbstractModel from './abstractModel'
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]
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
constructor(data) {
super(data)
this.createdBy = new UserModel(this.createdBy)
this.created = new Date(this.created)
}
defaults() {
return {
id: 0,
otherTaskId: 0,
taskId: 0,
relationKind: '',
createdBy: UserModel,
created: null,
}
}
}