- return videoChannel.save(options)
- .then(videoChannelCreated => {
- // Do not forget to add Author information to the created video channel
- videoChannelCreated.Author = author
- videoChannelUUID = videoChannelCreated.uuid
-
- return videoChannelCreated
- })
- .then(videoChannel => {
- const remoteVideoChannel = videoChannel.toAddRemoteJSON()
-
- // Now we'll add the video channel's meta data to our friends
- return addVideoChannelToFriends(remoteVideoChannel, t)
- })
- .then(() => videoChannelUUID) // Return video channel UUID
+ const videoChannelCreated = await videoChannel.save(options)
+
+ // Do not forget to add Account information to the created video channel
+ videoChannelCreated.Account = account
+
+ // No need to seed this empty video channel to followers
+ return videoChannelCreated
+}
+
+async function fetchVideoChannelByHostAndUUID (serverHost: string, uuid: string, t: Sequelize.Transaction) {
+ try {
+ const videoChannel = await db.VideoChannel.loadByHostAndUUID(serverHost, uuid, t)
+ if (!videoChannel) throw new Error('Video channel not found')
+
+ return videoChannel
+ } catch (err) {
+ logger.error('Cannot load video channel from host and uuid.', { error: err.stack, serverHost, uuid })
+ throw err
+ }