77 lines
1.7 KiB
TypeScript
77 lines
1.7 KiB
TypeScript
import {
|
|
Column,
|
|
Entity,
|
|
ManyToOne,
|
|
OneToMany,
|
|
PrimaryGeneratedColumn,
|
|
} from 'typeorm';
|
|
import { Timestamp } from './timestamp';
|
|
import { BidHistory } from './bid-history.entity';
|
|
import { WebBid } from './wed-bid.entity';
|
|
import { SendMessageHistory } from './send-message-histories.entity';
|
|
import { BidMetadata } from './bid-metadata.entity';
|
|
|
|
@Entity('bids')
|
|
export class Bid extends Timestamp {
|
|
@PrimaryGeneratedColumn('increment')
|
|
id: number;
|
|
|
|
@Column()
|
|
max_price: number;
|
|
|
|
@Column({ default: 1 })
|
|
quantity: number;
|
|
|
|
@Column()
|
|
url: string;
|
|
|
|
@Column({ unique: true, default: null, nullable: true })
|
|
model: string | null;
|
|
|
|
@Column({ default: null, nullable: true })
|
|
lot_id: string;
|
|
|
|
@Column({ default: 0 })
|
|
plus_price: number;
|
|
|
|
@Column({ default: 0 })
|
|
reserve_price: number;
|
|
|
|
@Column({ default: null, nullable: true })
|
|
name: string;
|
|
|
|
@Column({ default: 0 })
|
|
current_price: number;
|
|
|
|
@Column({ default: null, nullable: true })
|
|
close_time: string;
|
|
|
|
@Column({ default: null, nullable: true })
|
|
close_time_ts: Date | null;
|
|
|
|
@Column({ default: null, nullable: true })
|
|
start_bid_time: string;
|
|
|
|
@Column({ default: true })
|
|
first_bid: boolean;
|
|
|
|
@Column({ default: 'biding' })
|
|
status: 'biding' | 'out-bid' | 'win-bid';
|
|
|
|
@OneToMany(() => BidHistory, (bidHistory) => bidHistory.bid, {
|
|
cascade: true,
|
|
})
|
|
histories: BidHistory[];
|
|
|
|
@OneToMany(() => SendMessageHistory, (sendMessage) => sendMessage.bid, {
|
|
cascade: true,
|
|
})
|
|
sendMessageHistories: SendMessageHistory[];
|
|
|
|
@ManyToOne(() => WebBid, (web) => web.children, { onDelete: 'CASCADE' })
|
|
web_bid: WebBid;
|
|
|
|
@OneToMany(() => BidMetadata, (metadata) => metadata.bid)
|
|
metadata: BidMetadata[];
|
|
}
|