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");
}
// const checkPosExecutiveId = await this.posExecutiveRepository.findOne({
// where: { id: requestBody.posExecutiveId },
// });
// if (!checkPosExecutiveId) {
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล PosExecutiveId");
// }
if (requestBody.posExecutiveId != "") requestBody.posExecutiveId = null;
if (requestBody.posExecutiveId != null) {
const checkPosExecutiveId = await this.posExecutiveRepository.findOne({
where: { id: requestBody.posExecutiveId },
});
if (!checkPosExecutiveId) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล PosExecutiveId");
}
}
try {
posDict.createdUserId = request.user.sub;

View file

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

View file

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