]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/video-import.ts
Rename streaming playlists routes/directories
[github/Chocobozzz/PeerTube.git] / server / models / video / video-import.ts
index 9d1f783c75e3a91d6cd647544ec13d89b15e2b0e..9bc0f17f53efaa52b810a4678bb60aa38b41909e 100644 (file)
@@ -115,7 +115,7 @@ export class VideoImportModel extends Model<VideoImportModel> {
   }
 
   static loadAndPopulateVideo (id: number) {
-    return VideoImportModel.findById(id)
+    return VideoImportModel.findByPk(id)
   }
 
   static listUserVideoImportsForApi (userId: number, start: number, count: number, sort: string) {
@@ -144,14 +144,17 @@ export class VideoImportModel extends Model<VideoImportModel> {
                            })
   }
 
+  getTargetIdentifier () {
+    return this.targetUrl || this.magnetUri || this.torrentName
+  }
+
   toFormattedJSON (): VideoImport {
     const videoFormatOptions = {
+      completeDescription: true,
       additionalAttributes: { state: true, waitTranscoding: true, scheduledUpdate: true }
     }
     const video = this.Video
-      ? Object.assign(this.Video.toFormattedJSON(videoFormatOptions), {
-        tags: this.Video.Tags.map(t => t.name)
-      })
+      ? Object.assign(this.Video.toFormattedJSON(videoFormatOptions), { tags: this.Video.Tags.map(t => t.name) })
       : undefined
 
     return {