30 lines
736 B
JavaScript
30 lines
736 B
JavaScript
const {Email} = require('vn-print');
|
|
|
|
module.exports = Self => {
|
|
Self.remoteMethodCtx('buyerWasteEmail', {
|
|
description: 'Sends the buyer waste email',
|
|
accessType: 'WRITE',
|
|
accepts: [],
|
|
returns: {
|
|
type: ['object'],
|
|
root: true
|
|
},
|
|
http: {
|
|
path: '/buyer-waste-email',
|
|
verb: 'POST'
|
|
}
|
|
});
|
|
|
|
Self.buyerWasteEmail = async ctx => {
|
|
const models = Self.app.models;
|
|
const itemConfig = await models.ItemConfig.findOne();
|
|
|
|
const email = new Email('buyer-week-waste', {
|
|
recipient: itemConfig.wasteRecipients,
|
|
lang: ctx.req.getLocale()
|
|
});
|
|
|
|
return email.send();
|
|
};
|
|
};
|