import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, OneToMany } from 'typeorm'; import { Occupancy } from './occupancy.entity'; import { RoomExpense } from './room-expense.entity'; @Entity('rooms') export class Room { @PrimaryGeneratedColumn() id: number; @Column({ name: 'room_number', length: 20, unique: true }) roomNumber: string; @Column({ length: 50, nullable: true }) building: string; @Column({ nullable: true }) floor: number; @Column() capacity: number; @Column({ type: 'varchar', length: 20, default: 'available' }) status: string; @Column({ name: 'room_type', length: 20, nullable: true }) roomType: string; @Column({ length: 10, nullable: true }) gender: string; @Column({ name: 'rental_category', length: 10, default: 'short' }) rentalCategory: string; @Column({ name: 'monthly_rate', type: 'decimal', precision: 10, scale: 2, default: 0 }) monthlyRate: number; @CreateDateColumn({ name: 'created_at' }) createdAt: Date; @OneToMany(() => Occupancy, (o) => o.room) occupancies: Occupancy[]; @OneToMany(() => RoomExpense, (e) => e.room) roomExpenses: RoomExpense[]; }