2020-11-19 13:36:15 +00:00
|
|
|
const Promise = require('bluebird');
|
2018-10-12 22:41:39 +02:00
|
|
|
const storage = require('../../adapters/storage');
|
|
|
|
|
|
|
|
module.exports = {
|
2019-02-24 11:18:45 +07:00
|
|
|
docName: 'images',
|
|
|
|
upload: {
|
2018-10-12 22:41:39 +02:00
|
|
|
statusCode: 201,
|
|
|
|
permissions: false,
|
|
|
|
query(frame) {
|
2021-10-20 19:22:09 +04:00
|
|
|
const store = storage.getStorage('images');
|
2018-10-12 22:41:39 +02:00
|
|
|
|
|
|
|
if (frame.files) {
|
2018-12-12 14:02:09 +01:00
|
|
|
return Promise
|
|
|
|
.map(frame.files, file => store.save(file))
|
|
|
|
.then(paths => paths[0]);
|
2018-10-12 22:41:39 +02:00
|
|
|
}
|
2018-12-12 14:02:09 +01:00
|
|
|
return store.save(frame.file);
|
2018-10-12 22:41:39 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|