Merge branch 'develop' into dev
All checks were successful
Build & Deploy on Dev / build (push) Successful in 58s

This commit is contained in:
Adisak 2025-11-13 11:13:21 +07:00
commit 2b0e9b61e4

View file

@ -4175,7 +4175,39 @@ export class CommandController extends Controller {
return new HttpSuccess(); return new HttpSuccess();
} }
@Get("testPosMaster/{profileId}")
public async newnwenew(
@Request() req:RequestWithUser,
@Path() profileId:string
){
const profile: any = await this.profileRepository.findOne({
where: {
id: profileId ,
// current_holders: {
// orgRevision: {
// orgRevisionIsCurrent: true,
// orgRevisionIsDraft: false,
// },
// }
},
relations: ["current_holders","roleKeycloaks"],
});
const orgRevision = await this.orgRevisionRepo.findOne({
where: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false,
},
});
const orgRevisionRef =
profile?.current_holders?.find((x:any) => x.orgRevisionId == orgRevision?.id) ?? null;
console.log("profile.current_holders.id>>>",orgRevisionRef.id);
await CreatePosMasterHistoryOfficer(orgRevisionRef.id, req, "DELETE");
console.log("profile.id>>>",profile.id);
await removeProfileInOrganize(profile.id, "OFFICER");
return new HttpSuccess(profile)
}
@Post("excexute/salary") @Post("excexute/salary")
public async newSalaryAndUpdate( public async newSalaryAndUpdate(
@Request() req: RequestWithUser, @Request() req: RequestWithUser,
@ -4265,30 +4297,22 @@ export class CommandController extends Controller {
await Promise.all( await Promise.all(
body.data.map(async (item) => { body.data.map(async (item) => {
const profile: any = await this.profileRepository.findOne({ const profile: any = await this.profileRepository.findOne({
where: { where: { id: item.profileId },
id: item.profileId , relations: ["current_holders","roleKeycloaks"],
current_holders: {
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false,
},
}
},
relations: ["current_holders","current_holders.orgRevision","roleKeycloaks"],
}); });
if (!profile) { if (!profile) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
} }
// const orgRevision = await this.orgRevisionRepo.findOne({ const orgRevision = await this.orgRevisionRepo.findOne({
// where: { where: {
// orgRevisionIsCurrent: true, orgRevisionIsCurrent: true,
// orgRevisionIsDraft: false, orgRevisionIsDraft: false,
// }, },
// }); });
// const orgRevisionRef = const orgRevisionRef =
// profile?.current_holders?.find((x:any) => x.orgRevisionId == orgRevision?.id) ?? null; profile?.current_holders?.find((x:any) => x.orgRevisionId == orgRevision?.id) ?? null;
//ลบตำแหน่งที่รักษาการแทน //ลบตำแหน่งที่รักษาการแทน
const code = _command?.commandType?.code; const code = _command?.commandType?.code;
@ -4318,8 +4342,8 @@ export class CommandController extends Controller {
lastUpdatedAt: new Date(), lastUpdatedAt: new Date(),
}; };
if (item.isLeave != undefined && item.isLeave == true) { if (item.isLeave != undefined && item.isLeave == true) {
console.log("profile.current_holders.id>>>",profile.current_holders.id); console.log("profile.current_holders.id>>>",orgRevisionRef.id);
await CreatePosMasterHistoryOfficer(profile.current_holders.id, req, "DELETE"); await CreatePosMasterHistoryOfficer(orgRevisionRef.id, req, "DELETE");
console.log("profile.id>>>",profile.id); console.log("profile.id>>>",profile.id);
await removeProfileInOrganize(profile.id, "OFFICER"); await removeProfileInOrganize(profile.id, "OFFICER");
} }