commandType

This commit is contained in:
Bright 2025-07-18 11:15:33 +07:00
parent 1dc7badb4d
commit 437490f293
2 changed files with 66 additions and 5 deletions

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")