API Get Profile ใช้อัพเดทสถานะ Mark ในระบบเครื่องราช

This commit is contained in:
Bright 2025-05-15 17:45:27 +07:00
parent 320dd4616c
commit d3ad9468dc

View file

@ -4504,4 +4504,58 @@ export class OrganizationDotnetController extends Controller {
};
return new HttpSuccess(mapProfile);
}
/**
* API Get Profile Mark
*
* @summary API Get Profile Mark
*
* @param {string} type ( )
*/
@Post("find/insignia-requests-profile/{type}")
async GetInsigniaRequestsProfileAsync(
@Request() req: RequestWithUser,
@Path() type: string,
@Body()
body: {
profileIds: string[];
},
) {
let profile;
if (type.trim().toLocaleUpperCase() == "OFFICER") {
profile = await this.profileRepo.find({
relations: [
"profileSalary",
"profileInsignias",
"profileDisciplines",
"profileAssessments"
],
where: { id: In(body.profileIds) }
});
}
else {
profile = await this.profileEmpRepo.find({
relations: [
"profileSalary",
"profileInsignias",
"profileDisciplines",
"profileAssessments"
],
where: { id: In(body.profileIds) }
});
}
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
const mapProfile = profile.map((x) => {
return {
id: x.id,
markDiscipline: x.profileDisciplines.length > 0 ? true : false,
markLeave: false,
markRate: x.profileAssessments.length > 0 ? true : false,
markInsignia: x.profileInsignias.length > 0 ? true : false,
};
});
return new HttpSuccess(mapProfile);
}
}