aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-01-18 11:23:41 +0100
committerChocobozzz <me@florianbigard.com>2022-01-18 11:23:41 +0100
commit7177b46ca1b35aa9d7ed39a06c1dcf41a4fc6180 (patch)
tree016cb0d966fe9fea8a6381eb246e966f5c4eae57 /server/models
parent3b83faccfffc13adaef0b63c211b1ce4944e8b3b (diff)
downloadPeerTube-7177b46ca1b35aa9d7ed39a06c1dcf41a4fc6180.tar.gz
PeerTube-7177b46ca1b35aa9d7ed39a06c1dcf41a4fc6180.tar.zst
PeerTube-7177b46ca1b35aa9d7ed39a06c1dcf41a4fc6180.zip
Add ability to delete history element
Diffstat (limited to 'server/models')
-rw-r--r--server/models/user/user-video-history.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/server/models/user/user-video-history.ts b/server/models/user/user-video-history.ts
index 92f4fe7a1..f4d0889a1 100644
--- a/server/models/user/user-video-history.ts
+++ b/server/models/user/user-video-history.ts
@@ -69,6 +69,17 @@ export class UserVideoHistoryModel extends Model<Partial<AttributesOnly<UserVide
69 }) 69 })
70 } 70 }
71 71
72 static removeUserHistoryElement (user: MUserId, videoId: number) {
73 const query: DestroyOptions = {
74 where: {
75 userId: user.id,
76 videoId
77 }
78 }
79
80 return UserVideoHistoryModel.destroy(query)
81 }
82
72 static removeUserHistoryBefore (user: MUserId, beforeDate: string, t: Transaction) { 83 static removeUserHistoryBefore (user: MUserId, beforeDate: string, t: Transaction) {
73 const query: DestroyOptions = { 84 const query: DestroyOptions = {
74 where: { 85 where: {