From 6525af21ea9f4aa9e7b568756f3dfceb26ab88b1 Mon Sep 17 00:00:00 2001 From: Narul Hidayah Date: Wed, 31 Dec 2025 02:41:34 +0700 Subject: [PATCH] update airport, holiday, position --- src/entity/hrms/hrms_airport.ts | 56 +++++++++++++++++++++++ src/entity/hrms/hrms_holiday.ts | 78 ++++++++++++++++++++++++++++++++ src/entity/hrms/hrms_position.ts | 66 +++++++++++++++++++++++++++ src/schema/hrms.ts | 7 ++- src/types/hrms_holiday.ts | 15 ++++++ 5 files changed, 221 insertions(+), 1 deletion(-) create mode 100644 src/entity/hrms/hrms_airport.ts create mode 100644 src/entity/hrms/hrms_holiday.ts create mode 100644 src/entity/hrms/hrms_position.ts create mode 100644 src/types/hrms_holiday.ts diff --git a/src/entity/hrms/hrms_airport.ts b/src/entity/hrms/hrms_airport.ts new file mode 100644 index 0000000..79fb28e --- /dev/null +++ b/src/entity/hrms/hrms_airport.ts @@ -0,0 +1,56 @@ +import { Entity, PrimaryGeneratedColumn, Column, OneToMany, PrimaryColumn, CreateDateColumn, UpdateDateColumn, DeleteDateColumn } from "typeorm"; +import { Status } from "../../types/status"; + +@Entity("hrms_airports", { schema: "hrms" }) +export class HrmsAirport { + @PrimaryGeneratedColumn('uuid') + id: string; + + @Column({ + nullable: false, + unique: false, + length: 64 + }) + code: string; + + @Column({ + nullable: false, + unique: false, + length: 64 + }) + name: string; + + @Column({ + nullable: true, + unique: false, + length: 64 + }) + description: string; + + @Column({ + nullable: false, + length: 64 + }) + status: Status; + + @Column() + @CreateDateColumn() + created_at: Date; + + @Column({ nullable: true, length: 256 }) + created_by: string; + + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; + + @Column({ nullable: true, length: 256 }) + updated_by: string; + + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; + + @Column({ nullable: true, length: 256 }) + deleted_by: string; +} diff --git a/src/entity/hrms/hrms_holiday.ts b/src/entity/hrms/hrms_holiday.ts new file mode 100644 index 0000000..22b227a --- /dev/null +++ b/src/entity/hrms/hrms_holiday.ts @@ -0,0 +1,78 @@ +import { + Entity, + PrimaryGeneratedColumn, + Column, + CreateDateColumn, + UpdateDateColumn, + DeleteDateColumn +} from "typeorm"; +import { Status } from "../../types/status"; +import { HolidayType } from "../../types/hrms_holiday"; + +@Entity("hrms_holidays", { schema: "hrms" }) +export class HrmsHoliday { + + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + type: "enum", + enum: HolidayType, + nullable: false + }) + type: HolidayType; + + @Column({ + type: "date", + nullable: false + }) + start_date: Date; + + @Column({ + type: "date", + nullable: false + }) + end_date: Date; + + @Column({ + type: "int", + nullable: false + }) + working_days: number; + + @Column({ + nullable: false, + length: 128 + }) + name: string; + + @Column({ + nullable: true, + length: 256 + }) + description: string; + + @Column({ + nullable: false, + length: 64 + }) + status: Status; + + @CreateDateColumn() + created_at: Date; + + @Column({ nullable: true, length: 256 }) + created_by: string; + + @UpdateDateColumn({ nullable: true }) + updated_at: Date; + + @Column({ nullable: true, length: 256 }) + updated_by: string; + + @DeleteDateColumn({ nullable: true }) + deleted_at: Date; + + @Column({ nullable: true, length: 256 }) + deleted_by: string; +} diff --git a/src/entity/hrms/hrms_position.ts b/src/entity/hrms/hrms_position.ts new file mode 100644 index 0000000..75e292d --- /dev/null +++ b/src/entity/hrms/hrms_position.ts @@ -0,0 +1,66 @@ +import { Entity, PrimaryGeneratedColumn, Column, OneToMany, PrimaryColumn, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinColumn } from "typeorm"; +import { Status } from "../../types/status"; + +@Entity("hrms_positions", { schema: "hrms" }) +export class HrmsPosition { + @PrimaryGeneratedColumn('uuid') + id: string; + + @Column({ + nullable: false, + unique: false, + length: 64 + }) + code: string; + + @Column({ + nullable: false, + unique: false, + length: 64 + }) + name: string; + + @Column({ + nullable: true, + unique: false, + length: 64 + }) + description: string; + + @ManyToOne(() => HrmsPosition, position => position.children, { + nullable: true, + onDelete: "SET NULL" + }) + @JoinColumn({ name: "parent_id" }) + parent: HrmsPosition; + + @OneToMany(() => HrmsPosition, position => position.parent) + children: HrmsPosition[]; + + @Column({ + nullable: false, + length: 64 + }) + status: Status; + + @Column() + @CreateDateColumn() + created_at: Date; + + @Column({ nullable: true, length: 256 }) + created_by: string; + + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; + + @Column({ nullable: true, length: 256 }) + updated_by: string; + + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; + + @Column({ nullable: true, length: 256 }) + deleted_by: string; +} diff --git a/src/schema/hrms.ts b/src/schema/hrms.ts index e9f869b..d5bed62 100644 --- a/src/schema/hrms.ts +++ b/src/schema/hrms.ts @@ -1 +1,6 @@ -export * from "../entity/hrms/hrms_department" \ No newline at end of file +export * from "../entity/hrms/hrms_department" +export * from "../entity/hrms/hrms_airport" +export * from "../entity/hrms/hrms_position" +export * from "../entity/hrms/hrms_holiday" + +export * from "../types/hrms_holiday" \ No newline at end of file diff --git a/src/types/hrms_holiday.ts b/src/types/hrms_holiday.ts new file mode 100644 index 0000000..0a63f2a --- /dev/null +++ b/src/types/hrms_holiday.ts @@ -0,0 +1,15 @@ +export enum HolidayType { + NATIONAL = "NH", // National Holiday + COLLECTIVE = "CL", // Collective Leave / Cuti Bersama + COMPANY = "CH", // Company Holiday + RELIGIOUS = "RH", // Religious Holiday + SPECIAL = "SH", // Special / Exceptional Holiday +} + +export const HolidayTypeLabel: Record = { + [HolidayType.NATIONAL]: "National Holiday", + [HolidayType.COLLECTIVE]: "Collective Leave", + [HolidayType.COMPANY]: "Company Holiday", + [HolidayType.RELIGIOUS]: "Religious Holiday", + [HolidayType.SPECIAL]: "Special Holiday", +}; \ No newline at end of file