comment try catch
This commit is contained in:
parent
83de553692
commit
a1e5bf6f5b
4 changed files with 76 additions and 76 deletions
|
|
@ -66,16 +66,16 @@ export class PosTypeController extends Controller {
|
|||
if(chkPosTypeName){
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ชื่อประเภทตำแหน่ง: " + requestBody.posTypeName + " มีอยู่ในระบบแล้ว");
|
||||
}
|
||||
try {
|
||||
// try {
|
||||
posType.createdUserId = request.user.sub;
|
||||
posType.createdFullName = request.user.name;
|
||||
posType.lastUpdateUserId = request.user.sub;
|
||||
posType.lastUpdateFullName = request.user.name;
|
||||
await this.posTypeRepository.save(posType);
|
||||
return new HttpSuccess(posType);
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
// } catch (error) {
|
||||
// return error;
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -108,15 +108,15 @@ export class PosTypeController extends Controller {
|
|||
if(chkPosTypeName){
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ชื่อประเภทตำแหน่ง: " + requestBody.posTypeName + " มีอยู่ในระบบแล้ว");
|
||||
}
|
||||
try {
|
||||
// try {
|
||||
posType.lastUpdateUserId = request.user.sub;
|
||||
posType.lastUpdateFullName = request.user.name;
|
||||
this.posTypeRepository.merge(posType, requestBody);
|
||||
await this.posTypeRepository.save(posType);
|
||||
return new HttpSuccess(posType.id);
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
// } catch (error) {
|
||||
// return error;
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -139,12 +139,12 @@ export class PosTypeController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่สามารถลบได้ เนื่องจาก id ผูกกับ posLevel",);
|
||||
}
|
||||
|
||||
try {
|
||||
// try {
|
||||
await this.posTypeRepository.remove(delPosType);
|
||||
return new HttpSuccess();
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
// } catch (error) {
|
||||
// return error;
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -171,7 +171,7 @@ export class PosTypeController extends Controller {
|
|||
},
|
||||
])
|
||||
async GetTypeDetail(@Path() id: string) {
|
||||
try {
|
||||
// try {
|
||||
const getPosType = await this.posTypeRepository.findOne({
|
||||
select: ["id", "posTypeName", "posTypeRank"],
|
||||
relations: ["posLevels"],
|
||||
|
|
@ -194,9 +194,9 @@ export class PosTypeController extends Controller {
|
|||
}
|
||||
|
||||
return new HttpSuccess(mapGetPosType);
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
// } catch (error) {
|
||||
// return error;
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -222,7 +222,7 @@ export class PosTypeController extends Controller {
|
|||
},
|
||||
])
|
||||
async GetPosType() {
|
||||
try {
|
||||
// try {
|
||||
const posType = await this.posTypeRepository.find({
|
||||
select: ["id", "posTypeName", "posTypeRank"],
|
||||
relations: ["posLevels"],
|
||||
|
|
@ -242,8 +242,8 @@ export class PosTypeController extends Controller {
|
|||
})),
|
||||
}));
|
||||
return new HttpSuccess(mapPosType);
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
// } catch (error) {
|
||||
// return error;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue