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:
parent
d846d99c6c
commit
a056ca4813
19 changed files with 147 additions and 5 deletions
|
@ -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 = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue