feat(salix): refs #6321 #6321 getSimilar
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Javier Segarra 2024-05-02 13:53:28 +02:00
parent 63d07cb082
commit 7caea44427
2 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,59 @@
module.exports = Self => {
Self.remoteMethodCtx('getSimilar', {
description: 'Returns the ',
accessType: 'READ',
accepts: [{
arg: 'filter',
type: 'Object',
required: true,
description: 'Filter defining where and paginated data',
http: {source: 'query'}
}],
returns: {
type: ['Object'],
root: true
},
http: {
path: `/getSimilar`,
verb: 'GET'
}
});
Self.getSimilar = async(ctx, filter, options) => {
const myOptions = {userId: ctx.req.accessToken.userId};
if (typeof options == 'object')
Object.assign(myOptions, options);
// const where = filter.where;
// const query = 'CALL vn.item_getSimilar(?, ?, ?)';
// const [results] = await Self.rawSql(query, [where.itemFk, where.warehouseFk, where.date], myOptions);
return [
{
'id': 1,
'longName': 'Ranged weapon longbow 200cm',
'subName': 'Stark Industries',
'tag5': 'Color',
'value5': 'Brown',
'match5': 0,
'match6': 0,
'match7': 0,
'match8': 1,
'tag6': 'Categoria',
'value6': '+1 precission',
'tag7': 'Tallos',
'value7': '1',
'tag8': null,
'value8': null,
'available': 185,
'calc_id': 6,
'counter': 0,
'minQuantity': 1,
'visible': null,
'price2': null
}
];
};
};

View File

@ -5,6 +5,7 @@ module.exports = Self => {
require('../methods/item/clone')(Self); require('../methods/item/clone')(Self);
require('../methods/item/updateTaxes')(Self); require('../methods/item/updateTaxes')(Self);
require('../methods/item/getBalance')(Self); require('../methods/item/getBalance')(Self);
require('../methods/item/getSimilar')(Self);
require('../methods/item/lastEntriesFilter')(Self); require('../methods/item/lastEntriesFilter')(Self);
require('../methods/item/getSummary')(Self); require('../methods/item/getSummary')(Self);
require('../methods/item/getCard')(Self); require('../methods/item/getCard')(Self);