Merge branch 'develop' into adiDev

This commit is contained in:
AdisakKanthawilang 2025-07-18 11:48:36 +07:00
commit be50f9285b
2 changed files with 66 additions and 5 deletions

View file

@ -266,6 +266,7 @@ export class CommandController extends Controller {
const [commands, total] = await this.commandRepository
.createQueryBuilder("command")
.leftJoinAndSelect("command.commandType", "commandType")
.andWhere(
new Brackets((qb) => {
qb.orWhere(
@ -343,6 +344,7 @@ export class CommandController extends Controller {
commandYear: _data.commandYear,
commandAffectDate: _data.commandAffectDate,
commandExcecuteDate: _data.commandExcecuteDate,
commandType: _data.commandType ? _data.commandType.code : null,
assignFullName: null, //xxxxxxxxxxxxxxx
createdFullName: _data.createdFullName,
status: _data.status,

View file

@ -307,7 +307,22 @@ export class ProfileSalaryController extends Controller {
},
order: { order: "ASC" },
});
return new HttpSuccess(record);
const result = await Promise.all(
record.map(async (r) => {
let _command = null;
if (r.commandId) {
_command = await this.commandRepository.findOne({
where: { id: r.commandId },
relations: ["commandType"]
});
}
return {
...r,
commandType: _command && _command?.commandType ? _command?.commandType.code : null
};
})
);
return new HttpSuccess(result);
}
@Get("position/user")
@ -342,7 +357,22 @@ export class ProfileSalaryController extends Controller {
order: { order: "ASC" },
// order: { commandDateAffect: "ASC" },
});
return new HttpSuccess(record);
const result = await Promise.all(
record.map(async (r) => {
let _command = null;
if (r.commandId) {
_command = await this.commandRepository.findOne({
where: { id: r.commandId },
relations: ["commandType"]
});
}
return {
...r,
commandType: _command && _command?.commandType ? _command?.commandType.code : null
};
})
);
return new HttpSuccess(result);
}
@Get("{profileId}")
@ -361,7 +391,22 @@ export class ProfileSalaryController extends Controller {
// ? `${r.positionExecutive}(${r.positionExecutiveField})`
// : r.positionExecutive ?? null,
// }));
return new HttpSuccess(record);
const result = await Promise.all(
record.map(async (r) => {
let _command = null;
if (r.commandId) {
_command = await this.commandRepository.findOne({
where: { id: r.commandId },
relations: ["commandType"]
});
}
return {
...r,
commandType: _command && _command?.commandType ? _command?.commandType.code : null
};
})
);
return new HttpSuccess(result);
}
@Get("position/{profileId}")
@ -403,8 +448,22 @@ export class ProfileSalaryController extends Controller {
// ? `${r.positionExecutive}(${r.positionExecutiveField})`
// : r.positionExecutive ?? null,
// }));
return new HttpSuccess(record);
const result = await Promise.all(
record.map(async (r) => {
let _command = null;
if (r.commandId) {
_command = await this.commandRepository.findOne({
where: { id: r.commandId },
relations: ["commandType"]
});
}
return {
...r,
commandType: _command && _command?.commandType ? _command?.commandType.code : null
};
})
);
return new HttpSuccess(result);
}
@Get("tenure/user")