dungeon-sdk-drikkx
Version:
Shared types and entities for the Dungeon game
52 lines (38 loc) • 1.11 kB
text/typescript
import { Entity, Column, PrimaryGeneratedColumn, ManyToOne, JoinColumn } from 'typeorm';
import { Role, ResourcesType, Skill } from '../types/character.types';
import { Equipment } from '../types/item.types';
import { DamageType, Stats } from '../types/stats.types';
import { UserEntity } from './user.entity';
export class CharacterEntity {
id!: number;
name!: string;
role!: Role;
level!: number;
experience!: number;
stats!: Stats;
skills!: Skill[];
resources!: ResourcesType;
damageType!: DamageType;
equipments!: Equipment[];
user!: UserEntity;
userId!: string;
createdAt!: Date;
constructor(partial: Partial<CharacterEntity>) {
Object.assign(this, partial);
}
}