diff --git a/src/events/gameMaster/mapEditor/list.ts b/src/events/gameMaster/mapEditor/list.ts index c2da2c1..4fd8732 100644 --- a/src/events/gameMaster/mapEditor/list.ts +++ b/src/events/gameMaster/mapEditor/list.ts @@ -17,7 +17,7 @@ export default class MapListEvent extends BaseEvent { const mapRepository = new MapRepository() const maps = await mapRepository.getAll() - + return callback(maps) } catch (error: any) { this.logger.error('gm:map:list error', error.message) diff --git a/src/events/gameMaster/mapEditor/request.ts b/src/events/gameMaster/mapEditor/request.ts index 4a4399a..67f9c03 100644 --- a/src/events/gameMaster/mapEditor/request.ts +++ b/src/events/gameMaster/mapEditor/request.ts @@ -1,5 +1,4 @@ import { BaseEvent } from '#application/base/baseEvent' -import Database from '#application/database' import { UUID } from '#application/types' import { Map } from '#entities/map' import MapRepository from '#repositories/mapRepository' @@ -24,15 +23,16 @@ export default class MapRequestEvent extends BaseEvent { return callback(null) } - const map = await MapRepository.getById(data.mapId) + const mapRepository = new MapRepository() + const map = await mapRepository.getById(data.mapId) if (!map) { this.logger.info(`User ${(await this.getCharacter())!.getId()} tried to request map ${data.mapId} but it does not exist.`) return callback(null) } - console.log(map) - // await Database.getEntityManager().populate(map, ['mapEventTiles', 'placedMapObjects']) + // Populate map with mapEventTiles and placedMapObjects + await mapRepository.getEntityManager().populate(map, ['mapEventTiles', 'placedMapObjects']) return callback(map) } catch (error: any) {