]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/user/user-video-history.ts
Don't fail remote transcoding on retry
[github/Chocobozzz/PeerTube.git] / server / models / user / user-video-history.ts
index e3dc4a062d77f0d8640b989229eea8ac6e8bd10f..f4d0889a104c7bb8df09d80c065cce55024f4c8d 100644 (file)
@@ -1,7 +1,7 @@
 import { DestroyOptions, Op, Transaction } from 'sequelize'
 import { AllowNull, BelongsTo, Column, CreatedAt, ForeignKey, IsInt, Model, Table, UpdatedAt } from 'sequelize-typescript'
 import { MUserAccountId, MUserId } from '@server/types/models'
-import { AttributesOnly } from '@shared/core-utils'
+import { AttributesOnly } from '@shared/typescript-utils'
 import { VideoModel } from '../video/video'
 import { UserModel } from './user'
 
@@ -63,13 +63,23 @@ export class UserVideoHistoryModel extends Model<Partial<AttributesOnly<UserVide
       search,
       sort: '-"userVideoHistory"."updatedAt"',
       nsfw: null, // All
-      includeLocalVideos: true,
-      withFiles: false,
+      displayOnlyForFollower: null,
       user,
       historyOfUser: user
     })
   }
 
+  static removeUserHistoryElement (user: MUserId, videoId: number) {
+    const query: DestroyOptions = {
+      where: {
+        userId: user.id,
+        videoId
+      }
+    }
+
+    return UserVideoHistoryModel.destroy(query)
+  }
+
   static removeUserHistoryBefore (user: MUserId, beforeDate: string, t: Transaction) {
     const query: DestroyOptions = {
       where: {