เพิ่มเงื่อนไข type

This commit is contained in:
AnandaTon 2024-05-21 15:19:20 +07:00
parent bd9b8b4183
commit a56d469736

View file

@ -1667,6 +1667,8 @@ export class DevelopmentController extends Controller {
await Promise.all( await Promise.all(
getDevelopment.map(async (x) => { getDevelopment.map(async (x) => {
const _data = Object.assign(new DevelopmentHistory(), x); const _data = Object.assign(new DevelopmentHistory(), x);
if (x.type === "OFFICER") {
await new CallAPI() await new CallAPI()
.PostData(request, "org/profile/training", { .PostData(request, "org/profile/training", {
profileId: x.profileId, profileId: x.profileId,
@ -1688,6 +1690,30 @@ export class DevelopmentController extends Controller {
.catch((x) => { .catch((x) => {
_data.isDone = false; _data.isDone = false;
}); });
} else if (x.type === "EMPLOYEE") {
await new CallAPI()
.PostData(request, "org/profile/training", {
profileId: x.profileId,
name: x.development == null ? null : x.development.projectName,
topic: x.development == null ? null : x.development.topicAcademic,
yearly: x.development == null ? null : x.development.year,
place: x.development == null ? null : x.development.addressAcademic,
duration: x.trainingDays,
department: x.development == null ? null : x.development.root,
numberOrder: x.order,
dateOrder: x.dateOrder,
startDate: x.dateStart,
endDate: x.dateEnd,
isDate: true,
})
.then((x) => {
_data.isDone = true;
})
.catch((x) => {
_data.isDone = false;
});
}
_data.lastUpdateUserId = request.user.sub; _data.lastUpdateUserId = request.user.sub;
_data.lastUpdateFullName = request.user.name; _data.lastUpdateFullName = request.user.name;
await this.developmentHistoryRepository.save(_data); await this.developmentHistoryRepository.save(_data);