refactor: change return type of remove funcs
This commit is contained in:
@@ -49,7 +49,7 @@ export class WorkspaceTypeController {
|
||||
@ApiParam({ name: "id", description: "WorkspaceType ID" })
|
||||
@ApiResponse({ status: 200, description: "WorkspaceType deleted" })
|
||||
@ApiResponse({ status: 404, description: "WorkspaceType not found" })
|
||||
remove(@Param("id") id: string): Promise<void> {
|
||||
remove(@Param("id") id: string): Promise<TMWorkspaceType> {
|
||||
return this.workspaceTypeService.remove(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ export class WorkspaceController {
|
||||
@ApiParam({ name: 'id', description: 'Workspace ID' })
|
||||
@ApiResponse({ status: 200, description: 'Workspace deleted' })
|
||||
@ApiResponse({ status: 404, description: 'Workspace not found' })
|
||||
remove(@Param('id') id: string): Promise<void> {
|
||||
remove(@Param('id') id: string): Promise<TMWorkspace> {
|
||||
return this.workspaceService.remove(id);
|
||||
}
|
||||
}
|
||||
@@ -44,8 +44,10 @@ export class WorkspaceTypeService {
|
||||
return this.findOne(id);
|
||||
}
|
||||
|
||||
async remove(id: string): Promise<void> {
|
||||
await this.findOne(id);
|
||||
async remove(id: string): Promise<TMWorkspaceType> {
|
||||
const workspaceType = await this.findOne(id);
|
||||
await this.workspaceTypeRepository.delete(id);
|
||||
|
||||
return workspaceType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,8 +57,10 @@ export class WorkspaceService {
|
||||
return this.workspaceRepository.save(workspace);
|
||||
}
|
||||
|
||||
async remove(id: string): Promise<void> {
|
||||
await this.findOneOrFail(id);
|
||||
async remove(id: string): Promise<TMWorkspace> {
|
||||
const workspace = await this.findOneOrFail(id);
|
||||
await this.workspaceRepository.delete(id);
|
||||
|
||||
return workspace;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user