]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/lib/video-playlist.ts
Redundancy and search tests in parallel too
[github/Chocobozzz/PeerTube.git] / server / lib / video-playlist.ts
CommitLineData
df0b219d
C
1import * as Sequelize from 'sequelize'
2import { AccountModel } from '../models/account/account'
3import { VideoPlaylistModel } from '../models/video/video-playlist'
4import { VideoPlaylistPrivacy } from '../../shared/models/videos/playlist/video-playlist-privacy.model'
5import { getVideoPlaylistActivityPubUrl } from './activitypub'
6import { VideoPlaylistType } from '../../shared/models/videos/playlist/video-playlist-type.model'
7
8async function createWatchLaterPlaylist (account: AccountModel, t: Sequelize.Transaction) {
9 const videoPlaylist = new VideoPlaylistModel({
10 name: 'Watch later',
11 privacy: VideoPlaylistPrivacy.PRIVATE,
12 type: VideoPlaylistType.WATCH_LATER,
13 ownerAccountId: account.id
14 })
15
16 videoPlaylist.url = getVideoPlaylistActivityPubUrl(videoPlaylist) // We use the UUID, so set the URL after building the object
17
18 await videoPlaylist.save({ transaction: t })
19
20 videoPlaylist.OwnerAccount = account
21
22 return videoPlaylist
23}
24
25// ---------------------------------------------------------------------------
26
27export {
28 createWatchLaterPlaylist
29}