Spaces:
Sleeping
Sleeping
File size: 1,921 Bytes
6f39f03 95a812a 6f39f03 95a812a 6f39f03 f97bd0c 6f39f03 3367e34 6f39f03 3367e34 6f39f03 3367e34 6f39f03 9e8f9e3 766d2fb 6f39f03 a3b1339 6f39f03 a3b1339 6f39f03 3367e34 6f39f03 95a812a 6f39f03 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
import {
BaseEntity,
Column,
CreateDateColumn,
DeleteDateColumn,
Entity,
JoinColumn,
ManyToOne,
OneToMany,
OneToOne,
PrimaryGeneratedColumn,
Relation,
UpdateDateColumn,
} from 'typeorm';
import { BranchEntity } from './branch.entity.js';
import { UserEntity } from './user.entity.js';
import { OrderType } from '../common/enums/OrderType.enum.js';
import { OrderStatus } from '../common/enums/OrderStatus.enum.js';
import { OrderItemEntity } from './order-item.entity.js';
import { PaymentEntity } from './payment.entity.js';
@Entity('orders')
export class OrderEntity extends BaseEntity {
@PrimaryGeneratedColumn()
id: number;
@Column({ nullable: true })
customer_id: string;
@ManyToOne(() => UserEntity, { nullable: true })
@JoinColumn({ name: 'customer_id' })
customer: Relation<UserEntity>;
@Column()
branch_id: string;
@ManyToOne(() => BranchEntity)
@JoinColumn({ name: 'branch_id' })
branch: Relation<BranchEntity>;
@Column({ nullable: true })
staff_id: string;
@ManyToOne(() => UserEntity, { nullable: true })
@JoinColumn({ name: 'staff_id' })
staff: Relation<UserEntity>;
@Column({ nullable: true })
table_number: number;
@Column({ nullable: true })
note: string;
@Column({ nullable: true })
rating: number;
@Column()
total_value: number;
@Column({ default: 0 })
order_type: number;
@Column({ default: 0 })
order_status: number;
@OneToMany(() => OrderItemEntity, (a) => a.order)
order_items: Relation<OrderItemEntity>[];
@Column({ nullable: true })
payment_id: number;
@OneToOne(() => PaymentEntity, (a) => a.order)
@JoinColumn({ name: 'payment_id' })
payment: Relation<PaymentEntity>;
@CreateDateColumn()
created_at: Date;
@UpdateDateColumn()
updated_at: Date;
@DeleteDateColumn()
deleted_at: Date;
}
|