adding department, request oder, request submission, and submission recap entity
This commit is contained in:
44
src/entity/department.ts
Normal file
44
src/entity/department.ts
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
Column,
|
||||||
|
CreateDateColumn,
|
||||||
|
UpdateDateColumn,
|
||||||
|
DeleteDateColumn,
|
||||||
|
} from 'typeorm';
|
||||||
|
|
||||||
|
@Entity('departments')
|
||||||
|
export class Department {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 128,
|
||||||
|
})
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 255,
|
||||||
|
})
|
||||||
|
description: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 64,
|
||||||
|
})
|
||||||
|
code: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
}
|
||||||
103
src/entity/request_orders.ts
Normal file
103
src/entity/request_orders.ts
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
Column,
|
||||||
|
CreateDateColumn,
|
||||||
|
UpdateDateColumn,
|
||||||
|
DeleteDateColumn,
|
||||||
|
Index,
|
||||||
|
ManyToOne,
|
||||||
|
JoinColumn,
|
||||||
|
OneToMany,
|
||||||
|
} from 'typeorm';
|
||||||
|
|
||||||
|
import { User } from './users';
|
||||||
|
import { Supplier } from './supplier';
|
||||||
|
import { Goods } from './goods';
|
||||||
|
|
||||||
|
export enum PurchasingMethod {
|
||||||
|
PO = 'PO', // Purchase Order
|
||||||
|
DP = 'DP', // Direct Purchase
|
||||||
|
}
|
||||||
|
|
||||||
|
@Entity('request_orders')
|
||||||
|
export class RequestOrder {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 128,
|
||||||
|
})
|
||||||
|
order_number: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'date',
|
||||||
|
})
|
||||||
|
order_date: Date;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'decimal',
|
||||||
|
precision: 12,
|
||||||
|
scale: 2,
|
||||||
|
})
|
||||||
|
total_amount: number;
|
||||||
|
|
||||||
|
@ManyToOne(() => Supplier, (supplier) => supplier.id, { nullable: false })
|
||||||
|
@JoinColumn({ name: 'supplier_id' })
|
||||||
|
supplier: Supplier;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'uuid',
|
||||||
|
})
|
||||||
|
supplier_id: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => User, (user) => user.id, { nullable: false })
|
||||||
|
@JoinColumn({ name: 'requested_by' })
|
||||||
|
requestedBy: User;
|
||||||
|
|
||||||
|
@Index()
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'uuid',
|
||||||
|
})
|
||||||
|
requested_by: string;
|
||||||
|
|
||||||
|
@OneToMany(() => Goods, (goods) => goods.id, { nullable: false })
|
||||||
|
@JoinColumn({ name: 'goods_ids' })
|
||||||
|
goods: Goods[];
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: 'text',
|
||||||
|
})
|
||||||
|
remarks: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 64,
|
||||||
|
})
|
||||||
|
status: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'enum',
|
||||||
|
enum: PurchasingMethod,
|
||||||
|
})
|
||||||
|
purchasing_method: PurchasingMethod;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
}
|
||||||
71
src/entity/request_submission.ts
Normal file
71
src/entity/request_submission.ts
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
Column,
|
||||||
|
CreateDateColumn,
|
||||||
|
UpdateDateColumn,
|
||||||
|
DeleteDateColumn,
|
||||||
|
Index,
|
||||||
|
ManyToOne,
|
||||||
|
JoinColumn,
|
||||||
|
} from 'typeorm';
|
||||||
|
|
||||||
|
import { User } from './users';
|
||||||
|
import { RequestOrder } from './request_orders';
|
||||||
|
|
||||||
|
@Entity('request_submissions')
|
||||||
|
export class RequestSubmission {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => RequestOrder, (order) => order.id, { nullable: false })
|
||||||
|
@JoinColumn({ name: 'request_order_id' })
|
||||||
|
requestOrder: RequestOrder;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'uuid',
|
||||||
|
})
|
||||||
|
request_order_id: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => User, (user) => user.id, { nullable: false })
|
||||||
|
@JoinColumn({ name: 'submitted_by' })
|
||||||
|
submittedBy: User;
|
||||||
|
|
||||||
|
@Index()
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'uuid',
|
||||||
|
})
|
||||||
|
submitted_by: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'date',
|
||||||
|
})
|
||||||
|
submission_date: Date;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: 'text',
|
||||||
|
})
|
||||||
|
remarks: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 64,
|
||||||
|
})
|
||||||
|
status: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
}
|
||||||
70
src/entity/request_submission_recap.ts
Normal file
70
src/entity/request_submission_recap.ts
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
Column,
|
||||||
|
CreateDateColumn,
|
||||||
|
UpdateDateColumn,
|
||||||
|
DeleteDateColumn,
|
||||||
|
} from 'typeorm';
|
||||||
|
|
||||||
|
@Entity('request_recapitulations')
|
||||||
|
export class RequestRecapitulation {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'date',
|
||||||
|
})
|
||||||
|
recap_date: Date;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'int',
|
||||||
|
})
|
||||||
|
total_requests: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'int',
|
||||||
|
})
|
||||||
|
total_approved: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'int',
|
||||||
|
})
|
||||||
|
total_rejected: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'int',
|
||||||
|
})
|
||||||
|
total_pending: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'decimal',
|
||||||
|
precision: 12,
|
||||||
|
scale: 2,
|
||||||
|
})
|
||||||
|
total_budget: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: 'text',
|
||||||
|
})
|
||||||
|
remarks: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
}
|
||||||
10
src/index.ts
10
src/index.ts
@ -50,7 +50,11 @@ import { Application } from "./entity/application";
|
|||||||
import { AssetClassification } from "./entity/asset_classification"
|
import { AssetClassification } from "./entity/asset_classification"
|
||||||
import { FixedAssetClassification } from "./entity/fixed_assets_classification";
|
import { FixedAssetClassification } from "./entity/fixed_assets_classification";
|
||||||
import { Employee } from "./entity/employee";
|
import { Employee } from "./entity/employee";
|
||||||
|
import { Department } from "./entity/department";
|
||||||
import { AssetDepreciation } from "./entity/asset_depreciation";
|
import { AssetDepreciation } from "./entity/asset_depreciation";
|
||||||
|
import { RequestOrder } from "./entity/request_orders";
|
||||||
|
import { RequestSubmission } from "./entity/request_submission";
|
||||||
|
import { RequestRecapitulation } from "./entity/request_submission_recap";
|
||||||
export {
|
export {
|
||||||
User, //
|
User, //
|
||||||
UserRole,
|
UserRole,
|
||||||
@ -101,6 +105,10 @@ export {
|
|||||||
FixedAssetClassification,
|
FixedAssetClassification,
|
||||||
AssetDepreciation,
|
AssetDepreciation,
|
||||||
Employee,
|
Employee,
|
||||||
|
Department,
|
||||||
|
RequestSubmission,
|
||||||
|
RequestRecapitulation,
|
||||||
|
RequestOrder,
|
||||||
Ledger,
|
Ledger,
|
||||||
CreditCompany,
|
CreditCompany,
|
||||||
CreditDebtor,
|
CreditDebtor,
|
||||||
@ -108,5 +116,5 @@ export {
|
|||||||
CreditApplication,
|
CreditApplication,
|
||||||
CreditApplicationStatus,
|
CreditApplicationStatus,
|
||||||
CreditApplicationForm,
|
CreditApplicationForm,
|
||||||
Application
|
Application,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user