mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 19:42:24 +02:00
server/server -> server/core
This commit is contained in:
parent
114327d4ce
commit
5a3d0650c9
838 changed files with 111 additions and 111 deletions
29
server/core/lib/video-playlist.ts
Normal file
29
server/core/lib/video-playlist.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
import * as Sequelize from 'sequelize'
|
||||
import { VideoPlaylistPrivacy, VideoPlaylistType } from '@peertube/peertube-models'
|
||||
import { VideoPlaylistModel } from '../models/video/video-playlist.js'
|
||||
import { MAccount } from '../types/models/index.js'
|
||||
import { MVideoPlaylistOwner } from '../types/models/video/video-playlist.js'
|
||||
import { getLocalVideoPlaylistActivityPubUrl } from './activitypub/url.js'
|
||||
|
||||
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 = getLocalVideoPlaylistActivityPubUrl(videoPlaylist) // We use the UUID, so set the URL after building the object
|
||||
|
||||
await videoPlaylist.save({ transaction: t })
|
||||
|
||||
videoPlaylist.OwnerAccount = account
|
||||
|
||||
return videoPlaylist
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export {
|
||||
createWatchLaterPlaylist
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue