diff options
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video-channel-share-interface.ts | 5 | ||||
-rw-r--r-- | server/models/video/video-channel-share.ts | 10 | ||||
-rw-r--r-- | server/models/video/video-share-interface.ts | 5 | ||||
-rw-r--r-- | server/models/video/video-share.ts | 10 |
4 files changed, 18 insertions, 12 deletions
diff --git a/server/models/video/video-channel-share-interface.ts b/server/models/video/video-channel-share-interface.ts index bcb3a0e24..0482e8297 100644 --- a/server/models/video/video-channel-share-interface.ts +++ b/server/models/video/video-channel-share-interface.ts | |||
@@ -1,11 +1,12 @@ | |||
1 | import * as Bluebird from 'bluebird' | 1 | import * as Bluebird from 'bluebird' |
2 | import * as Sequelize from 'sequelize' | 2 | import * as Sequelize from 'sequelize' |
3 | import { Transaction } from 'sequelize' | ||
3 | import { AccountInstance } from '../account/account-interface' | 4 | import { AccountInstance } from '../account/account-interface' |
4 | import { VideoChannelInstance } from './video-channel-interface' | 5 | import { VideoChannelInstance } from './video-channel-interface' |
5 | 6 | ||
6 | export namespace VideoChannelShareMethods { | 7 | export namespace VideoChannelShareMethods { |
7 | export type LoadAccountsByShare = (videoChannelId: number) => Bluebird<AccountInstance[]> | 8 | export type LoadAccountsByShare = (videoChannelId: number, t: Transaction) => Bluebird<AccountInstance[]> |
8 | export type Load = (accountId: number, videoId: number) => Bluebird<VideoChannelShareInstance> | 9 | export type Load = (accountId: number, videoId: number, t: Transaction) => Bluebird<VideoChannelShareInstance> |
9 | } | 10 | } |
10 | 11 | ||
11 | export interface VideoChannelShareClass { | 12 | export interface VideoChannelShareClass { |
diff --git a/server/models/video/video-channel-share.ts b/server/models/video/video-channel-share.ts index e47c0dae7..2e9b658a3 100644 --- a/server/models/video/video-channel-share.ts +++ b/server/models/video/video-channel-share.ts | |||
@@ -52,7 +52,7 @@ function associate (models) { | |||
52 | }) | 52 | }) |
53 | } | 53 | } |
54 | 54 | ||
55 | load = function (accountId: number, videoChannelId: number) { | 55 | load = function (accountId: number, videoChannelId: number, t: Sequelize.Transaction) { |
56 | return VideoChannelShare.findOne({ | 56 | return VideoChannelShare.findOne({ |
57 | where: { | 57 | where: { |
58 | accountId, | 58 | accountId, |
@@ -61,11 +61,12 @@ load = function (accountId: number, videoChannelId: number) { | |||
61 | include: [ | 61 | include: [ |
62 | VideoChannelShare['sequelize'].models.Account, | 62 | VideoChannelShare['sequelize'].models.Account, |
63 | VideoChannelShare['sequelize'].models.VideoChannel | 63 | VideoChannelShare['sequelize'].models.VideoChannel |
64 | ] | 64 | ], |
65 | transaction: t | ||
65 | }) | 66 | }) |
66 | } | 67 | } |
67 | 68 | ||
68 | loadAccountsByShare = function (videoChannelId: number) { | 69 | loadAccountsByShare = function (videoChannelId: number, t: Sequelize.Transaction) { |
69 | const query = { | 70 | const query = { |
70 | where: { | 71 | where: { |
71 | videoChannelId | 72 | videoChannelId |
@@ -75,7 +76,8 @@ loadAccountsByShare = function (videoChannelId: number) { | |||
75 | model: VideoChannelShare['sequelize'].models.Account, | 76 | model: VideoChannelShare['sequelize'].models.Account, |
76 | required: true | 77 | required: true |
77 | } | 78 | } |
78 | ] | 79 | ], |
80 | transaction: t | ||
79 | } | 81 | } |
80 | 82 | ||
81 | return VideoChannelShare.findAll(query) | 83 | return VideoChannelShare.findAll(query) |
diff --git a/server/models/video/video-share-interface.ts b/server/models/video/video-share-interface.ts index ad23444b6..8ad10e095 100644 --- a/server/models/video/video-share-interface.ts +++ b/server/models/video/video-share-interface.ts | |||
@@ -1,11 +1,12 @@ | |||
1 | import * as Bluebird from 'bluebird' | 1 | import * as Bluebird from 'bluebird' |
2 | import * as Sequelize from 'sequelize' | 2 | import * as Sequelize from 'sequelize' |
3 | import { Transaction } from 'sequelize' | ||
3 | import { AccountInstance } from '../account/account-interface' | 4 | import { AccountInstance } from '../account/account-interface' |
4 | import { VideoInstance } from './video-interface' | 5 | import { VideoInstance } from './video-interface' |
5 | 6 | ||
6 | export namespace VideoShareMethods { | 7 | export namespace VideoShareMethods { |
7 | export type LoadAccountsByShare = (videoId: number) => Bluebird<AccountInstance[]> | 8 | export type LoadAccountsByShare = (videoId: number, t: Transaction) => Bluebird<AccountInstance[]> |
8 | export type Load = (accountId: number, videoId: number) => Bluebird<VideoShareInstance> | 9 | export type Load = (accountId: number, videoId: number, t: Transaction) => Bluebird<VideoShareInstance> |
9 | } | 10 | } |
10 | 11 | ||
11 | export interface VideoShareClass { | 12 | export interface VideoShareClass { |
diff --git a/server/models/video/video-share.ts b/server/models/video/video-share.ts index fe5d56d42..37e405fa9 100644 --- a/server/models/video/video-share.ts +++ b/server/models/video/video-share.ts | |||
@@ -52,7 +52,7 @@ function associate (models) { | |||
52 | }) | 52 | }) |
53 | } | 53 | } |
54 | 54 | ||
55 | load = function (accountId: number, videoId: number) { | 55 | load = function (accountId: number, videoId: number, t: Sequelize.Transaction) { |
56 | return VideoShare.findOne({ | 56 | return VideoShare.findOne({ |
57 | where: { | 57 | where: { |
58 | accountId, | 58 | accountId, |
@@ -60,11 +60,12 @@ load = function (accountId: number, videoId: number) { | |||
60 | }, | 60 | }, |
61 | include: [ | 61 | include: [ |
62 | VideoShare['sequelize'].models.Account | 62 | VideoShare['sequelize'].models.Account |
63 | ] | 63 | ], |
64 | transaction: t | ||
64 | }) | 65 | }) |
65 | } | 66 | } |
66 | 67 | ||
67 | loadAccountsByShare = function (videoId: number) { | 68 | loadAccountsByShare = function (videoId: number, t: Sequelize.Transaction) { |
68 | const query = { | 69 | const query = { |
69 | where: { | 70 | where: { |
70 | videoId | 71 | videoId |
@@ -74,7 +75,8 @@ loadAccountsByShare = function (videoId: number) { | |||
74 | model: VideoShare['sequelize'].models.Account, | 75 | model: VideoShare['sequelize'].models.Account, |
75 | required: true | 76 | required: true |
76 | } | 77 | } |
77 | ] | 78 | ], |
79 | transaction: t | ||
78 | } | 80 | } |
79 | 81 | ||
80 | return VideoShare.findAll(query) | 82 | return VideoShare.findAll(query) |