]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/video-live-session.ts
Add ability to list imports of a channel sync
[github/Chocobozzz/PeerTube.git] / server / models / video / video-live-session.ts
index 8366208729bdcc72b1571a66e4ed9c28a1f922aa..ed386052bc37fd12877053a4b881f3e59f37354f 100644 (file)
@@ -53,6 +53,14 @@ export class VideoLiveSessionModel extends Model<Partial<AttributesOnly<VideoLiv
   @Column
   error: LiveVideoError
 
+  @AllowNull(false)
+  @Column
+  saveReplay: boolean
+
+  @AllowNull(false)
+  @Column
+  endingProcessed: boolean
+
   @ForeignKey(() => VideoModel)
   @Column
   replayVideoId: number
@@ -107,6 +115,15 @@ export class VideoLiveSessionModel extends Model<Partial<AttributesOnly<VideoLiv
     })
   }
 
+  static findLatestSessionOf (videoId: number) {
+    return VideoLiveSessionModel.findOne({
+      where: {
+        liveVideoId: videoId
+      },
+      order: [ [ 'startDate', 'DESC' ] ]
+    })
+  }
+
   static listSessionsOfLiveForAPI (options: { videoId: number }) {
     const { videoId } = options
 
@@ -135,6 +152,8 @@ export class VideoLiveSessionModel extends Model<Partial<AttributesOnly<VideoLiv
       endDate: this.endDate
         ? this.endDate.toISOString()
         : null,
+      endingProcessed: this.endingProcessed,
+      saveReplay: this.saveReplay,
       replayVideo,
       error: this.error
     }