import { BaseEntity, Column, CreateDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, Relation, } from 'typeorm'; import { BranchEntity } from './branch.entity.js'; import { UserEntity } from './user.entity.js'; @Entity('receipts') export class ReceiptEntity extends BaseEntity { @PrimaryGeneratedColumn() id: number; @Column() branch_id: string; @ManyToOne(() => BranchEntity, (a) => a.receipts) @JoinColumn({ name: 'branch_id' }) branch: Relation; @Column({ default: 0 }) income: number; @Column({ default: 0 }) spend: number; @Column({ nullable: true }) description: string; @Column({ default: 0 }) type: number; @Column({ default: 0 }) sub_type: number; @Column({ nullable: true }) sender_id: string; @Column({ nullable: true }) receiver_id: string; @ManyToOne(() => UserEntity, (a) => a.out_receipts) @JoinColumn({ name: 'sender_id' }) sender: Relation; @ManyToOne(() => UserEntity, (a) => a.in_receipts) @JoinColumn({ name: 'receiver_id' }) receiver: Relation; @CreateDateColumn() created_at: Date; }