UNPKG

dungeon-sdk-drikkx

Version:

Shared types and entities for the Dungeon game

31 lines (24 loc) 756 B
import { Entity, Column, PrimaryGeneratedColumn, ManyToOne } from 'typeorm'; import { CombatActionType } from '../types/combat.types'; import { DungeonWaveEntity } from './dungeon-wave.entity'; @Entity('combat_actions') export class CombatActionEntity { @PrimaryGeneratedColumn() id!: number; @Column() waveId!: number; @ManyToOne(() => DungeonWaveEntity, wave => wave.combatActions) wave!: DungeonWaveEntity; @Column({ type: 'enum', enum: CombatActionType }) type!: CombatActionType; @Column('jsonb') data!: Record<string, any>; @Column({ type: 'timestamp' }) createdAt!: Date; constructor(partial: Partial<CombatActionEntity>) { Object.assign(this, partial); } }