forked from noxious/server
57 lines
1.1 KiB
TypeScript
57 lines
1.1 KiB
TypeScript
import { Entity, Enum, ManyToOne, PrimaryKey } from '@mikro-orm/core'
|
|
import { BaseEntity } from '#application/bases/baseEntity'
|
|
import { Character } from './character'
|
|
import { CharacterItem } from './characterItem'
|
|
import { CharacterEquipmentSlotType } from '#application/enums'
|
|
|
|
@Entity()
|
|
export class CharacterEquipment extends BaseEntity {
|
|
@PrimaryKey()
|
|
id!: number
|
|
|
|
@Enum(() => CharacterEquipmentSlotType)
|
|
slot!: CharacterEquipmentSlotType
|
|
|
|
@ManyToOne(() => Character)
|
|
character!: Character
|
|
|
|
@ManyToOne(() => CharacterItem)
|
|
characterItem!: CharacterItem
|
|
|
|
setId(id: number) {
|
|
this.id = id
|
|
return this
|
|
}
|
|
|
|
getId() {
|
|
return this.id
|
|
}
|
|
|
|
setSlot(slot: CharacterEquipmentSlotType) {
|
|
this.slot = slot
|
|
return this
|
|
}
|
|
|
|
getSlot() {
|
|
return this.slot
|
|
}
|
|
|
|
setCharacter(character: Character) {
|
|
this.character = character
|
|
return this
|
|
}
|
|
|
|
getCharacter() {
|
|
return this.character
|
|
}
|
|
|
|
setCharacterItem(characterItem: CharacterItem) {
|
|
this.characterItem = characterItem
|
|
return this
|
|
}
|
|
|
|
getCharacterItem() {
|
|
return this.characterItem
|
|
}
|
|
}
|