From 8e286cdca4ccfbd1ee5edc4b4446a6f81e7586a4 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Fri, 26 Feb 2021 14:08:09 +0100 Subject: add sort select to my videos, change default sort to -publishedAt fixes #3779 --- server/models/utils.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'server/models') diff --git a/server/models/utils.ts b/server/models/utils.ts index 5337ae75d..ec51c66bf 100644 --- a/server/models/utils.ts +++ b/server/models/utils.ts @@ -54,6 +54,14 @@ function getVideoSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): Or [ Sequelize.col('VideoModel.views'), direction ], + lastSort + ] + } else if (field === 'publishedAt') { + return [ + [ 'ScheduleVideoUpdate', 'updateAt', direction + ' NULLS LAST' ], + + [ Sequelize.col('VideoModel.publishedAt'), direction ], + lastSort ] } -- cgit v1.2.3