130 lines
1.9 KiB
TypeScript
130 lines
1.9 KiB
TypeScript
import { randomUUID } from 'node:crypto'
|
|
|
|
import { Entity, PrimaryKey, Property } from '@mikro-orm/core'
|
|
|
|
import type { UUID } from '#application/types'
|
|
|
|
import { BaseEntity } from '#application/base/baseEntity'
|
|
|
|
export class BaseMapObject extends BaseEntity {
|
|
@PrimaryKey()
|
|
id = randomUUID()
|
|
|
|
@Property()
|
|
name!: string
|
|
|
|
@Property({ type: 'json', nullable: true })
|
|
tags?: any
|
|
|
|
@Property({ type: 'decimal', precision: 10, scale: 2 })
|
|
originX = 0
|
|
|
|
@Property({ type: 'decimal', precision: 10, scale: 2 })
|
|
originY = 0
|
|
|
|
@Property()
|
|
frameRate = 0
|
|
|
|
@Property()
|
|
frameWidth = 0
|
|
|
|
@Property()
|
|
frameHeight = 0
|
|
|
|
@Property()
|
|
createdAt = new Date()
|
|
|
|
@Property()
|
|
updatedAt = new Date()
|
|
|
|
setId(id: UUID) {
|
|
this.id = id
|
|
return this
|
|
}
|
|
|
|
getId() {
|
|
return this.id
|
|
}
|
|
|
|
setName(name: string) {
|
|
this.name = name
|
|
return this
|
|
}
|
|
|
|
getName() {
|
|
return this.name
|
|
}
|
|
|
|
setTags(tags: any) {
|
|
this.tags = tags
|
|
return this
|
|
}
|
|
|
|
getTags() {
|
|
return this.tags
|
|
}
|
|
|
|
setOriginX(originX: number) {
|
|
this.originX = originX
|
|
return this
|
|
}
|
|
|
|
getOriginX() {
|
|
return this.originX
|
|
}
|
|
|
|
setOriginY(originY: number) {
|
|
this.originY = originY
|
|
return this
|
|
}
|
|
|
|
getOriginY() {
|
|
return this.originY
|
|
}
|
|
|
|
setFrameRate(frameRate: number) {
|
|
this.frameRate = frameRate
|
|
return this
|
|
}
|
|
|
|
getFrameRate() {
|
|
return this.frameRate
|
|
}
|
|
|
|
setFrameWidth(frameWidth: number) {
|
|
this.frameWidth = frameWidth
|
|
return this
|
|
}
|
|
|
|
getFrameWidth() {
|
|
return this.frameWidth
|
|
}
|
|
|
|
setFrameHeight(frameHeight: number) {
|
|
this.frameHeight = frameHeight
|
|
return this
|
|
}
|
|
|
|
getFrameHeight() {
|
|
return this.frameHeight
|
|
}
|
|
|
|
setCreatedAt(createdAt: Date) {
|
|
this.createdAt = createdAt
|
|
return this
|
|
}
|
|
|
|
getCreatedAt() {
|
|
return this.createdAt
|
|
}
|
|
|
|
setUpdatedAt(updatedAt: Date) {
|
|
this.updatedAt = updatedAt
|
|
return this
|
|
}
|
|
|
|
getUpdatedAt() {
|
|
return this.updatedAt
|
|
}
|
|
}
|