52 lines
967 B
TypeScript
52 lines
967 B
TypeScript
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
import {
|
|
Column,
|
|
CreateDateColumn,
|
|
Entity,
|
|
ManyToOne,
|
|
OneToMany,
|
|
PrimaryGeneratedColumn,
|
|
UpdateDateColumn,
|
|
} from 'typeorm';
|
|
import { Building } from './building.entity';
|
|
import { Room } from './room.entity';
|
|
|
|
@Entity()
|
|
export class Floor {
|
|
@ApiProperty()
|
|
@PrimaryGeneratedColumn()
|
|
id: number;
|
|
|
|
@ApiProperty()
|
|
@Column()
|
|
displayName: string;
|
|
|
|
@ApiProperty()
|
|
@Column()
|
|
number: number;
|
|
|
|
@ApiProperty()
|
|
@Column({ type: 'text' })
|
|
plan: string;
|
|
|
|
@ApiPropertyOptional()
|
|
@Column({ type: 'text', nullable: true })
|
|
planImage?: string;
|
|
|
|
@ApiProperty({ type: () => Building })
|
|
@ManyToOne(() => Building)
|
|
building: Building;
|
|
|
|
@ApiProperty({ type: () => Room, isArray: true })
|
|
@OneToMany(() => Room, (room) => room.floor)
|
|
rooms: Room[];
|
|
|
|
@ApiProperty()
|
|
@CreateDateColumn()
|
|
createdAt: Date;
|
|
|
|
@ApiProperty()
|
|
@UpdateDateColumn()
|
|
updatedAt: Date;
|
|
}
|