update airport, holiday, position

This commit is contained in:
Narul Hidayah
2025-12-31 02:41:34 +07:00
parent fab89895f0
commit 6525af21ea
5 changed files with 221 additions and 1 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -1 +1,6 @@
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"

15
src/types/hrms_holiday.ts Normal file
View File

@ -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, string> = {
[HolidayType.NATIONAL]: "National Holiday",
[HolidayType.COLLECTIVE]: "Collective Leave",
[HolidayType.COMPANY]: "Company Holiday",
[HolidayType.RELIGIOUS]: "Religious Holiday",
[HolidayType.SPECIAL]: "Special Holiday",
};