1
0
forked from noxious/server

More map editor work

This commit is contained in:
Dennis Postma 2025-01-04 23:15:18 +01:00
parent db7121a4fa
commit 46cfb61cf5
2 changed files with 5 additions and 5 deletions

View File

@ -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) {