2021-10-25 14:53:22 +04:00
|
|
|
const storage = require('../../adapters/storage');
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
docName: 'media',
|
|
|
|
upload: {
|
|
|
|
statusCode: 201,
|
|
|
|
permissions: false,
|
2021-11-03 17:38:59 +04:00
|
|
|
async query(frame) {
|
2021-11-08 20:01:27 +04:00
|
|
|
let thumbnailPath = null;
|
2021-11-05 17:06:28 +04:00
|
|
|
if (frame.files.thumbnail && frame.files.thumbnail[0]) {
|
2021-11-08 20:01:27 +04:00
|
|
|
thumbnailPath = await storage.getStorage('media').save(frame.files.thumbnail[0]);
|
2021-11-05 17:06:28 +04:00
|
|
|
}
|
|
|
|
|
2021-11-08 20:01:27 +04:00
|
|
|
const filePath = await storage.getStorage('media').save(frame.files.file[0]);
|
2021-11-03 17:38:59 +04:00
|
|
|
|
|
|
|
return {
|
2021-11-08 20:01:27 +04:00
|
|
|
filePath,
|
|
|
|
thumbnailPath
|
2021-11-03 17:38:59 +04:00
|
|
|
};
|
2021-10-25 14:53:22 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|