diff options
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video.ts | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 78fec5585..d094f19b0 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -1142,6 +1142,37 @@ export class VideoModel extends Model<VideoModel> { | |||
1142 | return VideoModel.getAvailableForApi(queryOptions) | 1142 | return VideoModel.getAvailableForApi(queryOptions) |
1143 | } | 1143 | } |
1144 | 1144 | ||
1145 | static countLocalLives () { | ||
1146 | const options = { | ||
1147 | where: { | ||
1148 | remote: false, | ||
1149 | isLive: true | ||
1150 | } | ||
1151 | } | ||
1152 | |||
1153 | return VideoModel.count(options) | ||
1154 | } | ||
1155 | |||
1156 | static countLivesOfAccount (accountId: number) { | ||
1157 | const options = { | ||
1158 | where: { | ||
1159 | remote: false, | ||
1160 | isLive: true | ||
1161 | }, | ||
1162 | include: [ | ||
1163 | { | ||
1164 | required: true, | ||
1165 | model: VideoChannelModel.unscoped(), | ||
1166 | where: { | ||
1167 | accountId | ||
1168 | } | ||
1169 | } | ||
1170 | ] | ||
1171 | } | ||
1172 | |||
1173 | return VideoModel.count(options) | ||
1174 | } | ||
1175 | |||
1145 | static load (id: number | string, t?: Transaction): Bluebird<MVideoThumbnail> { | 1176 | static load (id: number | string, t?: Transaction): Bluebird<MVideoThumbnail> { |
1146 | const where = buildWhereIdOrUUID(id) | 1177 | const where = buildWhereIdOrUUID(id) |
1147 | const options = { | 1178 | const options = { |