1
0
forked from noxious/server

OOP is my passion ( ͡° ͜ʖ ͡°)

This commit is contained in:
2025-01-04 18:35:53 +01:00
parent 0b4420f956
commit 067976c54a
46 changed files with 165 additions and 164 deletions

View File

@ -1,16 +1,15 @@
import { BaseRepository } from '#application/base/baseRepository'
import { gameLogger } from '#application/logger'
import { World } from '#entities/world'
class WorldRepository extends BaseRepository {
async getFirst() {
try {
const repository = this.em.getRepository(World)
const repository = this.getEntityManager().getRepository(World)
return await repository.findOne({ date: { $exists: true } })
} catch (error: any) {
gameLogger.error(`Failed to get first world: ${error instanceof Error ? error.message : String(error)}`)
this.logger.error(`Failed to get first world: ${error instanceof Error ? error.message : String(error)}`)
}
}
}
export default new WorldRepository()
export default WorldRepository