salix/modules/client/back/methods/receipt/receiptPdf.js

43 lines
1.1 KiB
JavaScript

module.exports = Self => {
Self.remoteMethodCtx('receiptPdf', {
description: 'Send the receipt pdf to client',
accepts: [
{
arg: 'id',
type: 'number',
required: true,
description: 'The receipt id',
http: {source: 'path'}
},
{
arg: 'recipientId',
type: 'number',
description: 'The recipient id',
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/receipt-pdf',
verb: 'GET'
},
accessScopes: ['DEFAULT', 'read:multimedia']
});
Self.receiptPdf = (ctx, id) => Self.printReport(ctx, id, 'receipt');
};