คำสั่งลูกจ้าง list รายการ

This commit is contained in:
Kittapath 2024-08-07 16:54:33 +07:00
parent 3170b1ccf9
commit c7920c2657

View file

@ -989,6 +989,61 @@ export class ProfileEmployeeController extends Controller {
return new HttpSuccess(formattedData);
}
/**
* API
*
* @summary ORG_038 - (ADMIN) #
*
*/
@Get("report-temp")
async getReportTemp(@Request() request: RequestWithUser) {
const profiles = await this.profileRepo.find({
where: { statusTemp: "REPORT", employeeClass: "TEMP" },
});
if (!profiles) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
}
const findRevision = await this.orgRevisionRepo.findOne({
where: { orgRevisionIsCurrent: true },
});
if (!findRevision) {
throw new HttpError(HttpStatus.NOT_FOUND, "not found. OrgRevision");
}
const formattedData = profiles.map((profile) => {
const shortName =
profile.child4Temp != null
? `${profile.child4ShortNameTemp}${profile.posMasterNoTemp}`
: profile.child3Temp != null
? `${profile.child3ShortNameTemp}${profile.posMasterNoTemp}`
: profile.child2Temp != null
? `${profile.child2ShortNameTemp}${profile.posMasterNoTemp}`
: profile.child1Temp != null
? `${profile.child1ShortNameTemp}${profile.posMasterNoTemp}`
: profile.rootIdTemp != null
? `${profile.rootShortNameTemp}${profile.posMasterNoTemp}`
: null;
return {
id: profile.id,
citizenId: profile.citizenId,
prefix: profile.prefix,
firstName: profile.firstName,
lastName: profile.lastName,
organization: profile.rootTemp,
positionName: profile.positionTemp,
positionType: profile.posTypeNameTemp,
positionLevel: profile.posLevelNameTemp,
positionNumber: shortName,
birthDate: profile.birthDate,
};
});
return new HttpSuccess(formattedData);
}
/**
* API
*
@ -2760,7 +2815,7 @@ export class ProfileEmployeeController extends Controller {
profile.leaveReason = requestBody.leaveReason;
profile.dateLeave = requestBody.dateLeave;
if (requestBody.isLeave == true) {
await removeProfileInOrganize(profile.id,"EMPLOYEE");
await removeProfileInOrganize(profile.id, "EMPLOYEE");
}
await this.profileRepo.save(profile);