1
0
forked from noxious/server

#293: Changed IDs to UUIDs for all entities

This commit is contained in:
2025-01-01 20:53:05 +01:00
parent 465219276d
commit 586bb0ca83
17 changed files with 79 additions and 52 deletions

View File

@ -1,3 +1,5 @@
import { randomUUID } from 'node:crypto'
import { Collection, Entity, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
import { CharacterEquipment } from './characterEquipment'
@ -9,11 +11,12 @@ import { User } from './user'
import { Zone } from './zone'
import { BaseEntity } from '#application/base/baseEntity'
import { UUID } from '#application/types'
@Entity()
export class Character extends BaseEntity {
@PrimaryKey()
id!: number
id = randomUUID()
@ManyToOne(() => User)
user!: User
@ -85,7 +88,7 @@ export class Character extends BaseEntity {
@Property()
wisdom = 10
setId(id: number) {
setId(id: UUID) {
this.id = id
return this
}