2018-10-12 23:41:39 +03:00
|
|
|
const storage = require('../../adapters/storage');
|
|
|
|
|
|
|
|
module.exports = {
|
2019-02-24 07:18:45 +03:00
|
|
|
docName: 'images',
|
|
|
|
upload: {
|
2018-10-12 23:41:39 +03:00
|
|
|
statusCode: 201,
|
|
|
|
permissions: false,
|
|
|
|
query(frame) {
|
|
|
|
const store = storage.getStorage();
|
|
|
|
|
|
|
|
if (frame.files) {
|
2018-12-12 16:02:09 +03:00
|
|
|
return Promise
|
|
|
|
.map(frame.files, file => store.save(file))
|
|
|
|
.then(paths => paths[0]);
|
2018-10-12 23:41:39 +03:00
|
|
|
}
|
2018-12-12 16:02:09 +03:00
|
|
|
return store.save(frame.file);
|
2018-10-12 23:41:39 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|