This commit is contained in:
parent
35f3097b8e
commit
1eb0efe2a2
@ -477,21 +477,23 @@ module.exports = (app, client) => {
|
|||||||
}, { asStream: true, meta: false }),
|
}, { asStream: true, meta: false }),
|
||||||
instancescomment = [],
|
instancescomment = [],
|
||||||
block_count = 0,
|
block_count = 0,
|
||||||
pipeline = chain([
|
pipeline = chain([
|
||||||
parser(),
|
parser(),
|
||||||
pick({ filter: 'hits.hits' }),
|
pick({ filter: 'hits.hits' }),
|
||||||
streamArray(),
|
streamArray(),
|
||||||
data => {
|
data => {
|
||||||
block_count++
|
block_count++
|
||||||
instancescomment.push({
|
instancescomment.push({
|
||||||
instance: data.value._source.instance, comment: data.value._source.blocks.find(block => block.domain === clean(req.params.instance)).comment
|
instance: data.value._source.instance, comment: data.value._source.blocks.find(block => block.domain === clean(req.params.instance)).comment
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
result.pipe(pipeline)
|
result.pipe(pipeline)
|
||||||
res.json({
|
pipeline.on('end', () => {
|
||||||
block_count,
|
res.json({
|
||||||
instances: instancescomment
|
block_count,
|
||||||
|
instances: instancescomment
|
||||||
|
})
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
res.status(404).end()
|
res.status(404).end()
|
||||||
|
Loading…
Reference in New Issue
Block a user