เช็ค สกจ

This commit is contained in:
kittapath 2024-10-09 12:53:13 +07:00
parent 87b6fdf0d2
commit 5440bce257
5 changed files with 101 additions and 99 deletions

View file

@ -63,6 +63,7 @@ import { updateName } from "../keycloak";
import permission from "../interfaces/permission";
import { PosMasterAct } from "../entities/PosMasterAct";
import axios from "axios";
import { OrgChild1 } from "../entities/OrgChild1";
@Route("api/v1/org/profile")
@Tags("Profile")
@Security("bearerAuth")
@ -101,6 +102,7 @@ export class ProfileController extends Controller {
private disciplineHistoryRepository = AppDataSource.getRepository(ProfileDisciplineHistory);
private profileLeaveRepository = AppDataSource.getRepository(ProfileLeave);
private posMasterActRepository = AppDataSource.getRepository(PosMasterAct);
private orgChild1Repository = AppDataSource.getRepository(OrgChild1);
/**
* report
@ -3407,6 +3409,32 @@ export class ProfileController extends Controller {
return new HttpSuccess(_profile);
}
/**
* API
*
* @summary
*
*/
@Get("keycloak/idofficer")
async getIsOfficerByKeycloak(@Request() request: RequestWithUser) {
const posMasters = await this.posMasterRepo.findOne({
where: {
current_holder: {
keycloak: request.user.sub,
},
orgRevision: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false,
},
},
relations: ["orgChild1"],
});
if (!posMasters) {
return new HttpSuccess(false);
}
return new HttpSuccess(posMasters.orgChild1.isOfficer);
}
/**
* API keycloakid
*