salix/modules/ticket/back/methods/ticket/deliveryNotePdf.js

50 lines
1.4 KiB
JavaScript

module.exports = Self => {
Self.remoteMethodCtx('deliveryNotePdf', {
description: 'Returns the delivery note pdf',
accessType: 'READ',
accepts: [
{
arg: 'id',
type: 'number',
required: true,
description: 'The ticket id',
http: {source: 'path'}
},
{
arg: 'recipientId',
type: 'number',
description: 'The client id',
required: false
},
{
arg: 'type',
type: 'string',
description: 'The delivery note type [ deliveryNote, proforma, withoutPrices ]',
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/delivery-note-pdf',
verb: 'GET'
},
accessScopes: ['DEFAULT', 'read:multimedia']
});
Self.deliveryNotePdf = (ctx, id) => Self.printReport(ctx, id, 'delivery-note');
};