diff --git a/src/entities/Profile.ts b/src/entities/Profile.ts index 23a70f3b..e5ab9173 100644 --- a/src/entities/Profile.ts +++ b/src/entities/Profile.ts @@ -154,7 +154,7 @@ export class Profile extends EntityBase { @Column({ nullable: true, type: "datetime", - comment: "วันที่พักราชการ", + comment: "วันครบเกษียณอายุ", default: null, }) dateRetire: Date; @@ -167,6 +167,14 @@ export class Profile extends EntityBase { }) dateAppoint: Date; + @Column({ + nullable: true, + type: "datetime", + comment: "วันที่เกษียณอายุราชการตามกฏหมาย", + default: null, + }) + dateRetireLaw: Date; + @Column({ nullable: true, type: "datetime", @@ -327,7 +335,7 @@ export class Profile extends EntityBase { @OneToMany(() => ProfileFamilyMother, (v) => v.profile) profileFamilyMother: ProfileFamilyMother[]; - @OneToMany(() => ProfileFamilyCouple , (v) => v.profile) + @OneToMany(() => ProfileFamilyCouple, (v) => v.profile) profileFamilyCouple: ProfileFamilyCouple[]; @ManyToOne(() => PosLevel, (posLevel) => posLevel.profiles) diff --git a/src/entities/ProfileEmployee.ts b/src/entities/ProfileEmployee.ts index 1b5df5ca..6d0e334a 100644 --- a/src/entities/ProfileEmployee.ts +++ b/src/entities/ProfileEmployee.ts @@ -135,7 +135,7 @@ export class ProfileEmployee extends EntityBase { @Column({ nullable: true, type: "datetime", - comment: "วันที่พักราชการ", + comment: "วันครบเกษียณอายุ", default: null, }) dateRetire: Date; @@ -148,6 +148,14 @@ export class ProfileEmployee extends EntityBase { }) birthDate: Date; + @Column({ + nullable: true, + type: "datetime", + comment: "วันที่เกษียณอายุราชการตามกฏหมาย", + default: null, + }) + dateRetireLaw: Date; + @Column({ type: "double", nullable: true, @@ -286,7 +294,7 @@ export class ProfileEmployee extends EntityBase { @OneToMany(() => ProfileFamilyMother, (v) => v.profile) profileFamilyMother: ProfileFamilyMother[]; - @OneToMany(() => ProfileFamilyCouple , (v) => v.profile) + @OneToMany(() => ProfileFamilyCouple, (v) => v.profile) profileFamilyCouple: ProfileFamilyCouple[]; } @@ -309,22 +317,22 @@ export class CreateProfileEmployee { prefix: string; firstName: string; lastName: string; - position: string; - isProbation: boolean | null; - dateRetire: Date | null; + // position: string; + // isProbation: boolean | null; + // dateRetire: Date | null; birthDate: Date | null; salaryLevel: number | null; - ethnicity: string | null; - telephoneNumber: string | null; + // ethnicity: string | null; + // telephoneNumber: string | null; citizenId: string; - religion: string | null; + // religion: string | null; posLevelId: string | null; posTypeId: string | null; - gender: string | null; - relationship: string | null; - bloodGroup: string | null; - email: string | null; - phone: string | null; + // gender: string | null; + // relationship: string | null; + // bloodGroup: string | null; + // email: string | null; + // phone: string | null; } export type UpdateProfileEmployee = { @@ -332,9 +340,9 @@ export type UpdateProfileEmployee = { prefix?: string | null; firstName?: string | null; lastName?: string | null; - position?: string | null; - isProbation?: boolean | null; - dateRetire?: Date | null; + // position?: string | null; + // isProbation?: boolean | null; + // dateRetire?: Date | null; birthDate?: Date | null; salaryLevel?: number | null; ethnicity?: string | null; diff --git a/src/migration/1715683984766-add_table_dateRetire.ts b/src/migration/1715683984766-add_table_dateRetire.ts new file mode 100644 index 00000000..5ddaf272 --- /dev/null +++ b/src/migration/1715683984766-add_table_dateRetire.ts @@ -0,0 +1,24 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class AddTableDateRetire1715683984766 implements MigrationInterface { + name = 'AddTableDateRetire1715683984766' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`dateRetireLaw\` datetime NULL COMMENT 'วันที่เกษียณอายุราชการตามกฏหมาย'`); + await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`dateRetireLaw\` datetime NULL COMMENT 'วันที่เกษียณอายุราชการตามกฏหมาย'`); + await queryRunner.query(`ALTER TABLE \`profile\` ADD \`dateRetireLaw\` datetime NULL COMMENT 'วันที่เกษียณอายุราชการตามกฏหมาย'`); + await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`dateRetireLaw\` datetime NULL COMMENT 'วันที่เกษียณอายุราชการตามกฏหมาย'`); + await queryRunner.query(`ALTER TABLE \`profileEmployee\` CHANGE \`dateRetire\` \`dateRetire\` datetime NULL COMMENT 'วันครบเกษียณอายุ'`); + await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` CHANGE \`dateRetire\` \`dateRetire\` datetime NULL COMMENT 'วันครบเกษียณอายุ'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` CHANGE \`dateRetire\` \`dateRetire\` datetime NULL COMMENT 'วันที่พักราชการ'`); + await queryRunner.query(`ALTER TABLE \`profileEmployee\` CHANGE \`dateRetire\` \`dateRetire\` datetime NULL COMMENT 'วันที่พักราชการ'`); + await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`dateRetireLaw\``); + await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`dateRetireLaw\``); + await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`dateRetireLaw\``); + await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`dateRetireLaw\``); + } + +}