add relation child command

This commit is contained in:
kittapath 2024-12-20 12:15:04 +07:00
parent 8b5f8746b2
commit 8ddef76726

View file

@ -2593,7 +2593,18 @@ export class CommandController extends Controller {
body.data.map(async (item) => {
if (item.profileType && item.profileType.trim().toUpperCase() == "OFFICER") {
const profile = await this.profileRepository.findOne({
relations: ["profileSalary", "posLevel", "posType", "current_holders", "roleKeycloaks"],
relations: [
"profileSalary",
"posLevel",
"posType",
"current_holders",
"current_holders.orgRoot",
"current_holders.orgChild1",
"current_holders.orgChild2",
"current_holders.orgChild3",
"current_holders.orgChild4",
"roleKeycloaks",
],
where: { id: item.profileId },
order: {
profileSalary: {
@ -2751,7 +2762,18 @@ export class CommandController extends Controller {
}
} else {
const profile = await this.profileEmployeeRepository.findOne({
relations: ["profileSalary", "posLevel", "posType", "current_holders", "roleKeycloaks"],
relations: [
"profileSalary",
"posLevel",
"posType",
"current_holders",
"current_holders.orgRoot",
"current_holders.orgChild1",
"current_holders.orgChild2",
"current_holders.orgChild3",
"current_holders.orgChild4",
"roleKeycloaks",
],
where: { id: item.profileId },
order: {
profileSalary: {
@ -2947,7 +2969,18 @@ export class CommandController extends Controller {
await Promise.all(
body.data.map(async (item) => {
const profile = await this.profileEmployeeRepository.findOne({
relations: ["profileSalary", "posLevel", "posType", "current_holders", "roleKeycloaks"],
relations: [
"profileSalary",
"posLevel",
"posType",
"current_holders",
"current_holders.orgRoot",
"current_holders.orgChild1",
"current_holders.orgChild2",
"current_holders.orgChild3",
"current_holders.orgChild4",
"roleKeycloaks",
],
where: { id: item.profileId },
order: {
profileSalary: {
@ -3275,6 +3308,11 @@ export class CommandController extends Controller {
"posType",
"posLevel",
"current_holders",
"current_holders.orgRoot",
"current_holders.orgChild1",
"current_holders.orgChild2",
"current_holders.orgChild3",
"current_holders.orgChild4",
"current_holders.positions",
"current_holders.positions.posExecutive",
],