This commit is contained in:
parent
75e54bd82f
commit
e51df063d3
|
@ -1,5 +1,5 @@
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethod('itemShelvingSaleByCollection', {
|
Self.remoteMethodCtx('itemShelvingSaleByCollection', {
|
||||||
description: 'Insert sales of the collection in itemShelvingSale',
|
description: 'Insert sales of the collection in itemShelvingSale',
|
||||||
accessType: 'WRITE',
|
accessType: 'WRITE',
|
||||||
accepts: [
|
accepts: [
|
||||||
|
@ -17,7 +17,12 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.itemShelvingSaleByCollection = async id => {
|
Self.itemShelvingSaleByCollection = async(ctx, id, options) => {
|
||||||
await Self.rawSql(`CALL vn.itemShelvingSale_addByCollection(?)`, [id]);
|
const myOptions = {userId: ctx.req.accessToken.userId};
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
await Self.rawSql(`CALL vn.itemShelvingSale_addByCollection(?)`, [id], myOptions);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethod('itemShelvingSaleSetQuantity', {
|
Self.remoteMethodCtx('itemShelvingSaleSetQuantity', {
|
||||||
description: 'Set quanitity of a sale in itemShelvingSale',
|
description: 'Set quanitity of a sale in itemShelvingSale',
|
||||||
accessType: 'WRITE',
|
accessType: 'WRITE',
|
||||||
accepts: [
|
accepts: [
|
||||||
|
@ -28,7 +28,14 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.itemShelvingSaleSetQuantity = async(id, quantity, isItemShelvingSaleEmpty) => {
|
Self.itemShelvingSaleSetQuantity = async(ctx, id, quantity, isItemShelvingSaleEmpty, options) => {
|
||||||
await Self.rawSql(`CALL vn.itemShelvingSale_setQuantity(?, ?, ? )`, [id, quantity, isItemShelvingSaleEmpty]);
|
const myOptions = {userId: ctx.req.accessToken.userId};
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
await Self.rawSql(`CALL vn.itemShelvingSale_setQuantity(?, ?, ? )`,
|
||||||
|
[id, quantity, isItemShelvingSaleEmpty],
|
||||||
|
myOptions);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue