diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-12 17:53:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-13 16:50:33 +0100 |
commit | 3fd3ab2d34d512b160a5e6084d7609be7b4f4452 (patch) | |
tree | e5ca358287fca6ecacce83defcf23af1e8e9f419 /server/lib/activitypub/share.ts | |
parent | c893d4514e6ecbf282c7985fe5f82b8acd8a1137 (diff) | |
download | PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.gz PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.zst PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.zip |
Move models to typescript-sequelize
Diffstat (limited to 'server/lib/activitypub/share.ts')
-rw-r--r-- | server/lib/activitypub/share.ts | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/server/lib/activitypub/share.ts b/server/lib/activitypub/share.ts index e14b0f50c..5bec61c05 100644 --- a/server/lib/activitypub/share.ts +++ b/server/lib/activitypub/share.ts | |||
@@ -1,14 +1,15 @@ | |||
1 | import { Transaction } from 'sequelize' | 1 | import { Transaction } from 'sequelize' |
2 | import { getServerAccount } from '../../helpers/utils' | 2 | import { getServerAccount } from '../../helpers' |
3 | import { database as db } from '../../initializers' | 3 | import { VideoModel } from '../../models/video/video' |
4 | import { VideoChannelInstance } from '../../models/index' | 4 | import { VideoChannelModel } from '../../models/video/video-channel' |
5 | import { VideoInstance } from '../../models/video/video-interface' | 5 | import { VideoChannelShareModel } from '../../models/video/video-channel-share' |
6 | import { sendVideoAnnounceToFollowers, sendVideoChannelAnnounceToFollowers } from './send/send-announce' | 6 | import { VideoShareModel } from '../../models/video/video-share' |
7 | import { sendVideoAnnounceToFollowers, sendVideoChannelAnnounceToFollowers } from './send' | ||
7 | 8 | ||
8 | async function shareVideoChannelByServer (videoChannel: VideoChannelInstance, t: Transaction) { | 9 | async function shareVideoChannelByServer (videoChannel: VideoChannelModel, t: Transaction) { |
9 | const serverAccount = await getServerAccount() | 10 | const serverAccount = await getServerAccount() |
10 | 11 | ||
11 | await db.VideoChannelShare.create({ | 12 | await VideoChannelShareModel.create({ |
12 | accountId: serverAccount.id, | 13 | accountId: serverAccount.id, |
13 | videoChannelId: videoChannel.id | 14 | videoChannelId: videoChannel.id |
14 | }, { transaction: t }) | 15 | }, { transaction: t }) |
@@ -16,10 +17,10 @@ async function shareVideoChannelByServer (videoChannel: VideoChannelInstance, t: | |||
16 | return sendVideoChannelAnnounceToFollowers(serverAccount, videoChannel, t) | 17 | return sendVideoChannelAnnounceToFollowers(serverAccount, videoChannel, t) |
17 | } | 18 | } |
18 | 19 | ||
19 | async function shareVideoByServer (video: VideoInstance, t: Transaction) { | 20 | async function shareVideoByServer (video: VideoModel, t: Transaction) { |
20 | const serverAccount = await getServerAccount() | 21 | const serverAccount = await getServerAccount() |
21 | 22 | ||
22 | await db.VideoShare.create({ | 23 | await VideoShareModel.create({ |
23 | accountId: serverAccount.id, | 24 | accountId: serverAccount.id, |
24 | videoId: video.id | 25 | videoId: video.id |
25 | }, { transaction: t }) | 26 | }, { transaction: t }) |