refs #5890:feat:ItemShelvingSale
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Sergio De la torre 2023-10-10 14:39:02 +02:00
parent 1a2b58af9c
commit ca4086d115
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 => {
require('../methods/item-shelving-sale/filter')(Self);
require('../methods/item-shelving-sale/itemShelvingSaleByCollection')(Self);
require('../methods/item-shelving-sale/itemShelvingSaleBySale')(Self);
require('../methods/item-shelving-sale/itemShelvingSaleSetQuantity')(Self);
};

View File

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