update
This commit is contained in:
@ -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,166 +12,165 @@ import { Munisipo } from "../munisipo";
|
|||||||
|
|
||||||
@Entity("hrms_employees", { schema: "hrms" })
|
@Entity("hrms_employees", { schema: "hrms" })
|
||||||
export class HrmsEmployee {
|
export class HrmsEmployee {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
@PrimaryGeneratedColumn("uuid")
|
@Column({ length: 32, unique: true })
|
||||||
id: string;
|
employee_id: string;
|
||||||
|
|
||||||
@Column({ length: 32, unique: true })
|
@Column({ length: 32, unique: true })
|
||||||
employee_id: string;
|
device_user_id: string;
|
||||||
|
|
||||||
@Column({ length: 32, unique: true })
|
@Column({ length: 128 })
|
||||||
device_user_id: string;
|
name: string;
|
||||||
|
|
||||||
@Column({ length: 128 })
|
@Column({ length: 64 })
|
||||||
name: string;
|
place_birth: string;
|
||||||
|
|
||||||
@Column({ length: 64 })
|
@Column({ type: "date" })
|
||||||
place_birth: string;
|
birth_date: Date;
|
||||||
|
|
||||||
@Column({ type: "date" })
|
@Column({ length: 16 })
|
||||||
birth_date: Date;
|
gender: string;
|
||||||
|
|
||||||
@Column({ length: 16 })
|
@Column({ length: 32 })
|
||||||
gender: string;
|
phone: string;
|
||||||
|
|
||||||
@Column({ length: 32 })
|
@Column({ length: 128 })
|
||||||
phone: string;
|
email: string;
|
||||||
|
|
||||||
@Column({ length: 128 })
|
@ManyToOne(() => Nationality)
|
||||||
email: string;
|
@JoinColumn({ name: "nationality_id" })
|
||||||
|
nationality: Nationality;
|
||||||
|
|
||||||
@ManyToOne(() => Nationality)
|
@Column({ length: 64 })
|
||||||
@JoinColumn({ name: "nationality_id" })
|
last_education: string;
|
||||||
nationality: Nationality;
|
|
||||||
|
|
||||||
@Column({ length: 64 })
|
@Column({ nullable: true, length: 256 })
|
||||||
last_education: string;
|
photo_url: string;
|
||||||
|
|
||||||
@Column({ nullable: true, length: 256 })
|
@Column({ nullable: true, length: 512 })
|
||||||
photo_url: string;
|
employee_file_url: string;
|
||||||
|
|
||||||
@Column({ nullable: true, length: 512 })
|
@ManyToOne(() => Aldeia)
|
||||||
employee_file_url: string;
|
@JoinColumn({ name: "aldeia_id" })
|
||||||
|
aldeia: Aldeia;
|
||||||
|
|
||||||
@ManyToOne(() => Aldeia)
|
@ManyToOne(() => Suco)
|
||||||
@JoinColumn({ name: "aldeia_id" })
|
@JoinColumn({ name: "suco_id" })
|
||||||
aldeia: Aldeia;
|
suco: Suco;
|
||||||
|
|
||||||
@ManyToOne(() => Suco)
|
@ManyToOne(() => Administrativu)
|
||||||
@JoinColumn({ name: "suco_id" })
|
@JoinColumn({ name: "administrativu_id" })
|
||||||
suco: Suco;
|
administrativu: Administrativu;
|
||||||
|
|
||||||
@ManyToOne(() => Administrativu)
|
@ManyToOne(() => Munisipo)
|
||||||
@JoinColumn({ name: "administrativu_id" })
|
@JoinColumn({ name: "munisipo_id" })
|
||||||
administrativu: Administrativu;
|
munisipo: Munisipo;
|
||||||
|
|
||||||
@ManyToOne(() => Munisipo)
|
@Column({ length: 256 })
|
||||||
@JoinColumn({ name: "munisipo_id" })
|
street: string;
|
||||||
munisipo: Munisipo;
|
|
||||||
|
|
||||||
@Column({ length: 256 })
|
@ManyToOne(() => HrmsAirport)
|
||||||
street: string;
|
@JoinColumn({ name: "airport_id" })
|
||||||
|
airport: HrmsAirport;
|
||||||
|
|
||||||
@ManyToOne(() => HrmsAirport)
|
@ManyToOne(() => HrmsDepartment)
|
||||||
@JoinColumn({ name: "airport_id" })
|
@JoinColumn({ name: "department_id" })
|
||||||
airport: HrmsAirport;
|
department: HrmsDepartment;
|
||||||
|
|
||||||
@ManyToOne(() => HrmsDepartment)
|
@ManyToOne(() => HrmsPosition)
|
||||||
@JoinColumn({ name: "department_id" })
|
@JoinColumn({ name: "position_id" })
|
||||||
department: HrmsDepartment;
|
position: HrmsPosition;
|
||||||
|
|
||||||
@ManyToOne(() => HrmsPosition)
|
@ManyToOne(() => HrmsShift)
|
||||||
@JoinColumn({ name: "position_id" })
|
@JoinColumn({ name: "shift_id" })
|
||||||
position: HrmsPosition;
|
shift: HrmsShift;
|
||||||
|
|
||||||
@ManyToOne(() => HrmsShift)
|
@Column({ type: "int" })
|
||||||
@JoinColumn({ name: "shift_id" })
|
yearly_leave_quota: number;
|
||||||
shift: HrmsShift;
|
|
||||||
|
|
||||||
@Column({ type: "int" })
|
@Column({ length: 128 })
|
||||||
yearly_leave_quota: number;
|
emergency_name: string;
|
||||||
|
|
||||||
@Column({ length: 128 })
|
@Column({ length: 32 })
|
||||||
emergency_name: string;
|
emergency_phone: string;
|
||||||
|
|
||||||
@Column({ length: 32 })
|
@Column({ length: 64 })
|
||||||
emergency_phone: string;
|
emergency_relation: string;
|
||||||
|
|
||||||
@Column({ length: 64 })
|
@Column({ length: 128, nullable: true })
|
||||||
emergency_relation: string;
|
electoral_number: string;
|
||||||
|
|
||||||
@Column({ length: 128, nullable: true })
|
@Column({ type: "date", nullable: true })
|
||||||
electoral_number: string;
|
electoral_expired_at: Date;
|
||||||
|
|
||||||
@Column({ type: "date", nullable: true })
|
@Column({ length: 256, nullable: true })
|
||||||
electoral_expired_at: Date;
|
electoral_file_url: string;
|
||||||
|
|
||||||
@Column({ length: 256, nullable: true })
|
@Column({ length: 128, nullable: true })
|
||||||
electoral_file_url: string;
|
bi_number: string;
|
||||||
|
|
||||||
@Column({ length: 128, nullable: true })
|
@Column({ type: "date", nullable: true })
|
||||||
bi_number: string;
|
bi_expired_at: Date;
|
||||||
|
|
||||||
@Column({ type: "date", nullable: true })
|
@Column({ length: 256, nullable: true })
|
||||||
bi_expired_at: Date;
|
bi_file_url: string;
|
||||||
|
|
||||||
@Column({ length: 256, nullable: true })
|
@Column({ length: 128, nullable: true })
|
||||||
bi_file_url: string;
|
niss_number: string;
|
||||||
|
|
||||||
@Column({ length: 128, nullable: true })
|
@Column({ type: "date", nullable: true })
|
||||||
niss_number: string;
|
niss_expired_at: Date;
|
||||||
|
|
||||||
@Column({ type: "date", nullable: true })
|
@Column({ length: 256, nullable: true })
|
||||||
niss_expired_at: Date;
|
niss_file_url: string;
|
||||||
|
|
||||||
@Column({ length: 256, nullable: true })
|
@Column({ length: 128, nullable: true })
|
||||||
niss_file_url: string;
|
passport_number: string;
|
||||||
|
|
||||||
@Column({ length: 128, nullable: true })
|
@Column({ type: "date", nullable: true })
|
||||||
passport_number: string;
|
passport_expired_at: Date;
|
||||||
|
|
||||||
@Column({ type: "date", nullable: true })
|
@Column({ length: 256, nullable: true })
|
||||||
passport_expired_at: Date;
|
passport_file_url: string;
|
||||||
|
|
||||||
@Column({ length: 256, nullable: true })
|
@Column({ length: 128, nullable: true })
|
||||||
passport_file_url: string;
|
visa_number: string;
|
||||||
|
|
||||||
@Column({ length: 128, nullable: true })
|
@Column({ type: "date", nullable: true })
|
||||||
visa_number: string;
|
visa_expired_at: Date;
|
||||||
|
|
||||||
@Column({ type: "date", nullable: true })
|
@Column({ length: 256, nullable: true })
|
||||||
visa_expired_at: Date;
|
visa_file_url: string;
|
||||||
|
|
||||||
@Column({ length: 256, nullable: true })
|
@Column({ length: 128, nullable: true })
|
||||||
visa_file_url: string;
|
pr_number: string;
|
||||||
|
|
||||||
@Column({ length: 128, nullable: true })
|
@Column({ type: "date", nullable: true })
|
||||||
pr_number: string;
|
pr_expired_at: Date;
|
||||||
|
|
||||||
@Column({ type: "date", nullable: true })
|
@Column({ length: 256, nullable: true })
|
||||||
pr_expired_at: Date;
|
pr_file_url: string;
|
||||||
|
|
||||||
@Column({ length: 256, nullable: true })
|
@Column({ length: 64 })
|
||||||
pr_file_url: string;
|
status: Status;
|
||||||
|
|
||||||
@Column({ length: 64 })
|
@CreateDateColumn()
|
||||||
status: Status;
|
created_at: Date;
|
||||||
|
|
||||||
@CreateDateColumn()
|
@Column({ nullable: true, length: 256 })
|
||||||
created_at: Date;
|
created_by: string;
|
||||||
|
|
||||||
@Column({ nullable: true, length: 256 })
|
@UpdateDateColumn({ nullable: true })
|
||||||
created_by: string;
|
updated_at: Date;
|
||||||
|
|
||||||
@UpdateDateColumn({ nullable: true })
|
@Column({ nullable: true, length: 256 })
|
||||||
updated_at: Date;
|
updated_by: string;
|
||||||
|
|
||||||
@Column({ nullable: true, length: 256 })
|
@DeleteDateColumn({ nullable: true })
|
||||||
updated_by: string;
|
deleted_at: Date;
|
||||||
|
|
||||||
@DeleteDateColumn({ nullable: true })
|
@Column({ nullable: true, length: 256 })
|
||||||
deleted_at: Date;
|
deleted_by: string;
|
||||||
|
|
||||||
@Column({ nullable: true, length: 256 })
|
|
||||||
deleted_by: string;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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 {
|
||||||
|
|||||||
@ -1,84 +1,82 @@
|
|||||||
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;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
length: 64,
|
length: 64,
|
||||||
unique: false,
|
unique: false,
|
||||||
})
|
})
|
||||||
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;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
@CreateDateColumn()
|
@CreateDateColumn()
|
||||||
created_at: Date;
|
created_at: Date;
|
||||||
|
|
||||||
@Column({ nullable: true })
|
@Column({ nullable: true })
|
||||||
@UpdateDateColumn()
|
@UpdateDateColumn()
|
||||||
updated_at: Date;
|
updated_at: Date;
|
||||||
|
|
||||||
@Column({ nullable: true })
|
@Column({ nullable: true })
|
||||||
@DeleteDateColumn()
|
@DeleteDateColumn()
|
||||||
deleted_at: Date;
|
deleted_at: Date;
|
||||||
|
|
||||||
hashPassword() {
|
hashPassword() {
|
||||||
this.password = bcrypt.hashSync(this.password, 8);
|
this.password = bcrypt.hashSync(this.password, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkIfPasswordMatch(unencryptedPassword: string) {
|
checkIfPasswordMatch(unencryptedPassword: string) {
|
||||||
return bcrypt.compareSync(unencryptedPassword, this.password);
|
return bcrypt.compareSync(unencryptedPassword, this.password);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user