I wrote the following router in Foxx Microservices:
router.post('/PersonInformation', function (req, res) {
const keys = db._query(aql`
FOR p IN Personal
FILTER (p.stateId IN ${req.queryParams.statePar} OR IS_NULL(${req.queryParams.statePar}))
AND p.empDate >= TO_NUMBER(${req.queryParams.fromDatePar}) AND p.empDate <= TO_NUMBER(${req.queryParams.toDatePar})
RETURN p
`);
res.send(keys);
})
.queryParam('statePar', joi.array().default(null), 'State Parameter')
.queryParam ('fromDatePar', joi.string().required(), 'FromDate Parameter')
.queryParam('toDatePar', joi.string().required(), 'ToDate Parameter')
.response(joi.array().items(
joi.string().required()
).required(), 'List of entry keys.')
.summary('List entry keys')
.description('Assembles a list of keys of entries in the collection.');
How i can convert queryParam to body parameter. I used .body instead of .queryParam, but it does not answer. I also wrote the table as follows, but it still does not work:
router.post('/PersonInformation', function (req, res) {
const distributorIdPar = req.body;
const cityPar = req.body;
const productIdPar = req.body;
const fromDatePar = req.body;
const toDatePar = req.body;
const keys = db._query(aql`
const keys = db._query(aql`
FOR p IN Personal
FILTER (p.stateId IN ${req.body.statePar} OR IS_NULL(${req.body.statePar}))
AND p.empDate >= TO_NUMBER(${req.body.fromDatePar}) AND p.empDate <= TO_NUMBER(${req.body.toDatePar})
RETURN p
`);
res.send(keys);
})
.response(joi.array().items(
joi.string().required()
).required(), 'List of entry keys.')
.summary('List entry keys')
.description('Assembles a list of keys of entries in the collection.');