29 lines
866 B
JavaScript
29 lines
866 B
JavaScript
module.exports = Self => {
|
|
Self.remoteMethodCtx('itemShelvingSaleByCollection', {
|
|
description: 'Insert sales of the collection in itemShelvingSale',
|
|
accessType: 'WRITE',
|
|
accepts: [
|
|
{
|
|
arg: 'id',
|
|
type: 'number',
|
|
description: 'The collection id',
|
|
required: true,
|
|
http: {source: 'path'}
|
|
}
|
|
],
|
|
http: {
|
|
path: `/:id/itemShelvingSaleByCollection`,
|
|
verb: 'POST'
|
|
}
|
|
});
|
|
|
|
Self.itemShelvingSaleByCollection = 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_addByCollection(?)`, [id], myOptions);
|
|
};
|
|
};
|