listSceneQualities.js 604 B

12345678910111213141516171819
  1. 'use strict'
  2. import express from 'express'
  3. import { asyncMiddleware, checkRequiredParameters, getSceneFilesData } from '../functions'
  4. const router = express.Router()
  5. // Route which returns a list of all available qualities for a scene
  6. router.get('/', asyncMiddleware(async (req, res) => {
  7. // Check the request contains all the required parameters
  8. checkRequiredParameters(['sceneName'], req.query)
  9. const { sceneName } = req.query
  10. const sceneData = await getSceneFilesData(sceneName)
  11. const data = Array.from(sceneData.values()).map(x => x.quality)
  12. res.json(data)
  13. }))
  14. export default router