test
This commit is contained in:
parent
cf00a32549
commit
badecd1a3d
1 changed files with 44 additions and 20 deletions
|
|
@ -4175,7 +4175,39 @@ export class CommandController extends Controller {
|
|||
|
||||
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")
|
||||
public async newSalaryAndUpdate(
|
||||
@Request() req: RequestWithUser,
|
||||
|
|
@ -4265,30 +4297,22 @@ export class CommandController extends Controller {
|
|||
await Promise.all(
|
||||
body.data.map(async (item) => {
|
||||
const profile: any = await this.profileRepository.findOne({
|
||||
where: {
|
||||
id: item.profileId ,
|
||||
current_holders: {
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
}
|
||||
},
|
||||
relations: ["current_holders","current_holders.orgRevision","roleKeycloaks"],
|
||||
where: { id: item.profileId },
|
||||
relations: ["current_holders","roleKeycloaks"],
|
||||
});
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
|
||||
}
|
||||
|
||||
// const orgRevision = await this.orgRevisionRepo.findOne({
|
||||
// where: {
|
||||
// orgRevisionIsCurrent: true,
|
||||
// orgRevisionIsDraft: false,
|
||||
// },
|
||||
// });
|
||||
const orgRevision = await this.orgRevisionRepo.findOne({
|
||||
where: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
});
|
||||
|
||||
// const orgRevisionRef =
|
||||
// profile?.current_holders?.find((x:any) => x.orgRevisionId == orgRevision?.id) ?? null;
|
||||
const orgRevisionRef =
|
||||
profile?.current_holders?.find((x:any) => x.orgRevisionId == orgRevision?.id) ?? null;
|
||||
|
||||
//ลบตำแหน่งที่รักษาการแทน
|
||||
const code = _command?.commandType?.code;
|
||||
|
|
@ -4318,8 +4342,8 @@ export class CommandController extends Controller {
|
|||
lastUpdatedAt: new Date(),
|
||||
};
|
||||
if (item.isLeave != undefined && item.isLeave == true) {
|
||||
console.log("profile.current_holders.id>>>",profile.current_holders.id);
|
||||
await CreatePosMasterHistoryOfficer(profile.current_holders.id, req, "DELETE");
|
||||
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");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue