Artteiv's picture
fix: update branch menus
7b1861f
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<BranchEntity>;
@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<UserEntity>;
@ManyToOne(() => UserEntity, (a) => a.in_receipts)
@JoinColumn({ name: 'receiver_id' })
receiver: Relation<UserEntity>;
@CreateDateColumn()
created_at: Date;
}