refs #4975: Added last mdbVersion/last method
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Guillermo Bonet 2022-12-19 07:26:07 +01:00
parent 1fcf5a85a6
commit a46c2ced7c
4 changed files with 48 additions and 8 deletions

View File

@ -247,7 +247,8 @@
"Empty data source": "Origen de datos vacio",
"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",
"Not exist this app name": "No existe este nombre de aplicación"
}

View File

@ -0,0 +1,40 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('last', {
description: 'Upload and attach a access file',
accepts: [
{
arg: 'appName',
type: 'string',
required: true,
description: 'The app name'
}
],
returns: {
type: ['object'],
root: true
},
http: {
path: `/:appName/last`,
verb: 'GET'
}
});
Self.last = async(ctx, appName) => {
const models = Self.app.models;
const versions = await models.MdbVersion.find({
where: {app: appName}
});
if (!versions.length)
throw new UserError('Not exist this app name');
let maxNumber = 0;
for (let mdb of versions) {
if (mdb.version > maxNumber)
maxNumber = mdb.version;
}
return maxNumber;
};
};

View File

@ -11,14 +11,12 @@ module.exports = Self => {
type: 'string',
required: true,
description: 'The app name'
},
{
}, {
arg: 'newVersion',
type: 'number',
required: true,
description: `The new version number`
},
{
}, {
arg: 'branch',
type: 'string',
required: true,

View File

@ -1,3 +1,4 @@
module.exports = Self => {
require('../methods/mdbVersion/upload')(Self);
require('../methods/mdbVersion/last')(Self);
};