fix report & find commander

This commit is contained in:
Bright 2025-01-31 16:20:08 +07:00
parent 38bb51f491
commit 94eb53bcc9
2 changed files with 11 additions and 4 deletions

View file

@ -1152,9 +1152,11 @@ export class ProfileController extends Controller {
const profile = await this.profileRepo.findOne({
where: { keycloak: request.user.sub },
});
const posMaster = await this.posMasterRepo.findOne({
where: { current_holderId: profile?.id },
where: {
current_holderId: profile?.id,
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
},
});
if (!posMaster) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลการครองตำแหน่ง");
const orgRoot = posMaster.orgRootId;
@ -1870,7 +1872,10 @@ export class ProfileController extends Controller {
});
const posMaster = await this.posMasterRepo.findOne({
where: { current_holderId: profile?.id },
where: {
current_holderId: profile?.id,
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
},
});
if (!posMaster) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลการครองตำแหน่ง");
const orgRoot = posMaster.orgRootId;