salix/modules/entry/back/methods/entry/buyLabel.js

57 lines
1.6 KiB
JavaScript

module.exports = Self => {
Self.remoteMethodCtx('buyLabel', {
description: 'Returns the buy label',
accessType: 'READ',
accepts: [
{
arg: 'id',
type: 'number',
required: true,
description: 'The buy id',
http: {source: 'path'}
}, {
arg: 'labelType',
type: 'string',
required: true,
description: 'The label type',
http: {source: 'path'}
}, {
arg: 'packing',
type: 'number',
required: false
}, {
arg: 'copies',
type: 'number',
required: false
}
],
returns: [
{
arg: 'body',
type: 'file',
root: true
}, {
arg: 'Content-Type',
type: 'String',
http: {target: 'header'}
}, {
arg: 'Content-Disposition',
type: 'String',
http: {target: 'header'}
}
],
http: {
path: '/:id/:labelType/buy-label',
verb: 'GET'
},
accessScopes: ['DEFAULT', 'read:multimedia']
});
Self.buyLabel = (ctx, id, labelType) => {
if (labelType == 'qr')
return Self.printReport(ctx, id, 'buy-label-qr');
else
return Self.printReport(ctx, id, 'buy-label-barcode');
};
};