fix
This commit is contained in:
parent
df05b9afaf
commit
9bf37a2f1d
2 changed files with 8 additions and 7 deletions
|
|
@ -619,12 +619,12 @@ export class ProfileEmployeeController extends Controller {
|
|||
*/
|
||||
@Delete("{id}")
|
||||
async deleteProfile(@Path() id: string) {
|
||||
const result = await this.profileRepo.delete({ id });
|
||||
|
||||
if (result.affected == undefined || result.affected <= 0) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const result = await this.profileRepo.findOne({ where: { id: id } });
|
||||
if (!result) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
await this.informationHistoryRepository.delete({profileEmployeeId: id});
|
||||
await this.profileRepo.remove(result);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue