Merge branch 'develop' into adiDev

This commit is contained in:
AdisakKanthawilang 2024-06-14 13:22:26 +07:00
commit 24820c4322
2 changed files with 16 additions and 1 deletions

View file

@ -35,7 +35,7 @@ import { OrgChild2 } from "../entities/OrgChild2";
import { OrgChild3 } from "../entities/OrgChild3";
import { OrgChild4 } from "../entities/OrgChild4";
import { ProfileEmployee } from "../entities/ProfileEmployee";
import { AuthRole } from "../entities/AuthRole";
@Route("api/v1/org/employee/pos")
@Tags("Employee")
@Security("bearerAuth")
@ -57,6 +57,7 @@ export class EmployeePositionController extends Controller {
private child2Repository = AppDataSource.getRepository(OrgChild2);
private child3Repository = AppDataSource.getRepository(OrgChild3);
private child4Repository = AppDataSource.getRepository(OrgChild4);
private authRoleRepo = AppDataSource.getRepository(AuthRole);
/**
* API
@ -1054,6 +1055,10 @@ export class EmployeePositionController extends Controller {
relations: ["posLevel", "posType"],
});
const authRoleName = await this.authRoleRepo.findOne({
where: { id: String(posMaster.authRoleId) }
});
let profile: any;
const chkRevision = await this.orgRevisionRepository.findOne({
where: { id: posMaster.orgRevisionId },
@ -1143,6 +1148,8 @@ export class EmployeePositionController extends Controller {
profilePostype: type == null ? null : type.posTypeName,
profilePoslevel:
level == null || type == null ? null : `${type.posTypeShortName} ${level.posLevelName}`,
authRoleId: posMaster.authRoleId,
authRoleName: authRoleName == null || authRoleName.roleName == null ? null : authRoleName.roleName,
positions: positions.map((position) => ({
id: position.id,
positionName: position.positionName,

View file

@ -37,6 +37,7 @@ import { Profile } from "../entities/Profile";
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
import { EmployeePosType } from "../entities/EmployeePosType";
import { EmployeePosLevel } from "../entities/EmployeePosLevel";
import { AuthRole } from "../entities/AuthRole";
@Route("api/v1/org/pos")
@Tags("Position")
@Security("bearerAuth")
@ -61,6 +62,7 @@ export class PositionController extends Controller {
private child2Repository = AppDataSource.getRepository(OrgChild2);
private child3Repository = AppDataSource.getRepository(OrgChild3);
private child4Repository = AppDataSource.getRepository(OrgChild4);
private authRoleRepo = AppDataSource.getRepository(AuthRole);
/**
* API
@ -1271,6 +1273,10 @@ export class PositionController extends Controller {
},
});
const authRoleName = await this.authRoleRepo.findOne({
where: { id: String(posMaster.authRoleId) }
});
let profile: any;
const chkRevision = await this.orgRevisionRepository.findOne({
where: { id: posMaster.orgRevisionId },
@ -1359,6 +1365,8 @@ export class PositionController extends Controller {
profilePosition: profile == null || profile.position == null ? null : profile.position,
profilePostype: type == null || type.posTypeName == null ? null : type.posTypeName,
profilePoslevel: level == null || level.posLevelName == null ? null : level.posLevelName,
authRoleId: posMaster.authRoleId,
authRoleName: authRoleName == null || authRoleName.roleName == null ? null : authRoleName.roleName,
positions: positions.map((position: any) => ({
id: position.id,
positionName: position.positionName,