1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 19:42:24 +02:00

Add max lives limit

This commit is contained in:
Chocobozzz 2020-10-28 15:24:40 +01:00 committed by Chocobozzz
parent d846d99c6c
commit a056ca4813
19 changed files with 147 additions and 5 deletions

View file

@ -1142,6 +1142,37 @@ export class VideoModel extends Model<VideoModel> {
return VideoModel.getAvailableForApi(queryOptions)
}
static countLocalLives () {
const options = {
where: {
remote: false,
isLive: true
}
}
return VideoModel.count(options)
}
static countLivesOfAccount (accountId: number) {
const options = {
where: {
remote: false,
isLive: true
},
include: [
{
required: true,
model: VideoChannelModel.unscoped(),
where: {
accountId
}
}
]
}
return VideoModel.count(options)
}
static load (id: number | string, t?: Transaction): Bluebird<MVideoThumbnail> {
const where = buildWhereIdOrUUID(id)
const options = {