add addt entity pharmacy

This commit is contained in:
Rayhan Ardiansyah
2026-03-02 11:29:06 +07:00
parent 5025efd695
commit 62ebe4a785
3 changed files with 158 additions and 0 deletions

View File

@ -0,0 +1,49 @@
import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
DeleteDateColumn,
OneToOne,
JoinColumn,
} from "typeorm";
import { ItemMaster } from "./item_master";
@Entity("pharmacy_item_price", { schema: "pharmacy" })
export class ItemPrice {
@PrimaryGeneratedColumn("uuid")
id!: string;
@OneToOne(() => ItemMaster, { nullable: false })
@JoinColumn({ name: "item_master_id" })
item_master!: ItemMaster;
@Column({ type: "numeric", precision: 15, scale: 2, nullable: false })
purchase_price!: number;
@Column({ type: "numeric", precision: 15, scale: 2, nullable: false })
selling_price!: number;
@Column({ type: "date", nullable: true })
expired_date?: Date;
@CreateDateColumn()
created_at!: Date;
@Column({ nullable: true, length: 256 })
created_by?: string;
@UpdateDateColumn({ nullable: true })
updated_at?: Date;
@Column({ nullable: true, length: 256 })
updated_by?: string;
@DeleteDateColumn({ nullable: true })
deleted_at?: Date;
@Column({ nullable: true, length: 256 })
deleted_by?: string;
}

View File

@ -0,0 +1,60 @@
import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
DeleteDateColumn,
} from "typeorm";
@Entity("pharmacy_info", { schema: "pharmacy" })
export class PharmacyInfo {
@PrimaryGeneratedColumn("uuid")
id!: string;
@Column({ type: "text", nullable: true })
logo?: string; // store file path / url
@Column({ type: "text", nullable: false })
name!: string;
@Column({ type: "text", nullable: false })
address!: string;
@Column({ type: "text", nullable: true })
munisipiu?: string;
@Column({ type: "text", nullable: true })
postu_admin?: string;
@Column({ type: "text", nullable: true })
suco?: string;
@Column({ type: "text", nullable: true })
aldeia?: string;
@Column({ type: "text", nullable: true })
phone?: string;
@Column({ type: "uuid", nullable: true })
default_room_id?: string;
// FK ke room (where department = 'pharmacy')
@CreateDateColumn()
created_at!: Date;
@Column({ nullable: true, length: 256 })
created_by?: string;
@UpdateDateColumn({ nullable: true })
updated_at?: Date;
@Column({ nullable: true, length: 256 })
updated_by?: string;
@DeleteDateColumn({ nullable: true })
deleted_at?: Date;
@Column({ nullable: true, length: 256 })
deleted_by?: string;
}

View File

@ -0,0 +1,49 @@
import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
DeleteDateColumn,
ManyToOne,
JoinColumn,
} from "typeorm";
import { ItemMaster } from "./item_master";
import { ItemOrigin } from "./item_origin";
@Entity("pharmacy_selling_price_percentage", { schema: "pharmacy" })
export class SellingPricePercentage {
@PrimaryGeneratedColumn("uuid")
id!: string;
@ManyToOne(() => ItemMaster, { nullable: false })
@JoinColumn({ name: "item_master_id" })
item_master!: ItemMaster;
@ManyToOne(() => ItemOrigin, { nullable: false })
@JoinColumn({ name: "item_origin_id" })
item_origin!: ItemOrigin;
@Column({ type: "numeric", precision: 5, scale: 2, nullable: false })
percentage!: number;
// example: 15.50 (%)
@CreateDateColumn()
created_at!: Date;
@Column({ nullable: true, length: 256 })
created_by?: string;
@UpdateDateColumn({ nullable: true })
updated_at?: Date;
@Column({ nullable: true, length: 256 })
updated_by?: string;
@DeleteDateColumn({ nullable: true })
deleted_at?: Date;
@Column({ nullable: true, length: 256 })
deleted_by?: string;
}