Multiple filters same path custom schema
chemitaxis opened this issue · 8 comments
chemitaxis commented
Hi, if you add this to the middleware:
query({
after: {
type: Date,
paths: ['DateInvoice'],
operator: '$gte'
},
before: {
type: Date,
paths: ['DateInvoice'],
operator: '$lte'
}
}),
Just the last is working, the first (after) is ignored... Any ideas? Thanks
chemitaxis commented
Hi @diegohaz Did you have time to check this? Thank you so much!!
chemitaxis commented
Here you have a test failing the issue:
request(
route(
new querymen.Schema({
before: {
type: Date,
operator: '$lte',
paths: ['createdAt']
},
after: {
type: Date,
operator: '$gte',
paths: ['createdAt']
}
})
)
)
.get('/tests')
.query({ after: '2016-04-22T10:00', before: '2016-04-23T09:00' })
.expect(200)
.end((err, res) => {
if (err) throw err
t.equal(res.body.length, 1, 'should respond with 1 item')
t.equal(
res.body[0].title,
'nice!',
'should respond with item after date and before date'
)
})
diegohaz commented
Could you start a PR with that test so we can try to pass it?
chemitaxis commented
of course ;)
chemitaxis commented
Done ;) Thanks @diegohaz
chemitaxis commented
Hi @diegohaz did you have time to check my PR? Thanks!
diegohaz commented
I'm not able to do that right now. Will check that as soon as possible.