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

50 lines
1.5 KiB
JavaScript

module.exports = Self => {
Self.remoteMethodCtx('deliveryNoteEmail', {
description: 'Sends the delivery note email with an attached PDF',
accessType: 'WRITE',
accepts: [
{
arg: 'id',
type: 'number',
required: true,
description: 'The ticket id',
http: {source: 'path'}
},
{
arg: 'recipient',
type: 'string',
description: 'The recipient email',
required: true,
},
{
arg: 'replyTo',
type: 'string',
description: 'The sender email to reply to',
required: false
},
{
arg: 'recipientId',
type: 'number',
description: 'The recipient id to send to the recipient preferred language',
required: false
},
{
arg: 'type',
type: 'string',
description: 'The delivery note type [ deliveryNote, proforma, withoutPrices ]',
required: false
},
],
returns: {
type: ['object'],
root: true
},
http: {
path: '/:id/delivery-note-email',
verb: 'POST'
}
});
Self.deliveryNoteEmail = ctx => Self.sendTemplate(ctx, 'delivery-note');
};