Tarea #562 /order/getVolumes.js
This commit is contained in:
parent
5d9ad9b2d3
commit
feb80006ab
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
|
@ -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);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue