forked from noxious/server
Created base entities, extended normal entities with these
This commit is contained in:
@ -1,59 +1,6 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
import { Entity } from '@mikro-orm/core'
|
||||
|
||||
import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import { Map } from './map'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
import { UUID } from '#application/types'
|
||||
import { BaseMapEffect } from '#entities/base/mapEffect'
|
||||
|
||||
@Entity()
|
||||
export class MapEffect extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
id = randomUUID()
|
||||
|
||||
@ManyToOne({ deleteRule: 'cascade' })
|
||||
map!: Map
|
||||
|
||||
@Property()
|
||||
effect!: string
|
||||
|
||||
@Property()
|
||||
strength!: number
|
||||
|
||||
setId(id: UUID) {
|
||||
this.id = id
|
||||
return this
|
||||
}
|
||||
|
||||
getId() {
|
||||
return this.id
|
||||
}
|
||||
|
||||
setMap(map: Map) {
|
||||
this.map = map
|
||||
return this
|
||||
}
|
||||
|
||||
getMap() {
|
||||
return this.map
|
||||
}
|
||||
|
||||
setEffect(effect: string) {
|
||||
this.effect = effect
|
||||
return this
|
||||
}
|
||||
|
||||
getEffect() {
|
||||
return this.effect
|
||||
}
|
||||
|
||||
setStrength(strength: number) {
|
||||
this.strength = strength
|
||||
return this
|
||||
}
|
||||
|
||||
getStrength() {
|
||||
return this.strength
|
||||
}
|
||||
}
|
||||
export class MapEffect extends BaseMapEffect {}
|
||||
|
Reference in New Issue
Block a user