diff options
author | Chocobozzz <me@florianbigard.com> | 2022-07-12 16:30:59 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-07-12 16:30:59 +0200 |
commit | 46f7cd6837311019acef6e2086c7b006e6dbe1b9 (patch) | |
tree | ce5af18f6fd3e936494f97461276dae4d968c917 /server/models/video | |
parent | 4ddb53f65d9d97fc3eb97d9dadcbbcf35d8ddab7 (diff) | |
download | PeerTube-46f7cd6837311019acef6e2086c7b006e6dbe1b9.tar.gz PeerTube-46f7cd6837311019acef6e2086c7b006e6dbe1b9.tar.zst PeerTube-46f7cd6837311019acef6e2086c7b006e6dbe1b9.zip |
Fix handling broken lives
We want the latest session that may already be finished
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video-live-session.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/server/models/video/video-live-session.ts b/server/models/video/video-live-session.ts index 836620872..758906a42 100644 --- a/server/models/video/video-live-session.ts +++ b/server/models/video/video-live-session.ts | |||
@@ -107,6 +107,15 @@ export class VideoLiveSessionModel extends Model<Partial<AttributesOnly<VideoLiv | |||
107 | }) | 107 | }) |
108 | } | 108 | } |
109 | 109 | ||
110 | static findLatestSessionOf (videoId: number) { | ||
111 | return VideoLiveSessionModel.findOne({ | ||
112 | where: { | ||
113 | liveVideoId: videoId | ||
114 | }, | ||
115 | order: [ [ 'startDate', 'DESC' ] ] | ||
116 | }) | ||
117 | } | ||
118 | |||
110 | static listSessionsOfLiveForAPI (options: { videoId: number }) { | 119 | static listSessionsOfLiveForAPI (options: { videoId: number }) { |
111 | const { videoId } = options | 120 | const { videoId } = options |
112 | 121 | ||