]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/video-live-session.ts
Translated using Weblate (Japanese)
[github/Chocobozzz/PeerTube.git] / server / models / video / video-live-session.ts
index 2b4cde9f878fb2693141f365509ab9130a201de3..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,10 +115,19 @@ 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
 
-    const query: FindOptions<VideoLiveSessionModel> = {
+    const query: FindOptions<AttributesOnly<VideoLiveSessionModel>> = {
       where: {
         liveVideoId: videoId
       },
@@ -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
     }