diff --git a/src/entity/earchive_doc.ts b/src/entity/earchive_doc.ts index 512ad41..b2c802b 100644 --- a/src/entity/earchive_doc.ts +++ b/src/entity/earchive_doc.ts @@ -1,16 +1,94 @@ -import { Column, CreateDateColumn, DeleteDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { User } from "./users"; +import { StatusDocument, TypeDocument, TypePriority } from "../types/earchive"; +import { EarchiveDocLogs } from "./earchive_doclogs"; @Entity("earchive_doc", { schema: "earchive" }) export class EarchiveDoc { @PrimaryGeneratedColumn("uuid") id: string; + @Column({ nullable: true }) + docnumber: string; + + @Column({ nullable: true }) + docsubject: string; + + @Column({ nullable: true }) + doctype: TypeDocument; + + @Column({ nullable: true }) + doctypename: string; + + @Column({ nullable: true }) + docpriority: TypePriority; + + @Column({ nullable: true }) + companyname: string; + + @Column({ name: 'docdates', nullable: true }) + docdates: Date; + + @Column({ name: 'approvalbyid', type: 'uuid', nullable: true }) + approvalbyid: string; + + // @OneToOne(() => User, { nullable: true }) + // @JoinColumn({ name: 'approvalbyid' }) + // approvalby: User + + @Column({ name: 'approvaldate', nullable: true }) + approvaldate: Date; + + @Column({ name: 'dispositionbyid', type: 'uuid', nullable: true }) + dispositionbyid: string; + + // @OneToOne(() => User, { nullable: true }) + // @JoinColumn({ name: 'dispositionbyid' }) + // dispositionby: User + + @Column({ name: 'dispositiondate', nullable: true }) + dispositiondate: Date; + + @Column({ name: 'attachdoc', nullable: true }) + attachdoc: string; + + @Column({ name: 'attachdocurl', nullable: true }) + attachdocurl: string; + + @Column({ name: 'attachlink', nullable: true }) + attachlink: string; + + @Column({ type: 'text', nullable: true }) + content: string; + + @Column({ type: 'int', nullable: true }) + statusdoc: StatusDocument; + + @Column({ type: 'text', nullable: true }) + statusdocdesc: string; + + @Column({ name: 'laststatusdate', nullable: true }) + laststatusdate: Date; + + @Column({ type: 'text', nullable: true }) + remarks: string; + + @OneToMany(() => EarchiveDocLogs, (ipo) => ipo.docs, { + cascade: false, + nullable: true, + }) + logs: EarchiveDocLogs; + @Column() @CreateDateColumn() created_at: Date; - @Column({ nullable: true, length: 256 }) - created_by: string; + @Column({ name: 'createdbyid', type: 'uuid', nullable: true }) + createdbyid: string; + + @ManyToOne(() => User, { nullable: true }) + @JoinColumn({ name: 'createdbyid' }) + createdby: User @Column({ nullable: true }) @UpdateDateColumn() @@ -26,3 +104,5 @@ export class EarchiveDoc { @Column({ nullable: true, length: 256 }) deleted_by: string; } + + diff --git a/src/entity/earchive_doclogs.ts b/src/entity/earchive_doclogs.ts new file mode 100644 index 0000000..466a2cd --- /dev/null +++ b/src/entity/earchive_doclogs.ts @@ -0,0 +1,56 @@ +import { Column, Entity, DeleteDateColumn, PrimaryGeneratedColumn, ManyToOne, JoinColumn, UpdateDateColumn } from "typeorm"; +import { EarchiveDoc } from "./earchive_doc"; +import { User } from "./users"; + +@Entity("earchive_doclogs", { schema: "earchive" }) +export class EarchiveDocLogs { + @PrimaryGeneratedColumn('uuid') + id: string; + + @ManyToOne(() => EarchiveDoc, { onDelete: "CASCADE", nullable: true }) + @JoinColumn({ name: 'docs' }) + docs: EarchiveDoc; + + @Column("smallint", { name: "status", nullable: false, default: 0 }) + status: number; + + @Column({ nullable: true }) + statusdescription: string; + + @Column({ nullable: true }) + remark: string; + + @Column({ name: 'createdbyid', type: 'uuid', nullable: true }) + createdbyid: string; + + @ManyToOne(() => User, (ipo) => ipo.id, { + cascade: false, + nullable: true + }) + @JoinColumn({ name: 'createdbyid' }) + createdby: User; + + @Column("timestamp", { + name: "created_at", + default: () => "CURRENT_TIMESTAMP", + }) + createdAt: Date; + + @Column({ nullable: true }) + updated_by: string; + + @Column("timestamp", { + name: "updated_at", + nullable: true + }) + @UpdateDateColumn() + updatedAt: Date; + + @Column({ nullable: true }) + deleted_by: string; + + @Column("timestamp", { name: "deleted_at", nullable: true }) + @DeleteDateColumn() + deletedAt: Date | null; + +} diff --git a/src/entity/earchive_receiver.ts b/src/entity/earchive_receiver.ts new file mode 100644 index 0000000..3d476ce --- /dev/null +++ b/src/entity/earchive_receiver.ts @@ -0,0 +1,48 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, OneToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { User } from "./users"; +import { EarchiveDoc } from "./earchive_doc"; +import { TypeReceiver } from "../types/earchive"; + +@Entity("earchive_receiver", { schema: "earchive" }) +export class EarchiveReceiver { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ name: 'docid', type: 'uuid', nullable: true }) + docid: string; + + @ManyToOne(() => EarchiveDoc, { nullable: true }) + @JoinColumn({ name: 'docid' }) + doc: EarchiveDoc; + + @Column({ name: 'typereceiver', nullable: true }) + typereceiver: TypeReceiver; + + @Column({ name: 'uuidreceiver', type: 'uuid', nullable: true }) + uuidreceiver: string; + + @Column() + @CreateDateColumn() + created_at: Date; + + @Column({ name: 'createdbyid', type: 'uuid', nullable: true }) + createdbyid: string; + + @ManyToOne(() => User, { nullable: true }) + @JoinColumn({ name: 'createdbyid' }) + createdby: User + + @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_dept.ts b/src/entity/hrms_dept.ts new file mode 100644 index 0000000..95ffcae --- /dev/null +++ b/src/entity/hrms_dept.ts @@ -0,0 +1,53 @@ +import { Entity, PrimaryGeneratedColumn, Column, OneToMany, PrimaryColumn } from "typeorm"; +// import { Employee } from "./hrms_employee"; + +@Entity("tbl_employeedept", { schema: "hrms", synchronize: false }) +export class EmployeeDept { + @PrimaryColumn("uuid", { name: "uuid" }) + uuid: string; + + @Column({ type: "int", nullable: true }) + _idx: number; + + @Column({ type: "varchar", length: 80, nullable: true }) + deptname: string; + + @Column({ type: "varchar", length: 30, nullable: true }) + nikspv: string; + + @Column({ type: "varchar", length: 30, nullable: true }) + nikmgr: string; + + @Column({ type: "smallint", nullable: true }) + idxdivisi: number; + + // @OneToMany(() => Employee, (emp) => emp.dept) + // employees: Employee[]; + + @Column({ type: "smallint", nullable: true }) + isdeleted: number; + + @Column({ type: "varchar", length: 200, nullable: true }) + remarkdeleted: string; + + @Column({ type: "varchar", length: 30, nullable: true }) + iby: string; + + @Column({ type: "timestamp", nullable: true }) + idt: Date; + + @Column({ type: "varchar", length: 30, nullable: true }) + uby: string; + + @Column({ type: "timestamp", nullable: true }) + udt: Date; + + @Column({ type: "varchar", length: 30, nullable: true }) + dby: string; + + @Column({ type: "timestamp", nullable: true }) + ddt: Date; + + @Column({ type: "varchar", length: 50, nullable: true }) + nikgm: string; +} diff --git a/src/entity/hrms_employee.ts b/src/entity/hrms_employee.ts new file mode 100644 index 0000000..9fed5e9 --- /dev/null +++ b/src/entity/hrms_employee.ts @@ -0,0 +1,138 @@ +import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn, PrimaryColumn } from "typeorm"; +// import { EmployeeDept } from "./hrms_dept"; + +@Entity("tbl_employee", { schema: "hrms", synchronize: false }) +export class Employee { + @PrimaryColumn("uuid", { name: "uuid" }) + uuid: string; + + @Column({ type: "int", nullable: true }) + _idx: number; + + @Column({ type: "int", nullable: true }) + fingerid: number; + + @Column({ type: "varchar", length: 30, nullable: true }) + nik: string; + + @Column({ type: "varchar", length: 100, nullable: true }) + employeename: string; + + @Column({ type: "varchar", length: 100, nullable: true }) + title: string; + + @Column({ type: "smallint", nullable: true }) + idxlevel: number; + + @Column({ type: "smallint", nullable: true }) + idxdept: number; + + // @ManyToOne(() => EmployeeDept, (dept) => dept.employees, { eager: false }) + // @JoinColumn({ name: "idxdept", referencedColumnName: "_idx" }) + // dept: EmployeeDept; + + @Column({ type: "int", nullable: true }) + idxdirecao: number; + + @Column({ type: "smallint", nullable: true }) + idxservico: number; + + @Column({ type: "varchar", length: 300, nullable: true }) + idxdeptaccessatt: string; + + @Column({ type: "varchar", length: 200, nullable: true }) + address: string; + + @Column({ type: "varchar", length: 30, nullable: true }) + telp: string; + + @Column({ type: "varchar", length: 80, nullable: true }) + email: string; + + @Column({ type: "smallint", nullable: true }) + idxoffice: number; + + @Column({ type: "varchar", length: 100, nullable: true }) + picemployee: string; + + @Column({ type: "smallint", nullable: true }) + isactivated: number; + + @Column({ type: "smallint", nullable: true }) + isdeleted: number; + + @Column({ type: "varchar", length: 200, nullable: true }) + remarkdeleted: string; + + @Column({ type: "varchar", length: 30, nullable: true }) + iby: string; + + @Column({ type: "timestamp", nullable: true }) + idt: Date; + + @Column({ type: "varchar", length: 30, nullable: true }) + uby: string; + + @Column({ type: "timestamp", nullable: true }) + udt: Date; + + @Column({ type: "varchar", length: 30, nullable: true }) + dby: string; + + @Column({ type: "timestamp", nullable: true }) + ddt: Date; + + @Column({ type: "varchar", length: 200, nullable: true }) + pass: string; + + @Column({ type: "varchar", length: 50, nullable: true }) + job_grade: string; + + @Column({ type: "varchar", length: 50, nullable: true }) + status: string; + + @Column({ type: "varchar", length: 100, nullable: true }) + passportnumber: string; + + @Column({ type: "date", nullable: true }) + passportexpdate: Date; + + @Column({ type: "varchar", length: 100, nullable: true }) + visanumber: string; + + @Column({ type: "date", nullable: true }) + visaexpdate: Date; + + @Column({ type: "varchar", length: 100, nullable: true }) + eleitoralnumber: string; + + @Column({ type: "varchar", length: 100, nullable: true }) + familynumber: string; + + @Column({ type: "date", nullable: true }) + startworking: Date; + + @Column({ type: "date", nullable: true }) + tmt: Date; + + @Column({ type: "date", nullable: true }) + birthdate: Date; + + @Column({ type: "varchar", length: 100, nullable: true }) + relationwithemployee: string; + + @Column({ type: "varchar", length: 50, nullable: true }) + username: string; + + @Column({ type: "text", nullable: true }) + idcard: string; + + @Column({ type: "text", nullable: true }) + educationbackground: string; + + @Column({ type: "text", nullable: true }) + familycertificate: string; + + @Column({ type: "text", nullable: true }) + passport: string; +} diff --git a/src/schema/earchive.ts b/src/schema/earchive.ts index 1b6e56c..d8e8483 100644 --- a/src/schema/earchive.ts +++ b/src/schema/earchive.ts @@ -1,2 +1,5 @@ export * from "../entity/earchive_doc"; export * from "../entity/earchive_doctype"; +export * from "../entity/earchive_doclogs"; +export * from "../entity/earchive_receiver"; +export * from "../types/earchive"; \ No newline at end of file diff --git a/src/schema/hrms.ts b/src/schema/hrms.ts index fbf68df..2ff7ded 100644 --- a/src/schema/hrms.ts +++ b/src/schema/hrms.ts @@ -1 +1,3 @@ export * from "../entity/log_hikvision"; +export * from "../entity/hrms_employee"; +export * from "../entity/hrms_dept"; diff --git a/src/types/earchive.ts b/src/types/earchive.ts index a4cdd9e..5a62eb2 100644 --- a/src/types/earchive.ts +++ b/src/types/earchive.ts @@ -6,3 +6,22 @@ export enum StatusDocument { "disposition" = 2, }; +export enum TypeDocument { + "Nota_Dinas" = "ND", + "Surat_Internal" = "SI", + "Surat_Undangan" = "SU", + "Surat_Keputusan" = "SK", + "Surat_Eksternal" = "SE", + "Surat_Izin_Prinsip" = "SIP" +}; + +export enum TypeReceiver { + "Personal" = "P", + "Department" = "D" +}; + +export enum TypePriority { + "Priority" = "P", + "Non Priority" = "NP" +}; +