This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
frontend/src/models/bucket.ts
kolaente ad27f588a2
All checks were successful
continuous-integration/drone/push Build is passing
feat(kanban): use total task count from the api instead of manually calculating it per bucket
This fixes an ux issue where the total count would show a wrong number of total tasks because that was the number of tasks which were loaded at the time. In combination with bucket limits, this caused error messages when the user would attempt to drag tasks into a bucket which appeared not full but was.
2023-06-08 16:57:58 +02:00

33 lines
783 B
TypeScript

import AbstractModel from './abstractModel'
import UserModel from './user'
import TaskModel from './task'
import type {IBucket} from '@/modelTypes/IBucket'
import type {ITask} from '@/modelTypes/ITask'
import type {IUser} from '@/modelTypes/IUser'
export default class BucketModel extends AbstractModel<IBucket> implements IBucket {
id = 0
title = ''
projectId = ''
limit = 0
tasks: ITask[] = []
isDoneBucket = false
position = 0
count = 0
createdBy: IUser = null
created: Date = null
updated: Date = null
constructor(data: Partial<IBucket>) {
super()
this.assignData(data)
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)
}
}