หาคนเกษียณตามปี

This commit is contained in:
mamoss 2025-10-16 23:04:50 +07:00
parent 58274b479c
commit f2efb44336
3 changed files with 29 additions and 29 deletions

View file

@ -4975,7 +4975,7 @@ export class ProfileController extends Controller {
*
*/
@Post("cal/retire")
async calDateRetire(@Body() body:{birthDate: Date}) {
async calDateRetire(@Body() body: { birthDate: Date }) {
const retireDate = await calculateRetireDate(body.birthDate);
const age = calculateAge(body.birthDate);
@ -10436,7 +10436,11 @@ export class ProfileController extends Controller {
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
.leftJoinAndSelect("current_holders.positions", "positions")
.leftJoinAndSelect("positions.posExecutive", "posExecutive")
.where("YEAR(profile.dateRetire) = :year", { year })
// calculate range: start = 2 Oct of (year-1), end = 1 Oct of year (inclusive)
.where("profile.dateRetire BETWEEN :start AND :end", {
start: `${year - 1}-10-02`,
end: `${year}-10-01`,
})
.getMany();
if (!profiles || profiles.length === 0) {