mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-31 07:11:33 +00:00
Accept orderby: as alternative for sort:
This commit is contained in:
parent
0fad346df6
commit
93c6031bb1
@ -849,7 +849,8 @@ self.list = async (req, res) => {
|
||||
filterObj.queries = searchQuery.parse(filters, {
|
||||
keywords: keywords.concat([
|
||||
'is',
|
||||
'sort'
|
||||
'sort',
|
||||
'orderby'
|
||||
]),
|
||||
ranges,
|
||||
tokenize: true,
|
||||
@ -857,6 +858,13 @@ self.list = async (req, res) => {
|
||||
offsets: false
|
||||
})
|
||||
|
||||
// Accept orderby as alternative for sort
|
||||
if (filterObj.queries.orderby) {
|
||||
if (!filterObj.queries.sort) filterObj.queries.sort = []
|
||||
filterObj.queries.sort = filterObj.queries.sort.concat(filterObj.queries.orderby)
|
||||
delete filterObj.queries.orderby
|
||||
}
|
||||
|
||||
// For some reason, single value won't be in Array even with 'alwaysArray' option
|
||||
if (typeof filterObj.queries.exclude.text === 'string')
|
||||
filterObj.queries.exclude.text = [filterObj.queries.exclude.text]
|
||||
|
Loading…
Reference in New Issue
Block a user