refactor: codigo reducido
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2022-12-01 07:22:13 +01:00
parent ba8fe7dfa8
commit 444d495b7f
3 changed files with 17 additions and 13 deletions

View File

@ -248,7 +248,8 @@
"App locked": "Aplicación bloqueada por el usuario {{userId}}",
"Email verify": "Correo de verificación",
"Landing cannot be lesser than shipment": "Landing cannot be lesser than shipment",
"Receipt's bank was not found": "No se encontró el banco del recibo",
"This receipt was not compensated": "Este recibo no ha sido compensado",
"Client's email was not found": "No se encontró el email del cliente"
"Receipt's bank was not found": "No se encontró el banco del recibo",
"This receipt was not compensated": "Este recibo no ha sido compensado",
"Client's email was not found": "No se encontró el email del cliente",
"Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9"
}

View File

@ -41,12 +41,13 @@ module.exports = Self => {
}
try {
const mdbApp = await models.MdbApp.findById(appName, null, myOptions);
const mdbApp = await models.MdbApp.findById(appName, {fields: ['app', 'locked', 'userFk']}, myOptions);
const message = $t('App locked', {
userId: mdbApp.userFk
});
if (mdbApp.locked) throw new UserError(message);
if (mdbApp.locked) {
throw new UserError($t('App locked', {
userId: mdbApp.userFk
}));
}
const updatedMdbApp = await mdbApp.updateAttributes({
userFk: userId,

View File

@ -64,10 +64,12 @@ module.exports = Self => {
let srcFile;
try {
const mdbApp = await models.MdbApp.findById(appName, null, myOptions);
const message = $t('App locked', {
userId: mdbApp.userFk
});
if (mdbApp.locked && mdbApp.userFk != userId) throw new UserError(message);
if (mdbApp.locked && mdbApp.userFk != userId) {
throw new UserError($t('App locked', {
userId: mdbApp.userFk
}));
}
const tempContainer = await TempContainer.container('access');
const uploaded = await TempContainer.upload(tempContainer.name, ctx.req, ctx.result, fileOptions);