43 lines
723 B
TypeScript
43 lines
723 B
TypeScript
import { randomUUID } from 'node:crypto'
|
|
import { Collection, Entity, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
|
|
import { ZoneObject } from './zoneObject'
|
|
|
|
@Entity()
|
|
export class MapObject {
|
|
@PrimaryKey()
|
|
id = randomUUID()
|
|
|
|
@Property()
|
|
name!: string
|
|
|
|
@Property({ type: 'json', nullable: true })
|
|
tags?: any
|
|
|
|
@Property()
|
|
originX = 0
|
|
|
|
@Property()
|
|
originY = 0
|
|
|
|
@Property()
|
|
isAnimated = false
|
|
|
|
@Property()
|
|
frameRate = 0
|
|
|
|
@Property()
|
|
frameWidth = 0
|
|
|
|
@Property()
|
|
frameHeight = 0
|
|
|
|
@Property()
|
|
createdAt = new Date()
|
|
|
|
@Property()
|
|
updatedAt = new Date()
|
|
|
|
@OneToMany(() => ZoneObject, (zoneObject) => zoneObject.mapObject)
|
|
zoneObjects = new Collection<ZoneObject>(this)
|
|
}
|