Merge branch 'develop' into adiDev

# Conflicts:
#	src/controllers/ProfileEmployeeController.ts
This commit is contained in:
AdisakKanthawilang 2024-06-13 12:00:50 +07:00
commit b7ce71d017
6 changed files with 199 additions and 2 deletions

View file

@ -58,6 +58,7 @@ import {
UpdateEmploymentProfileEmployee,
} from "../entities/ProfileEmployeeEmployment";
import { ProfileEmployeeEmploymentHistory } from "../entities/ProfileEmployeeEmploymentHistory";
import CallAPI from "../interfaces/call-api";
@Route("api/v1/org/profile-employee")
@Tags("ProfileEmployee")
@ -2853,4 +2854,60 @@ export class ProfileEmployeeController extends Controller {
});
return new HttpSuccess(profiles);
}
/**
* API
*
* @summary ORG_038 - (ADMIN) #
*
*/
@Post("report/resume")
async doneReport(
@Body()
body: {
result: {
id: string;
personId: string;
templateDoc: string;
amount: string;
positionSalaryAmount: string;
mouthSalaryAmount: string;
refCommandNo: string;
}[];
},
@Request() request: { user: Record<string, any> },
) {
await Promise.all(
body.result.map(async (v) => {
const profile = await this.profileRepo.findOne({
where: {
id: v.id,
},
relations: ["posType", "posLevel"],
});
if (profile != null) {
await new CallAPI()
.PostData(request, "org/profile/salary", {
profileId: profile.id,
date: new Date(),
amount: v.amount,
positionSalaryAmount: v.positionSalaryAmount,
mouthSalaryAmount: v.mouthSalaryAmount,
posNo: profile.posMasterNoTemp,
position: profile.positionTemp,
positionType: profile.posTypeNameTemp,
positionLevel: profile.posLevelNameTemp,
refCommandNo: v.refCommandNo,
templateDoc: v.templateDoc,
})
.then(async (x) => {
profile.statusTemp = "DONE";
profile.employeeClass = "TEMP";
await this.profileRepo.save(profile);
});
}
}),
);
return new HttpSuccess();
}
}