แก้ caption ไอดี

This commit is contained in:
Bright 2024-02-28 14:00:38 +07:00
parent c1599e9d41
commit da6f901b81
10 changed files with 27 additions and 117 deletions

BIN
.vs/slnx.sqlite Normal file

Binary file not shown.

View file

@ -75,7 +75,7 @@ export class BloodGroupController extends Controller {
) { ) {
const bloodGroup = await this.bloodGroupRepository.findOne({ where: { id: id } }); const bloodGroup = await this.bloodGroupRepository.findOne({ where: { id: id } });
if (!bloodGroup) { if (!bloodGroup) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลกรุ๊ปเลือดนี้");
} }
const checkName = await this.bloodGroupRepository.findOne({ const checkName = await this.bloodGroupRepository.findOne({
@ -106,7 +106,7 @@ export class BloodGroupController extends Controller {
where: { id }, where: { id },
}); });
if (!delBloodGroup) { if (!delBloodGroup) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งตามไอดีนี้ : " + id); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลกรุ๊ปเลือดนี้");
} }
await this.bloodGroupRepository.delete({ id: id }); await this.bloodGroupRepository.delete({ id: id });

View file

@ -75,7 +75,7 @@ export class EducationLevelController extends Controller {
) { ) {
const educationLevel = await this.educationLevelRepository.findOne({ where: { id: id } }); const educationLevel = await this.educationLevelRepository.findOne({ where: { id: id } });
if (!educationLevel) { if (!educationLevel) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับการศึกษานี้");
} }
const checkName = await this.educationLevelRepository.findOne({ const checkName = await this.educationLevelRepository.findOne({
@ -106,7 +106,7 @@ export class EducationLevelController extends Controller {
where: { id }, where: { id },
}); });
if (!delEducationLevel) { if (!delEducationLevel) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งตามไอดีนี้ : " + id); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับการศึกษานี้");
} }
await this.educationLevelRepository.delete({ id: id }); await this.educationLevelRepository.delete({ id: id });
return new HttpSuccess(); return new HttpSuccess();

View file

@ -119,7 +119,7 @@ export class GenderController extends Controller {
) { ) {
const _gender = await this.genderRepository.findOne({ where: { id: id } }); const _gender = await this.genderRepository.findOne({ where: { id: id } });
if (!_gender) { if (!_gender) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตามไอดีนี้ : " + id); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลเพศนี้");
} }
const checkName = await this.genderRepository.findOne({ const checkName = await this.genderRepository.findOne({
where: { id: Not(id), name: requestBody.name }, where: { id: Not(id), name: requestBody.name },
@ -148,7 +148,7 @@ export class GenderController extends Controller {
where: { id: id }, where: { id: id },
}); });
if (!_delGender) { if (!_delGender) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตามไอดีนี้ : " + id); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลเพศนี้");
} }
await this.genderRepository.delete(_delGender.id); await this.genderRepository.delete(_delGender.id);
return new HttpSuccess(); return new HttpSuccess();

View file

