Add comment filtering by reply count
This commit is contained in:
parent
6f79be110d
commit
c1125bcadc
8 changed files with 47 additions and 7 deletions
|
@ -22,6 +22,19 @@ function getSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderIt
|
|||
return [ [ finalField, direction ], lastSort ]
|
||||
}
|
||||
|
||||
function getCommentSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] {
|
||||
const { direction, field } = buildDirectionAndField(value)
|
||||
|
||||
if (field === 'totalReplies') {
|
||||
return [
|
||||
[ Sequelize.literal('"totalReplies"'), direction ],
|
||||
lastSort
|
||||
]
|
||||
}
|
||||
|
||||
return getSort(value, lastSort)
|
||||
}
|
||||
|
||||
function getVideoSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] {
|
||||
const { direction, field } = buildDirectionAndField(value)
|
||||
|
||||
|
@ -167,6 +180,7 @@ export {
|
|||
SortType,
|
||||
buildLocalAccountIdsIn,
|
||||
getSort,
|
||||
getCommentSort,
|
||||
getVideoSort,
|
||||
getBlacklistSort,
|
||||
createSimilarityAttribute,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue