]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/video-playlist.ts
Refactor playlist creation for lives
[github/Chocobozzz/PeerTube.git] / server / lib / video-playlist.ts
index 6e214e60f226c852235641a714a63eb1f55f6bf2..a1af2e1af66116a3d2a5481e53be4e95919c4f9d 100644 (file)
@@ -1,19 +1,20 @@
 import * as Sequelize from 'sequelize'
-import { AccountModel } from '../models/account/account'
-import { VideoPlaylistModel } from '../models/video/video-playlist'
 import { VideoPlaylistPrivacy } from '../../shared/models/videos/playlist/video-playlist-privacy.model'
-import { getVideoPlaylistActivityPubUrl } from './activitypub'
 import { VideoPlaylistType } from '../../shared/models/videos/playlist/video-playlist-type.model'
+import { VideoPlaylistModel } from '../models/video/video-playlist'
+import { MAccount } from '../types/models'
+import { MVideoPlaylistOwner } from '../types/models/video/video-playlist'
+import { getLocalVideoPlaylistActivityPubUrl } from './activitypub/url'
 
-async function createWatchLaterPlaylist (account: AccountModel, t: Sequelize.Transaction) {
-  const videoPlaylist = new VideoPlaylistModel({
+async function createWatchLaterPlaylist (account: MAccount, t: Sequelize.Transaction) {
+  const videoPlaylist: MVideoPlaylistOwner = new VideoPlaylistModel({
     name: 'Watch later',
     privacy: VideoPlaylistPrivacy.PRIVATE,
     type: VideoPlaylistType.WATCH_LATER,
     ownerAccountId: account.id
   })
 
-  videoPlaylist.url = getVideoPlaylistActivityPubUrl(videoPlaylist) // We use the UUID, so set the URL after building the object
+  videoPlaylist.url = getLocalVideoPlaylistActivityPubUrl(videoPlaylist) // We use the UUID, so set the URL after building the object
 
   await videoPlaylist.save({ transaction: t })