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