update entity and controller for compounding medicine to add relation with usage time and usage instructions

This commit is contained in:
wayanrivan
2026-03-26 15:57:02 +07:00
parent 32b3d7878f
commit c149200858

View File

@ -5,10 +5,14 @@ import {
CreateDateColumn, CreateDateColumn,
UpdateDateColumn, UpdateDateColumn,
DeleteDateColumn, DeleteDateColumn,
OneToMany OneToMany,
ManyToOne,
JoinColumn
} from "typeorm"; } from "typeorm";
import { EmrCompoundingMedicineItem } from "./emr_compounding_medicine_item"; import { EmrCompoundingMedicineItem } from "./emr_compounding_medicine_item";
import { UsageTime } from "../pharmacy/usage_time";
import { UsageInstructions } from "../pharmacy/usage_instructions";
@Entity("emr_compounding_medicine", { schema: "emr" }) @Entity("emr_compounding_medicine", { schema: "emr" })
export class EmrCompoundingMedicine { export class EmrCompoundingMedicine {
@ -30,11 +34,13 @@ export class EmrCompoundingMedicine {
@Column({ nullable: true, type: "text" }) @Column({ nullable: true, type: "text" })
compounding_notes: string; compounding_notes: string;
@Column({ nullable: true, type: "text" }) @ManyToOne(() => UsageTime, { onDelete: "CASCADE" })
usage_time: string; @JoinColumn()
usagetime: UsageTime;
@Column({ nullable: true, type: "text" }) @ManyToOne(() => UsageInstructions, { onDelete: "CASCADE" })
usage_instructions: string; @JoinColumn()
usageinstructions: UsageInstructions;
@Column() @Column()
@CreateDateColumn() @CreateDateColumn()