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

68
src/entities/base/tile.ts Normal file
View File

@ -0,0 +1,68 @@
import { randomUUID } from 'node:crypto'
import { Entity, PrimaryKey, Property } from '@mikro-orm/core'
import { BaseEntity } from '#application/base/baseEntity'
import { UUID } from '#application/types'
export class BaseTile extends BaseEntity {
@PrimaryKey()
id = randomUUID()
@Property()
name!: string
@Property({ type: 'json', nullable: true })
tags?: any
@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
}
setCreatedAt(createdAt: Date) {
this.createdAt = createdAt
return this
}
getCreatedAt() {
return this.createdAt
}
setUpdatedAt(updatedAt: Date) {
this.updatedAt = updatedAt
return this
}
getUpdatedAt() {
return this.updatedAt
}
}