This commit is contained in:
fro1991
2026-01-02 21:55:16 +07:00
parent 553d77b3e1
commit a2571781d9
3 changed files with 179 additions and 192 deletions

View File

@ -1,13 +1,4 @@
import { import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinColumn } from "typeorm";
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
DeleteDateColumn,
ManyToOne,
JoinColumn,
} from "typeorm";
import { Status } from "../../types/status"; import { Status } from "../../types/status";
import { HrmsAirport } from "./hrms_airport"; import { HrmsAirport } from "./hrms_airport";
import { HrmsDepartment } from "./hrms_department"; import { HrmsDepartment } from "./hrms_department";
@ -21,7 +12,6 @@ import { Munisipo } from "../munisipo";
@Entity("hrms_employees", { schema: "hrms" }) @Entity("hrms_employees", { schema: "hrms" })
export class HrmsEmployee { export class HrmsEmployee {
@PrimaryGeneratedColumn("uuid") @PrimaryGeneratedColumn("uuid")
id: string; id: string;

View File

@ -1,7 +1,6 @@
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, ManyToOne, JoinColumn } from "typeorm"; import { Column, CreateDateColumn, DeleteDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
import { Status } from "../../types/status"; import { Status } from "../../types/status";
import { HrmsEmployee } from "./hrms_employee";
@Entity("hrms_scholarships", { schema: "hrms" }) @Entity("hrms_scholarships", { schema: "hrms" })
export class HrmsScholarship { export class HrmsScholarship {

View File

@ -1,39 +1,37 @@
import bcrypt from 'bcryptjs'; import bcrypt from "bcryptjs";
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, OneToOne, JoinColumn, ManyToOne, OneToMany, ManyToMany, JoinTable } from 'typeorm'; import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, OneToOne, JoinColumn, ManyToOne, OneToMany, ManyToMany, JoinTable } from "typeorm";
import { Status } from '../types/status'; import { Status } from "../types/status";
import { UserRole } from './users_roles'; import { UserRole } from "./users_roles";
import { HrmsEmployee } from "./hrms/hrms_employee";
@Entity('users') @Entity("users")
export class User { export class User {
@PrimaryGeneratedColumn('uuid') @PrimaryGeneratedColumn("uuid")
id: string; id: string;
@Column({ @Column({
nullable: false, nullable: false,
unique: true, unique: true,
length: 64 length: 64,
}) })
email: string; email: string;
@Column({ @ManyToOne(() => HrmsEmployee, { onDelete: "NO ACTION", nullable: true })
nullable: true, @JoinTable()
unique: false, employee: HrmsEmployee;
length: 64
})
employee_id: string;
@Column({ @Column({
nullable: false, nullable: false,
length: 64, length: 64,
select: false select: false,
}) })
password: string; password: string;
@Column({ @Column({
nullable: false, nullable: false,
unique: true, unique: true,
length: 64 length: 64,
}) })
username: string; username: string;
@ -44,21 +42,21 @@ export class User {
}) })
name: string; name: string;
@ManyToMany(() => UserRole, { onDelete: 'CASCADE' }) @ManyToMany(() => UserRole, { onDelete: "CASCADE" })
@JoinTable() @JoinTable()
roles: UserRole[] roles: UserRole[];
@Index() @Index()
@Column({ @Column({
nullable: true, nullable: true,
type: 'uuid', type: "uuid",
select: false select: false,
}) })
reset_token: string; reset_token: string;
@Column({ @Column({
nullable: false, nullable: false,
length: 64 length: 64,
}) })
status: Status; status: Status;