refactor: refactored task APIs

This commit is contained in:
2026-07-06 15:21:34 +03:30
parent 263ede68b2
commit da71c20d6d
6 changed files with 75 additions and 78 deletions
@@ -23,7 +23,7 @@ export class TaskPhaseService {
});
}
async findOne(id: string): Promise<TMTaskPhase> {
async findOneOrFail(id: string): Promise<TMTaskPhase> {
const taskPhase = await this.taskPhaseRepository.findOne({where: {id}});
if (!taskPhase) throw new NotFoundException(TaskPhaseMessage.TASK_PHASE_NOT_FOUND);
return taskPhase;
@@ -36,7 +36,7 @@ export class TaskPhaseService {
}
async update(id: string, dto: UpdateTaskPhaseDto): Promise<TMTaskPhase> {
const taskPhase = await this.findOne(id);
const taskPhase = await this.findOneOrFail(id);
if (dto.projectId) {
await this.projectService.findOneOrFail(dto.projectId);
@@ -47,7 +47,7 @@ export class TaskPhaseService {
}
async remove(id: string): Promise<void> {
await this.findOne(id);
await this.findOneOrFail(id);
await this.taskPhaseRepository.delete(id);
}
}