Commit 90b2b796 authored by Anton's avatar Anton

Export video tags and titles as well

parent 959d83b7
......@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Override author option for archives
- Archives also contain video tags and titles
### Fixed
......
......@@ -16,22 +16,34 @@ const setupArchives = function (api, mapService, annotationService) {
},
user: req.user
}
await mapService.getHandler(request, async result => {
if (result.error) return send(res, result.code)
data.map = result.data
request = {
query: {
query: JSON.stringify({'target.id': `${config.api.uriBase}/maps/${data.map.uuid}`})
},
user: req.user
const mapResult = await mapService.getHandler(request)
if (mapResult.error) return send(res, mapResult.code)
data.map = mapResult.data
request = {
query: {
query: JSON.stringify({'target.id': data.map.id})
},
user: req.user
}
const annotationsResult = await annotationService.findHandler(request)
if (annotationsResult.error) return send(res, annotationsResult.code)
data.annotations = annotationsResult.data.items
for (let annotation of annotationsResult.data.items) {
if (annotation.body.type === 'Video') {
request = {
query: {
query: JSON.stringify({'target.id': annotation.id})
},
user: req.user
}
const videosResult = await annotationService.findHandler(request)
data.annotations = data.annotations.concat(videosResult.data.items)
}
await annotationService.findHandler(request, async result => {
if (result.error) return send(res, result.code)
data.annotations = result.data.items
const url = await createArchive(api, data)
send(res, 200, url)
})
})
}
const url = await createArchive(api, data)
send(res, 200, url)
})
api.app.post('/archives/maps/upload', async function (req, res) {
upload.single('file')(req, res, async () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment