import { BaseEntity, Column, CreateDateColumn, DeleteDateColumn, Entity, ManyToOne, OneToMany, PrimaryColumn, PrimaryGeneratedColumn, Relation, } from 'typeorm'; import { UserEntity } from './user.entity.js'; import { BranchMenuEntity } from './branch-menu.entity.js'; import { ReceiptEntity } from './receipt.entity.js'; @Entity('branches') export class BranchEntity extends BaseEntity { @PrimaryColumn() id: string; @Column({ nullable: true }) name: string; @Column({ nullable: true }) image_url: string; @Column({ nullable: true }) location: string; @Column({ nullable: true }) phone_number: string; @ManyToOne(() => UserEntity, (user) => user.branches) owner: Relation; @OneToMany(() => BranchMenuEntity, (a) => a.branch) menu_items: Relation[]; @OneToMany(() => ReceiptEntity, (a) => a.branch) receipts: Relation[]; @CreateDateColumn() create_at: Date; @DeleteDateColumn() delete_at: Date; }