29 lines
745 B
JavaScript
29 lines
745 B
JavaScript
module.exports = Self => {
|
|
Self.remoteMethod('new', {
|
|
description: 'Creates rows (lines) for a order',
|
|
accessType: 'WRITE',
|
|
accepts: [{
|
|
arg: 'params',
|
|
type: 'object',
|
|
required: true,
|
|
description: 'order id, item id, warehouse, quantity',
|
|
http: {source: 'body'}
|
|
}],
|
|
returns: {
|
|
type: 'object',
|
|
root: true
|
|
},
|
|
http: {
|
|
path: `/new`,
|
|
verb: 'POST'
|
|
}
|
|
});
|
|
|
|
Self.new = async params => {
|
|
return await Self.rawSql(
|
|
`CALL vn.orderAddItem(?, ?, ?, ?)`,
|
|
[params.warehouseFk, params.itemFk, params.quantity, params.orderFk]
|
|
);
|
|
};
|
|
};
|