Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/dev There was a failure building this commit
Details
gitea/salix/dev There was a failure building this commit
Details
This commit is contained in:
commit
2901ad2022
|
@ -42,20 +42,21 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
|
||||
Self.uploadFile = async(ctx, options = {}) => {
|
||||
Self.uploadFile = async(ctx, options) => {
|
||||
const storageConnector = Self.app.dataSources.storage.connector;
|
||||
const models = Self.app.models;
|
||||
const fileOptions = {};
|
||||
const args = ctx.args;
|
||||
|
||||
let tx;
|
||||
let myOptions = {};
|
||||
|
||||
if (typeof options == 'object')
|
||||
Object.assign(options, options);
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
if (!options.transaction) {
|
||||
if (!myOptions.transaction) {
|
||||
tx = await Self.beginTransaction({});
|
||||
options.transaction = tx;
|
||||
myOptions.transaction = tx;
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -72,7 +73,7 @@ module.exports = Self => {
|
|||
|
||||
const addedDms = [];
|
||||
for (const file of files) {
|
||||
const newDms = await createDms(ctx, file.name, options);
|
||||
const newDms = await createDms(ctx, file.name, myOptions);
|
||||
const pathHash = storageConnector.getPathHash(newDms.id);
|
||||
const container = await getContainer(pathHash);
|
||||
|
||||
|
@ -92,7 +93,7 @@ module.exports = Self => {
|
|||
}
|
||||
};
|
||||
|
||||
async function createDms(ctx, fileName, options) {
|
||||
async function createDms(ctx, fileName, myOptions) {
|
||||
const models = Self.app.models;
|
||||
const storageConnector = Self.app.dataSources.storage.connector;
|
||||
const myUserId = ctx.req.accessToken.userId;
|
||||
|
@ -107,12 +108,12 @@ module.exports = Self => {
|
|||
reference: args.reference,
|
||||
description: args.description,
|
||||
hasFile: args.hasFile
|
||||
}, options);
|
||||
}, myOptions);
|
||||
|
||||
const extension = storageConnector.getFileExtension(fileName);
|
||||
fileName = `${newDms.id}.${extension}`;
|
||||
|
||||
return newDms.updateAttribute('file', fileName, options);
|
||||
return newDms.updateAttribute('file', fileName, myOptions);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue