diff options
Diffstat (limited to 'server/models/account/user-video-history.ts')
-rw-r--r-- | server/models/account/user-video-history.ts | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/server/models/account/user-video-history.ts b/server/models/account/user-video-history.ts index 15cb399c9..49d2def81 100644 --- a/server/models/account/user-video-history.ts +++ b/server/models/account/user-video-history.ts | |||
@@ -67,7 +67,7 @@ export class UserVideoHistoryModel extends Model<UserVideoHistoryModel> { | |||
67 | }) | 67 | }) |
68 | } | 68 | } |
69 | 69 | ||
70 | static removeHistoryBefore (user: UserModel, beforeDate: string, t: Transaction) { | 70 | static removeUserHistoryBefore (user: UserModel, beforeDate: string, t: Transaction) { |
71 | const query: DestroyOptions = { | 71 | const query: DestroyOptions = { |
72 | where: { | 72 | where: { |
73 | userId: user.id | 73 | userId: user.id |
@@ -83,4 +83,16 @@ export class UserVideoHistoryModel extends Model<UserVideoHistoryModel> { | |||
83 | 83 | ||
84 | return UserVideoHistoryModel.destroy(query) | 84 | return UserVideoHistoryModel.destroy(query) |
85 | } | 85 | } |
86 | |||
87 | static removeOldHistory (beforeDate: string) { | ||
88 | const query: DestroyOptions = { | ||
89 | where: { | ||
90 | updatedAt: { | ||
91 | [Op.lt]: beforeDate | ||
92 | } | ||
93 | } | ||
94 | } | ||
95 | |||
96 | return UserVideoHistoryModel.destroy(query) | ||
97 | } | ||
86 | } | 98 | } |