feat: task relatedTasks script setup
This commit is contained in:
@ -56,7 +56,7 @@ export default class TaskModel extends AbstractModel<ITask> implements ITask {
|
||||
parentTaskId: ITask['id'] = 0
|
||||
hexColor = ''
|
||||
percentDone = 0
|
||||
relatedTasks: Partial<Record<IRelationKind, ITask>> = {}
|
||||
relatedTasks: Partial<Record<IRelationKind, ITask[]>> = {}
|
||||
attachments: IAttachment[] = []
|
||||
identifier = ''
|
||||
index = 0
|
||||
@ -73,7 +73,7 @@ export default class TaskModel extends AbstractModel<ITask> implements ITask {
|
||||
listId: IList['id'] = 0
|
||||
bucketId: IBucket['id'] = 0
|
||||
|
||||
constructor(data: Partial<ITask>) {
|
||||
constructor(data: Partial<ITask> = {}) {
|
||||
super()
|
||||
this.assignData(data)
|
||||
|
||||
@ -109,7 +109,7 @@ export default class TaskModel extends AbstractModel<ITask> implements ITask {
|
||||
this.hexColor = '#' + this.hexColor
|
||||
}
|
||||
|
||||
// Make all subtasks to task models
|
||||
// Convert all subtasks to task models
|
||||
Object.keys(this.relatedTasks).forEach(relationKind => {
|
||||
this.relatedTasks[relationKind] = this.relatedTasks[relationKind].map(t => {
|
||||
return new TaskModel(t)
|
||||
|
@ -5,15 +5,15 @@ import type {ITaskRelation} from '@/modelTypes/ITaskRelation'
|
||||
import type {ITask} from '@/modelTypes/ITask'
|
||||
import type {IUser} from '@/modelTypes/IUser'
|
||||
|
||||
import type {IRelationKind} from '@/types/IRelationKind'
|
||||
import {RELATION_KIND, type IRelationKind} from '@/types/IRelationKind'
|
||||
export default class TaskRelationModel extends AbstractModel<ITaskRelation> implements ITaskRelation {
|
||||
id = 0
|
||||
otherTaskId: ITask['id'] = 0
|
||||
taskId: ITask['id'] = 0
|
||||
relationKind: IRelationKind = ''
|
||||
relationKind: IRelationKind = RELATION_KIND.RELATED
|
||||
|
||||
createdBy: IUser = UserModel
|
||||
created: Date = null
|
||||
createdBy: IUser = new UserModel()
|
||||
created: Date = new Date
|
||||
|
||||
constructor(data: Partial<ITaskRelation>) {
|
||||
super()
|
||||
|
@ -14,7 +14,7 @@ export default class UserModel extends AbstractModel<IUser> implements IUser {
|
||||
updated: Date = null
|
||||
settings: IUserSettings = null
|
||||
|
||||
constructor(data: Partial<IUser>) {
|
||||
constructor(data: Partial<IUser> = {}) {
|
||||
super()
|
||||
this.assignData(data)
|
||||
|
||||
|
Reference in New Issue
Block a user