diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2021-02-26 14:08:09 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-04-06 10:03:19 +0200 |
commit | 8e286cdca4ccfbd1ee5edc4b4446a6f81e7586a4 (patch) | |
tree | b1d2ed65c602a9a295aa3c4359f1eb705b79278a /server/models/utils.ts | |
parent | 6a882428e11f924db2ae8ff188df11a42eaaec46 (diff) | |
download | PeerTube-8e286cdca4ccfbd1ee5edc4b4446a6f81e7586a4.tar.gz PeerTube-8e286cdca4ccfbd1ee5edc4b4446a6f81e7586a4.tar.zst PeerTube-8e286cdca4ccfbd1ee5edc4b4446a6f81e7586a4.zip |
add sort select to my videos, change default sort to -publishedAt
fixes #3779
Diffstat (limited to 'server/models/utils.ts')
-rw-r--r-- | server/models/utils.ts | 8 |
1 files changed, 8 insertions, 0 deletions
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 | |||
@@ -56,6 +56,14 @@ function getVideoSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): Or | |||
56 | 56 | ||
57 | lastSort | 57 | lastSort |
58 | ] | 58 | ] |
59 | } else if (field === 'publishedAt') { | ||
60 | return [ | ||
61 | [ 'ScheduleVideoUpdate', 'updateAt', direction + ' NULLS LAST' ], | ||
62 | |||
63 | [ Sequelize.col('VideoModel.publishedAt'), direction ], | ||
64 | |||
65 | lastSort | ||
66 | ] | ||
59 | } | 67 | } |
60 | 68 | ||
61 | let finalField: string | Col | 69 | let finalField: string | Col |