diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite new file mode 100644 index 00000000..0f43a31d Binary files /dev/null and b/.vs/slnx.sqlite differ diff --git a/src/controllers/BloodGroupController.ts b/src/controllers/BloodGroupController.ts index cfb9447b..4b844438 100644 --- a/src/controllers/BloodGroupController.ts +++ b/src/controllers/BloodGroupController.ts @@ -75,7 +75,7 @@ export class BloodGroupController extends Controller { ) { const bloodGroup = await this.bloodGroupRepository.findOne({ where: { id: id } }); if (!bloodGroup) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id); + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลกรุ๊ปเลือดนี้"); } const checkName = await this.bloodGroupRepository.findOne({ @@ -106,7 +106,7 @@ export class BloodGroupController extends Controller { where: { id }, }); if (!delBloodGroup) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งตามไอดีนี้ : " + id); + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลกรุ๊ปเลือดนี้"); } await this.bloodGroupRepository.delete({ id: id }); diff --git a/src/controllers/EducationLevelController.ts b/src/controllers/EducationLevelController.ts index 66169e24..600fb37e 100644 --- a/src/controllers/EducationLevelController.ts +++ b/src/controllers/EducationLevelController.ts @@ -75,7 +75,7 @@ export class EducationLevelController extends Controller { ) { const educationLevel = await this.educationLevelRepository.findOne({ where: { id: id } }); if (!educationLevel) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id); + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับการศึกษานี้"); } const checkName = await this.educationLevelRepository.findOne({ @@ -106,7 +106,7 @@ export class EducationLevelController extends Controller { where: { id }, }); if (!delEducationLevel) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งตามไอดีนี้ : " + id); + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับการศึกษานี้"); } await this.educationLevelRepository.delete({ id: id }); return new HttpSuccess(); diff --git a/src/controllers/GenderController.ts b/src/controllers/GenderController.ts index ee1a21a9..3d31db6d 100644 --- a/src/controllers/GenderController.ts +++ b/src/controllers/GenderController.ts @@ -119,7 +119,7 @@ export class GenderController extends Controller { ) { const _gender = await this.genderRepository.findOne({ where: { id: id } }); if (!_gender) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตามไอดีนี้ : " + id); + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลเพศนี้"); } const checkName = await this.genderRepository.findOne({ where: { id: Not(id), name: requestBody.name }, @@ -148,7 +148,7 @@ export class GenderController extends Controller { where: { id: id }, }); if (!_delGender) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตามไอดีนี้ : " + id); + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลเพศนี้"); } await this.genderRepository.delete(_delGender.id); return new HttpSuccess(); diff --git a/src/controllers/OrgRootController.ts b/src/controllers/OrgRootController.ts index 3983ef45..17dd2a67 100644 --- a/src/controllers/OrgRootController.ts +++ b/src/controllers/OrgRootController.ts @@ -197,7 +197,7 @@ export class OrgRootController extends Controller { if (!orgRoot) { throw new HttpError( HttpStatusCode.NOT_FOUND, - "ไม่พบข้อมูลโครงสร้างระดับ Root ตามไอดีนี้ :" + id, + "ไม่พบข้อมูลโครงสร้างระดับ Root นี้", ); } orgRoot.lastUpdateUserId = request.user.sub; @@ -222,7 +222,7 @@ export class OrgRootController extends Controller { if (!orgRoot) { throw new HttpError( HttpStatusCode.NOT_FOUND, - "ไม่พบข้อมูลโครงสร้างระดับ Root ตามไอดีนี้ :" + id, + "ไม่พบข้อมูลโครงสร้างระดับ Root นี้" ); } diff --git a/src/controllers/PosExecutiveController.ts b/src/controllers/PosExecutiveController.ts index 2910d1e0..5aaaa7ff 100644 --- a/src/controllers/PosExecutiveController.ts +++ b/src/controllers/PosExecutiveController.ts @@ -77,7 +77,7 @@ export class PosExecutiveController extends Controller { ) { const posExecutive = await this.posExecutiveRepository.findOne({ where: { id: id } }); if (!posExecutive) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id); + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งทางการบริหารนี้"); } const checkName = await this.posExecutiveRepository.findOne({ @@ -108,7 +108,7 @@ export class PosExecutiveController extends Controller { where: { id }, }); if (!delPosExecutive) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งตามไอดีนี้ : " + id); + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งทางการบริหารนี้"); } await this.positionRepository.delete({ posExecutiveId: id }); await this.posExecutiveRepository.delete({ id }); diff --git a/src/controllers/PosLevelController.ts b/src/controllers/PosLevelController.ts index 9b1396df..d111615a 100644 --- a/src/controllers/PosLevelController.ts +++ b/src/controllers/PosLevelController.ts @@ -66,7 +66,7 @@ export class PosLevelController extends Controller { if (!chkPosTypeId) { throw new HttpError( HttpStatusCode.NOT_FOUND, - "ไม่พบข้อมูล posTypeId ไอดีนี้ : " + requestBody.posTypeId, + "ไม่พบข้อมูลประเภทตำแหน่งนี้" ); } @@ -118,7 +118,7 @@ export class PosLevelController extends Controller { ) { const posLevel = await this.posLevelRepository.findOne({ where: { id } }); if (!posLevel) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id); + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับตำแหน่ง"); } const chkPosTypeId = await this.posTypeRepository.findOne({ @@ -129,7 +129,7 @@ export class PosLevelController extends Controller { if (!chkPosTypeId) { throw new HttpError( HttpStatusCode.NOT_FOUND, - "ไม่พบข้อมูล posTypeId ไอดีนี้ : " + requestBody.posTypeId, + "ไม่พบข้อมูลประเภทตำแหน่งนี้" ); } @@ -172,7 +172,7 @@ export class PosLevelController extends Controller { async deleteLevel(@Path() id: string) { const delPosLevel = await this.posLevelRepository.findOne({ where: { id } }); if (!delPosLevel) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id); + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับตำแหน่งนี้"); } await this.posLevelRepository.remove(delPosLevel); return new HttpSuccess(); @@ -204,7 +204,7 @@ export class PosLevelController extends Controller { where: { id: id }, }); if (!getPosType) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id); + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประเภทตำแหน่งนี้"); } const mapPosLevel = { diff --git a/src/controllers/PosTypeController.ts b/src/controllers/PosTypeController.ts index 5617415c..c09e8ec8 100644 --- a/src/controllers/PosTypeController.ts +++ b/src/controllers/PosTypeController.ts @@ -99,7 +99,7 @@ export class PosTypeController extends Controller { ) { const posType = await this.posTypeRepository.findOne({ where: { id } }); if (!posType) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id); + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประเภทตำแหน่งนี้"); } const chkPosTypeName = await this.posTypeRepository.findOne({ where: { id: Not(id), @@ -130,7 +130,7 @@ export class PosTypeController extends Controller { async deleteType(@Path() id: string) { const delPosType = await this.posTypeRepository.findOne({ where: { id } }); if (!delPosType) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id); + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประเภทตำแหน่งนี้"); } const IdExitsInLevel = await this.posLevelRepository.find({ where: { posTypeId: id } @@ -178,7 +178,7 @@ export class PosTypeController extends Controller { where: { id: id } }); if (!getPosType) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id); + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไไม่พบข้อมูลประเภทตำแหน่งนี้"); } const mapGetPosType = { diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index 10ac2429..b09d4184 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -230,7 +230,7 @@ export class PositionController extends Controller { async delete(@Path() id: string) { const delPosDict = await this.posDictRepository.findOne({ where: { id } }); if (!delPosDict) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งตามไอดีนี้ : " + id); + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งในสายงานนี้"); } await this.posDictRepository.remove(delPosDict); return new HttpSuccess(); @@ -914,7 +914,7 @@ export class PositionController extends Controller { // relations: ["position"], }); if (!delPosMaster) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งตามไอดีนี้ : " + id); + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งในสายงานนี้"); } await this.positionRepository.delete({ posMasterId: id }); await this.posMasterRepository.delete({ id }); @@ -1387,7 +1387,7 @@ export class PositionController extends Controller { where: { id }, }); if (!posMaster) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งตามไอดีนี้ : " + id); + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งนี้"); } const posMasters = await this.posMasterRepository.find({ where: { @@ -1525,15 +1525,6 @@ export class PositionController extends Controller { if (requestBody.isNode === true) { switch (requestBody.type) { case 0: { - // const NodeId = await this.posMasterRepository.findOne({ - // where: { orgRootId: requestBody.id }, - // }); - // if (!NodeId) { - // throw new HttpError( - // HttpStatusCode.NOT_FOUND, - // "ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id, - // ); - // } totalPosition = await this.posMasterRepository.count({ where: { orgRootId: requestBody.id }, }); @@ -1564,15 +1555,6 @@ export class PositionController extends Controller { break; } case 1: { - // const NodeId = await this.posMasterRepository.findOne({ - // where: { orgChild1Id: requestBody.id }, - // }); - // if (!NodeId) { - // throw new HttpError( - // HttpStatusCode.NOT_FOUND, - // "ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id, - // ); - // } totalPosition = await this.posMasterRepository.count({ where: { orgChild1Id: requestBody.id }, }); @@ -1603,15 +1585,6 @@ export class PositionController extends Controller { break; } case 2: { - // const NodeId = await this.posMasterRepository.findOne({ - // where: { orgChild2Id: requestBody.id }, - // }); - // if (!NodeId) { - // throw new HttpError( - // HttpStatusCode.NOT_FOUND, - // "ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id, - // ); - // } totalPosition = await this.posMasterRepository.count({ where: { orgChild2Id: requestBody.id }, }); @@ -1642,15 +1615,6 @@ export class PositionController extends Controller { break; } case 3: { - // const NodeId = await this.posMasterRepository.findOne({ - // where: { orgChild3Id: requestBody.id }, - // }); - // if (!NodeId) { - // throw new HttpError( - // HttpStatusCode.NOT_FOUND, - // "ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id, - // ); - // } totalPosition = await this.posMasterRepository.count({ where: { orgChild3Id: requestBody.id }, }); @@ -1681,15 +1645,6 @@ export class PositionController extends Controller { break; } case 4: { - // const NodeId = await this.posMasterRepository.findOne({ - // where: { orgChild4Id: requestBody.id }, - // }); - // if (!NodeId) { - // throw new HttpError( - // HttpStatusCode.NOT_FOUND, - // "ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id, - // ); - // } totalPosition = await this.posMasterRepository.count({ where: { orgChild4Id: requestBody.id }, }); @@ -1725,15 +1680,6 @@ export class PositionController extends Controller { } else { switch (requestBody.type) { case 0: { - // const NodeId = await this.posMasterRepository.findOne({ - // where: { orgRootId: requestBody.id }, - // }); - // if (!NodeId) { - // throw new HttpError( - // HttpStatusCode.NOT_FOUND, - // "ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id, - // ); - // } totalPosition = await this.posMasterRepository.count({ where: { orgRootId: requestBody.id, @@ -1786,15 +1732,6 @@ export class PositionController extends Controller { break; } case 1: { - // const NodeId = await this.posMasterRepository.findOne({ - // where: { orgChild1Id: requestBody.id }, - // }); - // if (!NodeId) { - // throw new HttpError( - // HttpStatusCode.NOT_FOUND, - // "ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id, - // ); - // } totalPosition = await this.posMasterRepository.count({ where: { orgRootId: Not(IsNull()) || Not(""), @@ -1847,15 +1784,6 @@ export class PositionController extends Controller { break; } case 2: { - // const NodeId = await this.posMasterRepository.findOne({ - // where: { orgChild2Id: requestBody.id }, - // }); - // if (!NodeId) { - // throw new HttpError( - // HttpStatusCode.NOT_FOUND, - // "ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id, - // ); - // } totalPosition = await this.posMasterRepository.count({ where: { orgRootId: Not(IsNull()) || Not(""), @@ -1908,15 +1836,6 @@ export class PositionController extends Controller { break; } case 3: { - // const NodeId = await this.posMasterRepository.findOne({ - // where: { orgChild3Id: requestBody.id }, - // }); - // if (!NodeId) { - // throw new HttpError( - // HttpStatusCode.NOT_FOUND, - // "ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id, - // ); - // } totalPosition = await this.posMasterRepository.count({ where: { orgRootId: Not(IsNull()) || Not(""), @@ -1969,15 +1888,6 @@ export class PositionController extends Controller { break; } case 4: { - // const NodeId = await this.posMasterRepository.findOne({ - // where: { orgChild4Id: requestBody.id }, - // }); - // if (!NodeId) { - // throw new HttpError( - // HttpStatusCode.NOT_FOUND, - // "ไม่พบข้อมูลตามไอดีนี้ : " + requestBody.id, - // ); - // } totalPosition = await this.posMasterRepository.count({ where: { orgRootId: Not(IsNull()) || Not(""), @@ -2060,7 +1970,7 @@ export class PositionController extends Controller { if (!dataMaster) { throw new HttpError( HttpStatusCode.NOT_FOUND, - "ไม่พบข้อมูลไอดีนี้ : " + requestBody.posMaster, + "ไม่พบข้อมูลตำแหน่งนี้" ); } dataMaster.positions.forEach(async (position) => { @@ -2093,7 +2003,7 @@ export class PositionController extends Controller { relations: ["positions"], }); if (!dataMaster) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id); + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งนี้"); } await this.posMasterRepository.update(id, { isSit: false, @@ -2134,7 +2044,7 @@ export class PositionController extends Controller { if (!dataPublish) { throw new HttpError( HttpStatusCode.NOT_FOUND, - "ไม่พบข้อมูลไอดีนี้(publishPositionId) : " + requestBody.publishPositionId, + "ไม่พบข้อมูลตำแหน่งนี้", ); } @@ -2146,7 +2056,7 @@ export class PositionController extends Controller { if (!dataDraft) { throw new HttpError( HttpStatusCode.NOT_FOUND, - "ไม่พบข้อมูลไอดีนี้(draftPositionId) : " + requestBody.draftPositionId, + "ไม่พบข้อมูลตำแหน่งนี้" ); } diff --git a/src/controllers/PrefixController.ts b/src/controllers/PrefixController.ts index 0fbac024..b61448e5 100644 --- a/src/controllers/PrefixController.ts +++ b/src/controllers/PrefixController.ts @@ -129,7 +129,7 @@ export class PrefixController extends Controller { ) { const _prefix = await this.prefixRepository.findOne({ where: { id: id } }); if (!_prefix) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตามไอดีนี้ : " + id); + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำนำหน้าชื่อนี้"); } const checkName = await this.prefixRepository.findOne({ where: { id: Not(id), name: requestBody.name }, @@ -162,7 +162,7 @@ export class PrefixController extends Controller { where: { id: id }, }); if (!_delPrefix) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตามไอดีนี้ : " + id); + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำนำหน้าชื่อนี้"); } try { await this.prefixRepository.delete(_delPrefix.id);