Fix video comments feed SQL query
authorChocobozzz <me@florianbigard.com>
Fri, 5 Jun 2020 08:42:36 +0000 (10:42 +0200)
committerChocobozzz <me@florianbigard.com>
Tue, 9 Jun 2020 12:52:55 +0000 (14:52 +0200)
server/models/video/video-comment.ts
server/models/video/video.ts

index ba09522cceb492ca30fcf5ae7cc758cf9cda718b..cf2a80d531516ab2f2d287a9c7da3b4718ad5a71 100644 (file)
@@ -144,6 +144,11 @@ enum ScopeNames {
     },
     {
       fields: [ 'accountId' ]
+    },
+    {
+      fields: [
+        { name: 'createdAt', order: 'DESC' }
+      ]
     }
   ]
 })
index 02a4c851c2f28235cc455b9102b2fd10889bd62d..344bfc92975d721b3fb49c69ebf90eca0c179804 100644 (file)
@@ -23,7 +23,7 @@ import {
   Table,
   UpdatedAt
 } from 'sequelize-typescript'
-import { UserRight, VideoPrivacy, VideoState } from '../../../shared'
+import { UserRight, VideoPrivacy, VideoState, ResultList } from '../../../shared'
 import { VideoTorrentObject } from '../../../shared/models/activitypub/objects'
 import { Video, VideoDetails } from '../../../shared/models/videos'
 import { VideoFilter } from '../../../shared/models/videos/video-query.type'
@@ -1442,7 +1442,7 @@ export class VideoModel extends Model<VideoModel> {
   private static async getAvailableForApi (
     options: BuildVideosQueryOptions,
     countVideos = true
-  ) {
+  ): Promise<ResultList<VideoModel>> {
     function getCount () {
       if (countVideos !== true) return Promise.resolve(undefined)