This commit is contained in:
Narul Hidayah
2025-12-31 13:20:51 +07:00
parent af7a31fd56
commit 3e4f092c4f
3 changed files with 119 additions and 0 deletions

View File

@ -0,0 +1,110 @@
import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
DeleteDateColumn,
ManyToOne,
JoinColumn,
} from "typeorm";
import { Status } from "../../types/status";
import { HrmsAirport } from "./hrms_airport";
import { HrmsDepartment } from "./hrms_department";
import { HrmsPosition } from "./hrms_position";
import { HrmsShift } from "./hrms_shift";
@Entity("hrms_employees", { schema: "hrms" })
export class HrmsEmployee {
@PrimaryGeneratedColumn("uuid")
id: string;
@Column({ length: 32, unique: true })
employee_id: string;
@Column({ length: 32, unique: true })
device_user_id: string;
@Column({ length: 128 })
name: string;
@Column({ length: 64 })
place_birth: string;
@Column({ type: "date" })
birth_date: Date;
@Column({ length: 16 })
gender: string;
@Column({ length: 32 })
phone: string;
@Column({ length: 128 })
email: string;
@Column({ length: 64 })
nationality: string;
@Column({ length: 64 })
last_education: string;
@Column({ nullable: true, length: 256 })
photo_url: string;
@Column({ length: 64 })
aldeia: string;
@Column({ length: 64 })
suco: string;
@Column({ length: 64 })
administrativu: string;
@Column({ length: 64 })
district: string;
@Column({ length: 256 })
street: string;
@ManyToOne(() => HrmsAirport)
@JoinColumn({ name: "airport_id" })
airport: HrmsAirport;
@ManyToOne(() => HrmsDepartment)
@JoinColumn({ name: "department_id" })
department: HrmsDepartment;
@ManyToOne(() => HrmsPosition)
@JoinColumn({ name: "position_id" })
position: HrmsPosition;
@ManyToOne(() => HrmsShift)
@JoinColumn({ name: "shift_id" })
shift: HrmsShift;
@Column({ type: "int" })
yearly_leave_quota: number;
@Column({ 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

@ -1,5 +1,6 @@
import { Entity, PrimaryGeneratedColumn, Column, OneToMany, PrimaryColumn, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinColumn } from "typeorm";
import { Status } from "../../types/status";
import { HrmsDepartment } from "./hrms_department";
@Entity("hrms_positions", { schema: "hrms" })
export class HrmsPosition {
@ -27,6 +28,13 @@ export class HrmsPosition {
})
description: string;
@ManyToOne(() => HrmsDepartment, {
nullable: false,
onDelete: "RESTRICT"
})
@JoinColumn({ name: "department_id" })
department: HrmsDepartment;
@ManyToOne(() => HrmsPosition, position => position.children, {
nullable: true,
onDelete: "SET NULL"

View File

@ -4,5 +4,6 @@ export * from "../entity/hrms/hrms_position"
export * from "../entity/hrms/hrms_holiday"
export * from "../entity/hrms/hrms_leave_type"
export * from "../entity/hrms/hrms_shift"
export * from "../entity/hrms/hrms_employee"
export * from "../types/hrms"