aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-views.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video/video-views.ts')
-rw-r--r--server/models/video/video-views.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/server/models/video/video-views.ts b/server/models/video/video-views.ts
index fde5f7056..6071e8c22 100644
--- a/server/models/video/video-views.ts
+++ b/server/models/video/video-views.ts
@@ -41,4 +41,18 @@ export class VideoViewModel extends Model<VideoViewModel> {
41 }) 41 })
42 Video: VideoModel 42 Video: VideoModel
43 43
44 static removeOldRemoteViewsHistory (beforeDate: string) {
45 const query = {
46 where: {
47 startDate: {
48 [Sequelize.Op.lt]: beforeDate
49 },
50 videoId: {
51 [Sequelize.Op.in]: Sequelize.literal('(SELECT "id" FROM "video" WHERE "remote" IS TRUE)')
52 }
53 }
54 }
55
56 return VideoViewModel.destroy(query)
57 }
44} 58}