1
0
forked from noxious/server

Added ORM entities

This commit is contained in:
2024-12-24 22:08:08 +01:00
parent 40c24cee10
commit 8980691409
15 changed files with 403 additions and 1 deletions

View File

@ -0,0 +1,25 @@
import { Collection, Entity, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core';
import { Character } from './character';
import { Sprite } from './sprite';
import { CharacterGender } from '../utilities/enums';
@Entity()
export class CharacterHair {
@PrimaryKey()
id!: number;
@Property()
name!: string;
@Property()
gender: CharacterGender = CharacterGender.MALE;
@Property()
isSelectable = false;
@ManyToOne(() => Sprite, { nullable: true })
sprite?: Sprite;
@OneToMany(() => Character, character => character.characterHair)
characters = new Collection<Character>(this);
}