1
0
forked from noxious/server
noxious_server/src/entities/zoneEffect.ts
2024-12-27 02:50:11 +01:00

60 lines
902 B
TypeScript

import { randomUUID } from 'node:crypto'
import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
import { Zone } from './zone'
import { BaseEntity } from '#application/base/baseEntity'
import { UUID } from '#application/types'
@Entity()
export class ZoneEffect extends BaseEntity {
@PrimaryKey()
id = randomUUID()
@ManyToOne(() => Zone)
zone!: Zone
@Property()
effect!: string
@Property()
strength!: number
setId(id: UUID) {
this.id = id
return this
}
getId() {
return this.id
}
setZone(zone: Zone) {
this.zone = zone
return this
}
getZone() {
return this.zone
}
setEffect(effect: string) {
this.effect = effect
return this
}
getEffect() {
return this.effect
}
setStrength(strength: number) {
this.strength = strength
return this
}
getStrength() {
return this.strength
}
}