Files
gongxue-base/apps/server/src/entities/room.entity.ts
wangziqi 46a817503e feat(task1): restructure directories for turborepo monorepo
- Move backend/ to apps/server/ via git mv
- Move frontend/ to apps/admin/ via git mv
- Create packages/typescript-config/ with base, nestjs, and react-vite presets
2026-07-02 15:05:12 +08:00

40 lines
950 B
TypeScript

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;
@CreateDateColumn({ name: 'created_at' })
createdAt: Date;
@OneToMany(() => Occupancy, (o) => o.room)
occupancies: Occupancy[];
@OneToMany(() => RoomExpense, (e) => e.room)
roomExpenses: RoomExpense[];
}