save profile before add his

This commit is contained in:
mamoss 2025-09-02 22:52:11 +07:00
parent 577a413ffa
commit f1436d1485
4 changed files with 25 additions and 24 deletions

View file

@ -4087,17 +4087,17 @@ export class PositionController extends Controller {
});
posLevel = await this.posLevelRepository.find({
where: {
posTypeId: In(posType.map((x: any) => x.id)),
posLevelName: In(["ทรงคุณวุฒิ", "สูง"])
},
posTypeId: In(posType.map((x: any) => x.id)),
posLevelName: In(["ทรงคุณวุฒิ", "สูง"]),
},
});
conditionA = "positions.posTypeId IN (:...posTypeIds) AND positions.posLevelId IN (:...posLevelIds)";
conditionA =
"positions.posTypeId IN (:...posTypeIds) AND positions.posLevelId IN (:...posLevelIds)";
params = {
posTypeIds: posType.map((x: any) => x.id),
posLevelIds: posLevel.map((x: any) => x.id),
};
}
else {
} else {
posType = await this.posTypeRepository.findOne({
where: { id: String(body.posType) },
});
@ -4195,13 +4195,13 @@ export class PositionController extends Controller {
.andWhere(
new Brackets((qb) => {
qb.andWhere(typeCondition)
// .andWhere(conditionA == null ? "1=1" : conditionA, {
// posType: posType == null ? `%%` : `${posType.id}`,
// posLevel: posLevel == null ? `%%` : `${posLevel.id}`,
// posTypeRank: posType == null ? 0 : posType.posTypeRank,
// posLevelRank: posLevel == null ? 0 : posLevel.posLevelRank,
// });
.andWhere(conditionA, params);
// .andWhere(conditionA == null ? "1=1" : conditionA, {
// posType: posType == null ? `%%` : `${posType.id}`,
// posLevel: posLevel == null ? `%%` : `${posLevel.id}`,
// posTypeRank: posType == null ? 0 : posType.posTypeRank,
// posLevelRank: posLevel == null ? 0 : posLevel.posLevelRank,
// });
.andWhere(conditionA, params);
}),
)
.orderBy("orgRoot.orgRootOrder", "ASC")
@ -4924,7 +4924,8 @@ export class PositionController extends Controller {
await CreatePosMasterHistoryOfficer(posMasterOld.id, request);
}
await this.posMasterRepository.save(posMaster);
await CreatePosMasterHistoryOfficer(posMaster.id, request);
const positionNew = await this.positionRepository.findOne({
where: {
id: body.positionId,
@ -4939,7 +4940,6 @@ export class PositionController extends Controller {
await this.profileRepository.save(profile);
await this.positionRepository.save(positionNew);
}
await CreatePosMasterHistoryOfficer(posMaster.id, request);
return new HttpSuccess();
}