Tarea #562 /order/getVolumes.js

This commit is contained in:
gerard 2018-08-08 16:15:53 +02:00
parent 5d9ad9b2d3
commit feb80006ab
2 changed files with 11 additions and 2 deletions

View File

@ -1,5 +1,5 @@
module.exports = Self => { module.exports = Self => {
Self.remoteMethod('getVolume', { Self.remoteMethod('getVolumes', {
description: 'Returns the volumes of a order', description: 'Returns the volumes of a order',
accessType: 'READ', accessType: 'READ',
accepts: [{ accepts: [{
@ -18,7 +18,7 @@ module.exports = Self => {
} }
}); });
Self.getVolume = async orderFk => { Self.getVolumes = async orderFk => {
let [volume] = await Self.rawSql(`CALL vn.orderListVolume(?)`, [orderFk]); let [volume] = await Self.rawSql(`CALL vn.orderListVolume(?)`, [orderFk]);
return volume; return volume;
}; };

View File

@ -0,0 +1,9 @@
const app = require(`../../../../server/server`);
describe('order getVolumes()', () => {
it('should return the volumes of a given order id', async() => {
let [result] = await app.models.Order.getVolumes(1);
expect(result.volume).toEqual(0.072);
});
});