dungeon-sdk-drikkx
Version:
Shared types and entities for the Dungeon game
51 lines (39 loc) • 1.17 kB
text/typescript
import { Entity, Column, PrimaryColumn, ManyToOne, OneToMany } from 'typeorm';
import { RoomStatus, RoomType } from '../types/dungeon.types';
import { DungeonEntity } from './dungeon.entity';
import { DungeonWaveEntity } from './dungeon-wave.entity';
('dungeon_rooms')
export class DungeonRoomEntity {
()
id!: string;
()
dungeonId!: string;
(() => DungeonEntity, dungeon => dungeon.rooms)
dungeon!: DungeonEntity;
({
type: 'enum',
enum: RoomType
})
type!: RoomType;
()
roomNumber!: number;
({
type: 'enum',
enum: RoomStatus,
default: RoomStatus.PENDING
})
status!: RoomStatus;
({ default: false })
completed!: boolean;
()
description!: string;
({ type: 'timestamp' })
createdAt!: Date;
({ type: 'timestamp', nullable: true })
completedAt?: Date;
(() => DungeonWaveEntity, wave => wave.room)
waves!: DungeonWaveEntity[];
constructor(partial: Partial<DungeonRoomEntity>) {
Object.assign(this, partial);
}
}