diff --git a/src/utilities/http.ts b/src/utilities/http.ts index 2af8718..17430cc 100644 --- a/src/utilities/http.ts +++ b/src/utilities/http.ts @@ -39,6 +39,35 @@ async function addHttpRoutes(app: Application) { res.json(assets) }) + /** + * Get all assets for all zones + * @param req + * @param res + */ + app.get('/assets/zone', async (req: Request, res: Response) => { + const tiles = await tileRepository.getAll() + const objects = await objectRepository.getAll() + + const assets: TAsset[] = [] + tiles.forEach((tile) => { + assets.push({ + key: tile.id, + url: '/assets/tiles/' + tile.id + '.png', + group: 'tiles' + }) + }) + + objects.forEach((object) => { + assets.push({ + key: object.id, + url: '/assets/objects/' + object.id + '.png', + group: 'objects' + }) + }) + + res.json(assets) + }) + /** * Get assets for a specific zone * @param req