1 import { Transaction } from 'sequelize'
2 import { getServerActor } from '../../helpers'
3 import { VideoModel } from '../../models/video/video'
4 import { VideoShareModel } from '../../models/video/video-share'
5 import { sendVideoAnnounceToFollowers } from './send'
7 async function shareVideoByServerAndChannel (video: VideoModel, t: Transaction) {
8 const serverActor = await getServerActor()
10 const serverShare = VideoShareModel.create({
11 actorId: serverActor.id,
13 }, { transaction: t })
15 const videoChannelShare = VideoShareModel.create({
16 actorId: video.VideoChannel.actorId,
18 }, { transaction: t })
25 return sendVideoAnnounceToFollowers(serverActor, video, t)
29 shareVideoByServerAndChannel