diff options
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video.ts | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 27e605be6..924f12a5e 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -1209,18 +1209,21 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> { | |||
1209 | return VideoModel.getAvailableForApi(queryOptions) | 1209 | return VideoModel.getAvailableForApi(queryOptions) |
1210 | } | 1210 | } |
1211 | 1211 | ||
1212 | static countLocalLives () { | 1212 | static countLives (options: { |
1213 | const options = { | 1213 | remote: boolean |
1214 | mode: 'published' | 'not-ended' | ||
1215 | }) { | ||
1216 | const query = { | ||
1214 | where: { | 1217 | where: { |
1215 | remote: false, | 1218 | remote: options.remote, |
1216 | isLive: true, | 1219 | isLive: true, |
1217 | state: { | 1220 | state: options.mode === 'not-ended' |
1218 | [Op.ne]: VideoState.LIVE_ENDED | 1221 | ? { [Op.ne]: VideoState.LIVE_ENDED } |
1219 | } | 1222 | : { [Op.eq]: VideoState.PUBLISHED } |
1220 | } | 1223 | } |
1221 | } | 1224 | } |
1222 | 1225 | ||
1223 | return VideoModel.count(options) | 1226 | return VideoModel.count(query) |
1224 | } | 1227 | } |
1225 | 1228 | ||
1226 | static countVideosUploadedByUserSince (userId: number, since: Date) { | 1229 | static countVideosUploadedByUserSince (userId: number, since: Date) { |