salix/modules/invoiceIn/back/methods/invoice-in/summary.js

43 lines
1.0 KiB
JavaScript
Raw Normal View History

2021-04-15 08:44:25 +00:00
module.exports = Self => {
Self.remoteMethod('summary', {
description: 'The invoiceIn summary',
accessType: 'READ',
accepts: [{
arg: 'id',
type: 'number',
required: true,
description: 'The invoiceIn id',
http: {source: 'path'}
}],
returns: {
type: 'object',
root: true
},
http: {
path: `/:id/summary`,
verb: 'GET'
}
});
Self.summary = async id => {
const filter = {
include: [
{
relation: 'company',
scope: {
fields: ['id', 'code']
}
},
{
relation: 'supplier',
scope: {
fields: ['id', 'name']
}
}
]
};
return Self.app.models.InvoiceIn.findById(id, filter);
};
};