Fixed enum fields, new migration file

This commit is contained in:
2024-12-25 02:06:02 +01:00
parent 125d3a3f66
commit c35e27799e
5 changed files with 44 additions and 54 deletions

View File

@ -1,4 +1,4 @@
import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core';
import { Entity, Enum, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
import { Character } from './character';
import { CharacterItem } from './characterItem';
import { CharacterEquipmentSlotType } from '#utilities/enums';
@ -8,7 +8,7 @@ export class CharacterEquipment {
@PrimaryKey()
id!: number;
@Property()
@Enum(() => CharacterEquipmentSlotType)
slot!: CharacterEquipmentSlotType;
@ManyToOne(() => Character)

View File

@ -1,4 +1,4 @@
import { Collection, Entity, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core';
import { Collection, Entity, Enum, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
import { Character } from './character';
import { Sprite } from './sprite';
import { CharacterGender, CharacterRace } from '#utilities/enums';
@ -11,10 +11,10 @@ export class CharacterType {
@Property()
name!: string;
@Property()
@Enum(() => CharacterGender)
gender!: CharacterGender;
@Property()
@Enum(() => CharacterRace)
race!: CharacterRace;
@Property()

View File

@ -1,4 +1,4 @@
import { Collection, Entity, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core';
import { Collection, Entity, Enum, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
import { Sprite } from './sprite';
import { CharacterItem } from './characterItem';
import { ItemType, ItemRarity } from '#utilities/enums';
@ -14,13 +14,13 @@ export class Item {
@Property({ nullable: true })
description?: string;
@Property()
@Enum(() => ItemType)
itemType!: ItemType;
@Property()
stackable = false;
@Property()
@Enum(() => ItemRarity)
rarity: ItemRarity = ItemRarity.COMMON;
@ManyToOne(() => Sprite, { nullable: true })