Files
ShaFaFanXin/后端/src/entities/booking.entity.ts

73 lines
1.7 KiB
TypeScript

import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, ManyToOne, JoinColumn } from 'typeorm';
import { User } from './user.entity';
import { Service } from './service.entity';
@Entity('bookings')
export class Booking {
@PrimaryGeneratedColumn()
id: number;
@Column({ length: 32, unique: true })
bookingNumber: string; // 预约编号
@ManyToOne(() => User, { nullable: true })
@JoinColumn({ name: 'customerId' })
customer: User;
@Column({ nullable: true })
customerId: number;
@ManyToOne(() => Service)
@JoinColumn({ name: 'serviceId' })
service: Service;
@Column()
serviceId: number;
@Column({ length: 50 })
contactName: string;
@Column({ length: 20 })
contactPhone: string;
@Column({ type: 'text' })
address: string;
@Column({ type: 'datetime' })
appointmentTime: Date;
@Column({ type: 'text', nullable: true })
requirements: string; // 特殊要求
@Column({ type: 'json', nullable: true })
images: string[]; // 沙发现状图片
@Column({
type: 'enum',
enum: ['pending', 'confirmed', 'in_progress', 'completed', 'cancelled'],
default: 'pending'
})
status: string;
@Column({ type: 'decimal', precision: 10, scale: 2, nullable: true })
quotedPrice: number; // 报价
@Column({ type: 'decimal', precision: 10, scale: 2, nullable: true })
finalPrice: number; // 最终价格
@Column({ type: 'text', nullable: true })
notes: string; // 备注
@ManyToOne(() => User, { nullable: true })
@JoinColumn({ name: 'assignedWorkerId' })
assignedWorker: User;
@Column({ nullable: true })
assignedWorkerId: number;
@CreateDateColumn()
createdAt: Date;
@UpdateDateColumn()
updatedAt: Date;
}