1
0
forked from noxious/server

Created base entities, extended normal entities with these

This commit is contained in:
2025-01-06 18:03:12 +01:00
parent be9ee97385
commit 24586855cb
42 changed files with 2006 additions and 1858 deletions

View File

@ -1,71 +1,6 @@
import { randomUUID } from 'node:crypto'
import { Entity } from '@mikro-orm/core'
import { Collection, Entity, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
import { SpriteAction } from './spriteAction'
import { BaseEntity } from '#application/base/baseEntity'
import { UUID } from '#application/types'
import { BaseSprite } from '#entities/base/sprite'
@Entity()
export class Sprite extends BaseEntity {
@PrimaryKey()
id = randomUUID()
@Property()
name!: string
@OneToMany(() => SpriteAction, (action) => action.sprite)
spriteActions = new Collection<SpriteAction>(this)
@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
}
setSpriteActions(spriteActions: Collection<SpriteAction>) {
this.spriteActions = spriteActions
return this
}
getSpriteActions() {
return this.spriteActions
}
setCreatedAt(createdAt: Date) {
this.createdAt = createdAt
return this
}
getCreatedAt() {
return this.createdAt
}
setUpdatedAt(updatedAt: Date) {
this.updatedAt = updatedAt
return this
}
getUpdatedAt() {
return this.updatedAt
}
}
export class Sprite extends BaseSprite {}