Compare commits

...

1 Commits

Author SHA1 Message Date
Sergio De la torre ca4086d115 refs #5890:feat:ItemShelvingSale
gitea/salix/pipeline/head This commit looks good Details
2023-10-10 14:39:02 +02:00
4 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,20 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_reserveBySale`(
vSaleFk INT ,
vUserFk INT
)
BEGIN
/**
* Reserva cantida y ubicación para una saleFk
*
* @param vSaleFk Identificador de la venta
* @param vQuantity Cantidad a reservar
* @param vUserFk Id de usuario que realiza la reserva
*/
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
ENGINE = MEMORY
SELECT vSaleFk saleFk, vUserFk userFk;
CALL itemShelvingSale_reserve();
END$$
DELIMITER ;

View File

@ -0,0 +1,28 @@
module.exports = Self => {
Self.remoteMethodCtx('itemShelvingSaleBySale', {
description: 'Insert sale in itemShelvingSale',
accessType: 'WRITE',
accepts: [
{
arg: 'id',
type: 'number',
description: 'The sale id',
required: true,
http: { source: 'path' }
}
],
http: {
path: `/:id/itemShelvingSaleBySale`,
verb: 'POST'
}
});
Self.itemShelvingSaleBySale = async (ctx, id, options) => {
const myOptions = { userId: ctx.req.accessToken.userId };
if (typeof options == 'object')
Object.assign(myOptions, options);
await Self.rawSql(`CALL vn.itemShelvingSale_reserveBySale(?)`, [id], myOptions);
};
};

View File

@ -1,5 +1,6 @@
module.exports = Self => { module.exports = Self => {
require('../methods/item-shelving-sale/filter')(Self); require('../methods/item-shelving-sale/filter')(Self);
require('../methods/item-shelving-sale/itemShelvingSaleByCollection')(Self); require('../methods/item-shelving-sale/itemShelvingSaleByCollection')(Self);
require('../methods/item-shelving-sale/itemShelvingSaleBySale')(Self);
require('../methods/item-shelving-sale/itemShelvingSaleSetQuantity')(Self); require('../methods/item-shelving-sale/itemShelvingSaleSetQuantity')(Self);
}; };

View File

@ -17,6 +17,9 @@
}, },
"created": { "created": {
"type": "date" "type": "date"
},
"isPicked": {
"type": "Boolean"
} }
}, },
"relations": { "relations": {