+
+ static listForApi (user: UserModel, start: number, count: number) {
+ return VideoModel.listForApi({
+ start,
+ count,
+ sort: '-UserVideoHistories.updatedAt',
+ nsfw: null, // All
+ includeLocalVideos: true,
+ withFiles: false,
+ user,
+ historyOfUser: user
+ })
+ }
+
+ static removeHistoryBefore (user: UserModel, beforeDate: string, t: Transaction) {
+ const query: DestroyOptions = {
+ where: {
+ userId: user.id
+ },
+ transaction: t
+ }
+
+ if (beforeDate) {
+ query.where.updatedAt = {
+ [Op.lt]: beforeDate
+ }
+ }
+
+ return UserVideoHistoryModel.destroy(query)
+ }