Fixed expiry filter breaking with only 1 date

This commit is contained in:
Bobby Wibowo 2020-05-17 23:43:08 +07:00
parent 575a9353fa
commit 93ee4dae05
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF

View File

@ -1180,9 +1180,9 @@ self.list = async (req, res) => {
if (typeof filterObj.queries.expiry.to === 'number')
this.andWhereBetween('expirydate', [filterObj.queries.expiry.from, filterObj.queries.expiry.to])
else
this.andWhere('expirydate', '>=', filterObj.queries.date.from)
this.andWhere('expirydate', '>=', filterObj.queries.expiry.from)
else
this.andWhere('expirydate', '<=', filterObj.queries.date.to)
this.andWhere('expirydate', '<=', filterObj.queries.expiry.to)
})
// Then, refine using type-is flags