1
0
forked from noxious/server

Almost finalised refactoring

This commit is contained in:
2025-01-03 14:35:02 +01:00
parent fecdf222d7
commit a40b71140a
35 changed files with 257 additions and 410 deletions

View File

@ -1,22 +1,23 @@
import { BaseRepository } from '#application/base/baseRepository'
import { UUID } from '#application/types'
import { MapObject } from '#entities/mapObject'
class MapObjectRepository extends BaseRepository {
async getById(id: UUID): Promise<any> {
async getById(id: UUID): Promise<MapObject | null> {
try {
const repository = this.em.getRepository(Object)
const repository = this.em.getRepository(MapObject)
return await repository.findOne({ id })
} catch (error: any) {
return null
}
}
async getAll(): Promise<any> {
async getAll(): Promise<MapObject[]> {
try {
const repository = this.em.getRepository(Object)
const repository = this.em.getRepository(MapObject)
return await repository.findAll()
} catch (error: any) {
return null
return []
}
}
}