Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.getAllPhotos = (request, callback) => {
console.log('getAll')
/* We retrieve the array of stored items then use the 'map()' function to add the image url. */
const data = storage.values().map( item => {
item.url = 'http://localhost:8080/photos/'+item.filename+'.'+item.extension
return item
})
callback(null, data)
}
exports.countItems = function() {
const favourites = storage.values()
if (favourites.length) return true
return false
}
exports.listFavourites = function listFavourites(req, res) {
if (testableCode.countItems) {
res.send({ favourites: storage.values()})
res.end()
} else {
res.send(400, 'no favourites in list')
res.end()
}
}
async listLibrary() {
await this.ready;
return storage.values();
}