Commented out http endpoint

This commit is contained in:
Dennis Postma 2024-10-26 02:41:41 +02:00
parent 9d08073fa8
commit 6a1823586a

View File

@ -63,34 +63,34 @@ async function addHttpRoutes(app: Application) {
* @param req * @param req
* @param res * @param res
*/ */
app.get('/assets/tiles/:zoneId', async (req: Request, res: Response) => { // app.get('/assets/tiles/:zoneId', async (req: Request, res: Response) => {
const zoneId = req.params.zoneId // const zoneId = req.params.zoneId
//
// Check if zoneId is valid number // // Check if zoneId is valid number
if (!zoneId || parseInt(zoneId) === 0) { // if (!zoneId || parseInt(zoneId) === 0) {
return res.status(400).json({ message: 'Invalid zone ID' }) // return res.status(400).json({ message: 'Invalid zone ID' })
} // }
//
// Get zone by id // // Get zone by id
const zone = await zoneRepository.getById(parseInt(zoneId)) // const zone = await zoneRepository.getById(parseInt(zoneId))
if (!zone) { // if (!zone) {
return res.status(404).json({ message: 'Zone not found' }) // return res.status(404).json({ message: 'Zone not found' })
} // }
//
let tiles = zone.tiles; // let tiles = zone.tiles;
//
// Convert to array // // Convert to array
tiles = JSON.parse(JSON.stringify(tiles)) as string[] // tiles = JSON.parse(JSON.stringify(tiles)) as string[]
//
// Flatten the array // // Flatten the array
tiles = [...new Set(tiles.flat())] // tiles = [...new Set(tiles.flat())]
//
// Remove duplicates // // Remove duplicates
tiles = tiles.filter((value, index, self) => self.indexOf(value) === index); // tiles = tiles.filter((value, index, self) => self.indexOf(value) === index);
//
// Return the array // // Return the array
res.json(tiles) // res.json(tiles)
}) // })
/** /**
* Get a specific asset * Get a specific asset