คำนวนวันเกษียณอายุราชการ

This commit is contained in:
Kittapath 2024-03-26 13:57:02 +07:00
parent db479c4ab6
commit 73e07dfed6
3 changed files with 54 additions and 1236 deletions

File diff suppressed because it is too large Load diff

View file

@ -25,7 +25,7 @@ import { OrgRevision } from "../entities/OrgRevision";
import { PosMaster } from "../entities/PosMaster";
import { PosLevel } from "../entities/PosLevel";
import { PosType } from "../entities/PosType";
import { calculateRetireDate, calculateRetireYear } from "../interfaces/utils";
import { calculateAge, calculateRetireDate, calculateRetireYear } from "../interfaces/utils";
import { RequestWithUser } from "../middlewares/user";
@Route("api/v1/org/profile")
@ -80,6 +80,19 @@ export class ProfileController extends Controller {
return new HttpSuccess();
}
/**
* API
*
*
*/
@Post("cal/retire")
async calDateRetire(@Body() birthDate: Date) {
const retireDate = await calculateRetireDate(birthDate);
const age = calculateAge(birthDate);
return new HttpSuccess({ retireDate, age });
}
/**
* API
*

View file

@ -0,0 +1,16 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableProfileAddIsLeave11711421865315 implements MigrationInterface {
name = 'UpdateTableProfileAddIsLeave11711421865315'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`nationality\` varchar(255) NULL COMMENT 'สัญชาติ'`);
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`nationality\` varchar(255) NULL COMMENT 'สัญชาติ'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`nationality\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`nationality\``);
}
}