This commit is contained in:
wayanrivan
2026-03-03 09:05:49 +07:00
5 changed files with 176 additions and 8 deletions

View File

@ -58,12 +58,8 @@ export class ItemMaster {
factory!: Factory; factory!: Factory;
@ManyToOne(() => Unit, { nullable: false }) @ManyToOne(() => Unit, { nullable: false })
@JoinColumn({ name: "large_unit_id" }) @JoinColumn({ name: "unit_id" })
large_unit!: Unit; unit!: Unit;
@ManyToOne(() => Unit, { nullable: false })
@JoinColumn({ name: "small_unit_id" })
small_unit!: Unit;
@Column({ @Column({
type: "int", type: "int",

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,71 @@
import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
DeleteDateColumn,
ManyToOne,
JoinColumn,
} from "typeorm";
import { Room } from "../room";
import { Munisipo } from "../munisipo";
import { Administrativu } from "../administrativu";
import { Suco } from "../suco";
import { Aldeia } from "../aldeia";
@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;
@ManyToOne(() => Munisipo, { nullable: true })
@JoinColumn({ name: "munisipiu_id" })
munisipiu?: Munisipo;
@ManyToOne(() => Administrativu, { nullable: true })
@JoinColumn({ name: "postu_admin_id" })
postu_admin?: Administrativu;
@ManyToOne(() => Suco, { nullable: true })
@JoinColumn({ name: "suco_id" })
suco?: Suco;
@ManyToOne(() => Aldeia, { nullable: true })
@JoinColumn({ name: "aldeia_id" })
aldeia?: Aldeia;
@Column({ type: "text", nullable: true })
phone?: string;
@ManyToOne(() => Room, { nullable: true })
@JoinColumn({ name: "default_room_id" })
default_room?: Room;
@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;
}

View File

@ -14,3 +14,6 @@ export * from "../entity/pharmacy/factory";
export * from "../entity/pharmacy/supplier"; export * from "../entity/pharmacy/supplier";
export * from "../entity/pharmacy/factory_to_supplier"; export * from "../entity/pharmacy/factory_to_supplier";
export * from "../entity/pharmacy/item_master"; export * from "../entity/pharmacy/item_master";
export * from "../entity/pharmacy/pharmacy_info";
export * from "../entity/pharmacy/item_price";
export * from "../entity/pharmacy/selling_price_percentage";