fix asset class and add employee

This commit is contained in:
fadlydev
2025-01-08 09:51:02 +07:00
parent 6adecd7663
commit c71937849a
3 changed files with 117 additions and 2 deletions

View File

@ -7,7 +7,7 @@
DeleteDateColumn,
} from 'typeorm';
@Entity('assetClassification')
@Entity('asset_classification')
export class AssetClassification {
@PrimaryGeneratedColumn('uuid')
id: string;

113
src/entity/employee.ts Normal file
View File

@ -0,0 +1,113 @@
import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
DeleteDateColumn,
Index,
ManyToOne,
JoinColumn,
} from 'typeorm';
import { Status } from '../types/status';
import { User } from './users';
@Entity('employees')
export class Employee {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({
nullable: false,
length: 64,
})
first_name: string;
@Column({
nullable: false,
length: 64,
})
last_name: string;
@Column({
nullable: false,
unique: true,
length: 128,
})
email: string;
@Column({
nullable: true,
length: 15,
})
phone_number: string;
@Column({
nullable: false,
length: 128,
})
position: string;
@Column({
nullable: true,
type: 'uuid',
})
branch_id: string;
@Column({
nullable: false,
type: 'date',
})
hired_date: Date;
@ManyToOne(() => Employee, { nullable: true })
@JoinColumn({ name: 'manager_id' })
manager: Employee;
@Column({
nullable: true,
type: 'uuid',
})
manager_id: string;
@Column({
nullable: false,
length: 64,
})
status: Status;
@ManyToOne(() => User, { nullable: true })
@JoinColumn({ name: 'created_by' })
createdBy: User;
@Index()
@Column({
nullable: true,
type: 'uuid',
})
created_by: string;
@ManyToOne(() => User, { nullable: true })
@JoinColumn({ name: 'updated_by' })
updatedBy: User;
@Index()
@Column({
nullable: true,
type: 'uuid',
})
updated_by: string;
@Column()
@CreateDateColumn()
created_at: Date;
@Column({ nullable: true })
@UpdateDateColumn()
updated_at: Date;
@Column({ nullable: true })
@DeleteDateColumn()
deleted_at: Date;
}

View File

@ -47,7 +47,8 @@ import { CreditApplication } from "./entity/credit_applications";
import { CreditApplicationStatus } from "./types/credit";
import { CreditApplicationForm } from "./entity/credit_application_forms";
import { Application } from "./entity/application";
import { AssetClassification } from "./assetClasification";
import { AssetClassification } from "./entity/asset_classification"
import { Employee } from "./entity/employee";
export {
User, //
UserRole,
@ -95,6 +96,7 @@ export {
Supplier,
AssetCategory,
AssetClassification,
Employee,
Ledger,
CreditCompany,
CreditDebtor,