1
0
forked from noxious/server

Map event tile improvements

This commit is contained in:
2025-01-05 06:22:22 +01:00
parent 57b21f1499
commit d7982493e1
23 changed files with 198 additions and 115 deletions

View File

@ -6,7 +6,10 @@ class MapObjectRepository extends BaseRepository {
async getById(id: UUID): Promise<MapObject | null> {
try {
const repository = this.getEntityManager().getRepository(MapObject)
return await repository.findOne({ id })
const result = await repository.findOne({ id })
if (result) result.setEntityManager(this.getEntityManager())
return result
} catch (error: any) {
return null
}
@ -15,7 +18,10 @@ class MapObjectRepository extends BaseRepository {
async getAll(): Promise<MapObject[]> {
try {
const repository = this.getEntityManager().getRepository(MapObject)
return await repository.findAll()
const results = await repository.findAll()
for (const result of results) result.setEntityManager(this.getEntityManager())
return results
} catch (error: any) {
return []
}