@ -197,7 +197,7 @@ export class OrgRootController extends Controller {
if (!orgRoot) { if (!orgRoot) {
throw new HttpError( throw new HttpError(
HttpStatusCode.NOT_FOUND, HttpStatusCode.NOT_FOUND,
"ไม่พบข้อมูลโครงสร้างระดับ Root ตามไอดีนี้ :" + id, "ไม่พบข้อมูลโครงสร้างระดับ Root นี้",
); );
} }
orgRoot.lastUpdateUserId = request.user.sub; orgRoot.lastUpdateUserId = request.user.sub;
@ -222,7 +222,7 @@ export class OrgRootController extends Controller {
if (!orgRoot) { if (!orgRoot) {
throw new HttpError( throw new HttpError(
HttpStatusCode.NOT_FOUND, HttpStatusCode.NOT_FOUND,
"ไม่พบข้อมูลโครงสร้างระดับ Root ตามไอดีนี้ :" + id, "ไม่พบข้อมูลโครงสร้างระดับ Root นี้"
); );
} }

View file

@ -77,7 +77,7 @@ export class PosExecutiveController extends Controller {
) { ) {
const posExecutive = await this.posExecutiveRepository.findOne({ where: { id: id } }); const posExecutive = await this.posExecutiveRepository.findOne({ where: { id: id } });
if (!posExecutive) { if (!posExecutive) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งทางการบริหารนี้");
} }
const checkName = await this.posExecutiveRepository.findOne({ const checkName = await this.posExecutiveRepository.findOne({
@ -108,7 +108,7 @@ export class PosExecutiveController extends Controller {
where: { id }, where: { id },
}); });
if (!delPosExecutive) { if (!delPosExecutive) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งตามไอดีนี้ : " + id); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งทางการบริหารนี้");
} }
await this.positionRepository.delete({ posExecutiveId: id }); await this.positionRepository.delete({ posExecutiveId: id });
await this.posExecutiveRepository.delete({ id }); await this.posExecutiveRepository.delete({ id });

View file

@ -66,7 +66,7 @@ export class PosLevelController extends Controller {
if (!chkPosTypeId) { if (!chkPosTypeId) {
throw new HttpError( throw new HttpError(
HttpStatusCode.NOT_FOUND, HttpStatusCode.NOT_FOUND,
"ไม่พบข้อมูล posTypeId ไอดีนี้ : " + requestBody.posTypeId, "ไม่พบข้อมูลประเภทตำแหน่งนี้"
); );
} }
@ -118,7 +118,7 @@ export class PosLevelController extends Controller {
) { ) {
const posLevel = await this.posLevelRepository.findOne({ where: { id } }); const posLevel = await this.posLevelRepository.findOne({ where: { id } });
if (!posLevel) { if (!posLevel) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับตำแหน่ง");
} }
const chkPosTypeId = await this.posTypeRepository.findOne({ const chkPosTypeId = await this.posTypeRepository.findOne({
@ -129,7 +129,7 @@ export class PosLevelController extends Controller {
if (!chkPosTypeId) { if (!chkPosTypeId) {
throw new HttpError( throw new HttpError(
HttpStatusCode.NOT_FOUND, HttpStatusCode.NOT_FOUND,
"ไม่พบข้อมูล posTypeId ไอดีนี้ : " + requestBody.posTypeId, "ไม่พบข้อมูลประเภทตำแหน่งนี้"
); );
} }
@ -172,7 +172,7 @@ export class PosLevelController extends Controller {
async deleteLevel(@Path() id: string) { async deleteLevel(@Path() id: string) {
const delPosLevel = await this.posLevelRepository.findOne({ where: { id } }); const delPosLevel = await this.posLevelRepository.findOne({ where: { id } });
if (!delPosLevel) { if (!delPosLevel) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับตำแหน่งนี้");
} }
await this.posLevelRepository.remove(delPosLevel); await this.posLevelRepository.remove(delPosLevel);
return new HttpSuccess(); return new HttpSuccess();
@ -204,7 +204,7 @@ export class PosLevelController extends Controller {
where: { id: id }, where: { id: id },
}); });
if (!getPosType) { if (!getPosType) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประเภทตำแหน่งนี้");
} }
const mapPosLevel = { const mapPosLevel = {

View file

@ -99,7 +99,7 @@ export class PosTypeController extends Controller {
) { ) {
const posType = await this.posTypeRepository.findOne({ where: { id } }); const posType = await this.posTypeRepository.findOne({ where: { id } });
if (!posType) { if (!posType) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประเภทตำแหน่งนี้");
} }
const chkPosTypeName = await this.posTypeRepository.findOne({ where: { const chkPosTypeName = await this.posTypeRepository.findOne({ where: {
id: Not(id), id: Not(id),
@ -130,7 +130,7 @@ export class PosTypeController extends Controller {
async deleteType(@Path() id: string) { async deleteType(@Path() id: string) {
const delPosType = await this.posTypeRepository.findOne({ where: { id } }); const delPosType = await this.posTypeRepository.findOne({ where: { id } });
if (!delPosType) { if (!delPosType) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประเภทตำแหน่งนี้");
} }
const IdExitsInLevel = await this.posLevelRepository.find({ const IdExitsInLevel = await this.posLevelRepository.find({
where: { posTypeId: id } where: { posTypeId: id }
@ -178,7 +178,7 @@ export class PosTypeController extends Controller {
where: { id: id } where: { id: id }
}); });
if (!getPosType) { if (!getPosType) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไไม่พบข้อมูลประเภทตำแหน่งนี้");
} }
const mapGetPosType = { const mapGetPosType = {

View file

@ -230,7 +230,7 @@ export class PositionController extends Controller {
async delete(@Path() id: string) { async delete(@Path() id: string) {
const delPosDict = await this.posDictRepository.findOne({ where: { id } }); const delPosDict = await this.posDictRepository.findOne({ where: { id } });
if (!delPosDict) { if (!delPosDict) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งตามไอดีนี้ : " + id); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งในสายงานนี้");
} }
await this.posDictRepository.remove(delPosDict); await this.posDictRepository.remove(delPosDict);
return new HttpSuccess(); return new HttpSuccess();
@ -914,7 +914,7 @@ export class PositionController extends Controller {
// relations: ["position"], // relations: ["position"],
}); });
if (!delPosMaster) { if (!delPosMaster) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งตามไอดีนี้ : " + id); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งในสายงานนี้");
} }
await this.positionRepository.delete({ posMasterId: id }); await this.positionRepository.delete({ posMasterId: id });
await this.posMasterRepository.delete({ id }); await this.posMasterRepository.delete({ id });
@ -1387,7 +1387,7 @@ export class PositionController extends Controller {
where: { id }, where: { id },
}); });
if (!posMaster) { if (!posMaster) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งตามไอดีนี้ : " + id); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งนี้");
} }
const posMasters = await this.posMasterRepository.find({ const posMasters = await this.posMasterRepository.find({
where: { where: {
@ -1525,15 +1525,6 @@ export class PositionController extends Controller {
if (requestBody.isNode === true) { if (requestBody.isNode === true) {
switch (requestBody.type) { switch (requestBody.type) {
case 0: { 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({ totalPosition = await this.posMasterRepository.count({
where: { orgRootId: requestBody.id }, where: { orgRootId: requestBody.id },
}); });
@ -1564,15 +1555,6 @@ export class PositionController extends Controller {
break; break;
} }
case 1: { 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({ totalPosition = await this.posMasterRepository.count({
where: { orgChild1Id: requestBody.id }, where: { orgChild1Id: requestBody.id },
}); });
@ -1603,15 +1585,6 @@ export class PositionController extends Controller {
break; break;
} }
case 2: { 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({ totalPosition = await this.posMasterRepository.count({
where: { orgChild2Id: requestBody.id }, where: { orgChild2Id: requestBody.id },
}); });
@ -1642,15 +1615,6 @@ export class PositionController extends Controller {
break; break;
} }
case 3: { 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({ totalPosition = await this.posMasterRepository.count({
where: { orgChild3Id: requestBody.id }, where: { orgChild3Id: requestBody.id },
}); });
@ -1681,15 +1645,6 @@ export class PositionController extends Controller {
break; break;
} }
case 4: { 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({ totalPosition = await this.posMasterRepository.count({
where: { orgChild4Id: requestBody.id }, where: { orgChild4Id: requestBody.id },
}); });
@ -1725,15 +1680,6 @@ export class PositionController extends Controller {
} else { } else {
switch (requestBody.type) { switch (requestBody.type) {
case 0: { 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({ totalPosition = await this.posMasterRepository.count({
where: { where: {
orgRootId: requestBody.id, orgRootId: requestBody.id,
@ -1786,15 +1732,6 @@ export class PositionController extends Controller {
break; break;
} }
case 1: { 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({ totalPosition = await this.posMasterRepository.count({
where: { where: {
orgRootId: Not(IsNull()) || Not(""), orgRootId: Not(IsNull()) || Not(""),
@ -1847,15 +1784,6 @@ export class PositionController extends Controller {
break; break;
} }
case 2: { 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({ totalPosition = await this.posMasterRepository.count({
where: { where: {
orgRootId: Not(IsNull()) || Not(""), orgRootId: Not(IsNull()) || Not(""),
@ -1908,15 +1836,6 @@ export class PositionController extends Controller {
break; break;
} }
case 3: { 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({ totalPosition = await this.posMasterRepository.count({
where: { where: {
orgRootId: Not(IsNull()) || Not(""), orgRootId: Not(IsNull()) || Not(""),
@ -1969,15 +1888,6 @@ export class PositionController extends Controller {
break; break;
} }
case 4: { 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({ totalPosition = await this.posMasterRepository.count({
where: { where: {
orgRootId: Not(IsNull()) || Not(""), orgRootId: Not(IsNull()) || Not(""),
@ -2060,7 +1970,7 @@ export class PositionController extends Controller {
if (!dataMaster) { if (!dataMaster) {
throw new HttpError( throw new HttpError(
HttpStatusCode.NOT_FOUND, HttpStatusCode.NOT_FOUND,
"ไม่พบข้อมูลไอดีนี้ : " + requestBody.posMaster, "ไม่พบข้อมูลตำแหน่งนี้"
); );
} }
dataMaster.positions.forEach(async (position) => { dataMaster.positions.forEach(async (position) => {
@ -2093,7 +2003,7 @@ export class PositionController extends Controller {
relations: ["positions"], relations: ["positions"],
}); });
if (!dataMaster) { if (!dataMaster) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งนี้");
} }
await this.posMasterRepository.update(id, { await this.posMasterRepository.update(id, {
isSit: false, isSit: false,
@ -2134,7 +2044,7 @@ export class PositionController extends Controller {
if (!dataPublish) { if (!dataPublish) {
throw new HttpError( throw new HttpError(
HttpStatusCode.NOT_FOUND, HttpStatusCode.NOT_FOUND,
"ไม่พบข้อมูลไอดีนี้(publishPositionId) : " + requestBody.publishPositionId, "ไม่พบข้อมูลตำแหน่งนี้",
); );
} }
@ -2146,7 +2056,7 @@ export class PositionController extends Controller {
if (!dataDraft) { if (!dataDraft) {
throw new HttpError( throw new HttpError(
HttpStatusCode.NOT_FOUND, HttpStatusCode.NOT_FOUND,
"ไม่พบข้อมูลไอดีนี้(draftPositionId) : " + requestBody.draftPositionId, "ไม่พบข้อมูลตำแหน่งนี้"
); );
} }

View file

@ -129,7 +129,7 @@ export class PrefixController extends Controller {
) { ) {
const _prefix = await this.prefixRepository.findOne({ where: { id: id } }); const _prefix = await this.prefixRepository.findOne({ where: { id: id } });
if (!_prefix) { if (!_prefix) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตามไอดีนี้ : " + id); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำนำหน้าชื่อนี้");
} }
const checkName = await this.prefixRepository.findOne({ const checkName = await this.prefixRepository.findOne({
where: { id: Not(id), name: requestBody.name }, where: { id: Not(id), name: requestBody.name },
@ -162,7 +162,7 @@ export class PrefixController extends Controller {
where: { id: id }, where: { id: id },
}); });
if (!_delPrefix) { if (!_delPrefix) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตามไอดีนี้ : " + id); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำนำหน้าชื่อนี้");
} }
try { try {
await this.prefixRepository.delete(_delPrefix.id); await this.prefixRepository.delete(_delPrefix.id);