refactor: refactored task APIs
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user