forked from noxious/server
#293: Changed IDs to UUIDs for all entities
This commit is contained in:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user