แก้ 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

View file

@ -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,
"ไม่พบข้อมูลตำแหน่งนี้"
);
}