Artteiv's picture
fix: update branch admin
9e8f9e3
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<UserEntity>;
@OneToMany(() => BranchMenuEntity, (a) => a.branch)
menu_items: Relation<BranchMenuEntity>[];
@OneToMany(() => ReceiptEntity, (a) => a.branch)
receipts: Relation<ReceiptEntity>[];
@CreateDateColumn()
create_at: Date;
@DeleteDateColumn()
delete_at: Date;
}