no message

This commit is contained in:
Kittapath 2024-02-07 12:01:12 +07:00
parent 551d2d70a4
commit 60f5203ff4
3 changed files with 25 additions and 25 deletions

View file

@ -99,12 +99,16 @@ export class PositionController extends Controller {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล PosLevelId"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล PosLevelId");
} }
// const checkPosExecutiveId = await this.posExecutiveRepository.findOne({ if (requestBody.posExecutiveId != "") requestBody.posExecutiveId = null;
// where: { id: requestBody.posExecutiveId },
// }); if (requestBody.posExecutiveId != null) {
// if (!checkPosExecutiveId) { const checkPosExecutiveId = await this.posExecutiveRepository.findOne({
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล PosExecutiveId"); where: { id: requestBody.posExecutiveId },
// } });
if (!checkPosExecutiveId) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล PosExecutiveId");
}
}
try { try {
posDict.createdUserId = request.user.sub; posDict.createdUserId = request.user.sub;

View file

@ -231,18 +231,12 @@ export class ReportController extends Controller {
// }; // };
// }), // }),
// ); // );
const positionName = [ const positionName = [...new Set(posMaster.positions.map((x) => x.positionName))];
...new Set(posMaster.positions.map((x) => x.positionName)), const posType = [...new Set(posMaster.positions.map((x) => x.posType.posTypeName))];
].join(" หรือ ");
const posType = [
...new Set(posMaster.positions.map((x) => x.posType.posTypeName)),
].join(" หรือ ");
const posLevel = [ const posLevel = [
...new Set(posMaster.positions.map((x) => x.posLevel.posLevelName)), ...new Set(posMaster.positions.map((x) => x.posLevel.posLevelName)),
].join(" หรือ "); ];
const positionField = [ const positionField = [...new Set(posMaster.positions.map((x) => x.positionField))];
...new Set(posMaster.positions.map((x) => x.positionField)),
].join(" หรือ ");
return { return {
posMasterNoPrefix: posMaster.posMasterNoPrefix, posMasterNoPrefix: posMaster.posMasterNoPrefix,
posMasterNo: posMaster.posMasterNo, posMasterNo: posMaster.posMasterNo,
@ -252,19 +246,21 @@ export class ReportController extends Controller {
? "- ว่าง -" ? "- ว่าง -"
: `${posMaster.next_holder.prefix}${posMaster.next_holder.firstName} ${posMaster.next_holder.lastName}`, : `${posMaster.next_holder.prefix}${posMaster.next_holder.firstName} ${posMaster.next_holder.lastName}`,
profilePosMasterNo: posMaster.next_holder == null ? null : "xxx", profilePosMasterNo: posMaster.next_holder == null ? null : "xxx",
profilePositionName: posMaster.next_holder == null ? positionName : "xxx", profilePositionName:
profilePosType: posMaster.next_holder == null ? posType : "xxx", posMaster.next_holder == null ? positionName.join(" หรือ ") : "xxx",
profilePosLevel: posMaster.next_holder == null ? posLevel : "xxx", profilePosType: posMaster.next_holder == null ? posType.join(" หรือ ") : "xxx",
profilePositionField: posMaster.next_holder == null ? positionField : "xxx", profilePosLevel: posMaster.next_holder == null ? posLevel.join(" หรือ ") : "xxx",
profilePositionField:
posMaster.next_holder == null ? positionField.join(" หรือ ") : "xxx",
// profilePosMasterNo: (posMasterOld == null ? null : posMasterOld.posMasterNo), // profilePosMasterNo: (posMasterOld == null ? null : posMasterOld.posMasterNo),
// profilePositionName: (positionOld == null ? null : positionOld.positionName), // profilePositionName: (positionOld == null ? null : positionOld.positionName),
// profilePosType: (positionOld == null ? null : positionOld.posType.posTypeName), // profilePosType: (positionOld == null ? null : positionOld.posType.posTypeName),
// profilePosLevel: (positionOld == null ? null : positionOld.posLevel.posLevelName), // profilePosLevel: (positionOld == null ? null : positionOld.posLevel.posLevelName),
// profilePositionField: (positionOld == null ? null : positionOld.positionField), // profilePositionField: (positionOld == null ? null : positionOld.positionField),
PositionName: positionName, PositionName: positionName.join(" หรือ "),
PosType: posType, PosType: posType.join(" หรือ "),
PosLevel: posLevel, PosLevel: posLevel.join(" หรือ "),
PositionField: positionField, PositionField: positionField.join(" หรือ "),
// positions: await Promise.all( // positions: await Promise.all(
// positions // positions
// .filter((position) => position.posMasterId === posMaster.id) // .filter((position) => position.posMasterId === posMaster.id)

View file

@ -85,7 +85,7 @@ export class CreatePosDict {
posLevelId: string; posLevelId: string;
@Column() @Column()
posExecutiveId: string; posExecutiveId?: string | null;
@Column() @Column()
posDictExecutiveField: string; posDictExecutiveField: string;