SalaryPeriod Entity
This commit is contained in:
parent
e2168292ea
commit
061be20d3b
2 changed files with 81 additions and 0 deletions
63
src/entities/SalarysPeriod.ts
Normal file
63
src/entities/SalarysPeriod.ts
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
|
||||
@Entity("salaryPeriod")
|
||||
export class SalaryPeriod extends EntityBase {
|
||||
@Column({
|
||||
comment: "ประเภทผัง (SPECIAL->รอบพิเศษ,APR->รอบเมษายน,OCT->รอบตุลาคม)",
|
||||
length: 255,
|
||||
})
|
||||
period: string;
|
||||
|
||||
@Column({
|
||||
comment: "สถานะการใช้งาน",
|
||||
default: false,
|
||||
})
|
||||
isActive: boolean;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: "datetime",
|
||||
comment: "วันที่มีผลบังคับใช้",
|
||||
})
|
||||
effectiveDate: Date;
|
||||
|
||||
@Column({
|
||||
comment: "สถานะ",
|
||||
length: 255,
|
||||
default: "PENDING",
|
||||
})
|
||||
status?: string;
|
||||
|
||||
}
|
||||
|
||||
export class CreateSalaryPeriod {
|
||||
|
||||
@Column()
|
||||
period: string;
|
||||
|
||||
@Column()
|
||||
isActive: boolean;
|
||||
|
||||
@Column()
|
||||
effectiveDate: Date;
|
||||
|
||||
@Column()
|
||||
status?: string;
|
||||
}
|
||||
|
||||
export class UpdateSalaryPeriod {
|
||||
|
||||
@Column()
|
||||
period: string;
|
||||
|
||||
@Column()
|
||||
isActive: boolean;
|
||||
|
||||
@Column()
|
||||
effectiveDate: Date;
|
||||
|
||||
@Column()
|
||||
status?: string;
|
||||
|
||||
}
|
||||
18
src/migration/1708585607075-create_salaryPeriod_table.ts
Normal file
18
src/migration/1708585607075-create_salaryPeriod_table.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class CreateSalaryPeriodTable1708585607075 implements MigrationInterface {
|
||||
name = 'CreateSalaryPeriodTable1708585607075'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`CREATE TABLE \`salaryPeriod\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`period\` varchar(255) NOT NULL COMMENT 'ประเภทผัง (SPECIAL->รอบพิเศษ,APR->รอบเมษายน,OCT->รอบตุลาคม)', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`effectiveDate\` datetime NULL COMMENT 'วันที่มีผลบังคับใช้', \`status\` varchar(255) NOT NULL COMMENT 'สถานะ' DEFAULT 'PENDING', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`ALTER TABLE \`salarys\` ADD CONSTRAINT \`FK_fa211557e2cbee0bb3bbef363f2\` FOREIGN KEY (\`posTypeId\`) REFERENCES \`posType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`salarys\` ADD CONSTRAINT \`FK_683719e5363cc977da591556731\` FOREIGN KEY (\`posLevelId\`) REFERENCES \`posLevel\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`salarys\` DROP FOREIGN KEY \`FK_683719e5363cc977da591556731\``);
|
||||
await queryRunner.query(`ALTER TABLE \`salarys\` DROP FOREIGN KEY \`FK_fa211557e2cbee0bb3bbef363f2\``);
|
||||
await queryRunner.query(`DROP TABLE \`salaryPeriod\``);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue