Generic consumers
Examples
//consumerExample.js
const genericConsumers = require('@victorlizarraga/generic-consumers');
const { app } = require('@carlosbajo/micro');
module.exports = {
getAll: genericConsumers.findAll(app, 'modelExample'),
//input req.arg._id
getById: genericConsumers.findOneById(app, 'modelExample'),
//input req.arg._id
deleteById: genericConsumers.deleteById(app, 'modelExample'),
//input req.arg
insert: genericConsumers.insert(app, 'modelExample'),
//input req.arg
update: genericConsumers.update(app, 'modelExample'),
//input req.arg.testId
//Model must have property 'testId'
findByTestId: genercConsumers.findByProps(app, 'modelExample', ['testId']),
//input req.arg.testId
//Model must have property 'testId'
findOneByTestId: genercConsumers.findOneByProps(app, 'modelExample', [
'testId'
])
};