add api บรรจุสอบ

This commit is contained in:
kittapath 2024-10-28 14:18:06 +07:00
parent 5207572da1
commit ec052d8997
2 changed files with 54 additions and 1 deletions

View file

@ -3198,7 +3198,8 @@ export class PositionController extends Controller {
},
) {
let typeCondition: any = {};
let conditionA = "positions.posTypeId LIKE :posType AND positions.posLevelId LIKE :posLevel";
let conditionA =
"positions.posTypeId LIKE :posType AND positions.posLevelId LIKE :posLevel AND positions.positionName LIKE :position";
let posType = await this.posTypeRepository.findOne({
where: { id: String(body.posType) },
@ -3305,6 +3306,7 @@ export class PositionController extends Controller {
qb.andWhere(typeCondition).andWhere(conditionA == null ? "1=1" : conditionA, {
posType: posType == null ? `%%` : `${posType.id}`,
posLevel: posLevel == null ? `%%` : `${posLevel.id}`,
position: body.position == null ? `%%` : `${body.position}`,
});
}),
)

View file

@ -3583,6 +3583,57 @@ export class ProfileController extends Controller {
}
return new HttpSuccess(_profile);
}
/**
* API keycloak
*
* @summary ORG_065 - keycloak (ADMIN) #70
*
*/
@Get("keycloak/position-act")
async getProfileByKeycloakAct(
@Request() request: { user: Record<string, any> },
@Query("revisionId") revisionId?: string,
) {
if (!revisionId) {
let orgRevisionPublish = await this.orgRevisionRepo
.createQueryBuilder("orgRevision")
.where("orgRevision.orgRevisionIsDraft = false")
.andWhere("orgRevision.orgRevisionIsCurrent = true")
.getOne();
if (!orgRevisionPublish) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบแบบร่างโครงสร้าง");
}
revisionId = orgRevisionPublish.id;
}
const posMasters = await this.posMasterRepo.findOne({
where: {
posMasterAssigns: { assignId: "SYS_PLACEMENT_PASS" },
current_holder: {
keycloak: request.user.sub,
},
orgRevisionId: revisionId,
},
relations: ["orgChild1"],
});
if (posMasters == null || posMasters.orgChild1 == null) {
return new HttpSuccess({
isOfficer: null,
rootId: null,
child1Id: null,
child2Id: null,
child3Id: null,
child4Id: null,
});
}
return new HttpSuccess({
isOfficer: posMasters?.orgChild1?.isOfficer || null,
rootId: posMasters?.orgRootId || null,
child1Id: posMasters?.orgChild1Id || null,
child2Id: posMasters?.orgChild2Id || null,
child3Id: posMasters?.orgChild3Id || null,
child4Id: posMasters?.orgChild4Id || null,
});
}
/**
* API