aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video')
-rw-r--r--server/models/video/video-channel.ts24
1 files changed, 22 insertions, 2 deletions
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts
index 8ccb818b3..a151ad61c 100644
--- a/server/models/video/video-channel.ts
+++ b/server/models/video/video-channel.ts
@@ -26,7 +26,7 @@ import {
26 isVideoChannelDisplayNameValid, 26 isVideoChannelDisplayNameValid,
27 isVideoChannelSupportValid 27 isVideoChannelSupportValid
28} from '../../helpers/custom-validators/video-channels' 28} from '../../helpers/custom-validators/video-channels'
29import { CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers/constants' 29import { CONSTRAINTS_FIELDS, VIDEO_CHANNELS, WEBSERVER } from '../../initializers/constants'
30import { sendDeleteActor } from '../../lib/activitypub/send' 30import { sendDeleteActor } from '../../lib/activitypub/send'
31import { 31import {
32 MChannelActor, 32 MChannelActor,
@@ -527,7 +527,7 @@ ON "Account->Actor"."serverId" = "Account->Actor->Server"."id"`
527 }) 527 })
528 } 528 }
529 529
530 static listByAccount (options: { 530 static listByAccountForAPI (options: {
531 accountId: number 531 accountId: number
532 start: number 532 start: number
533 count: number 533 count: number
@@ -582,6 +582,26 @@ ON "Account->Actor"."serverId" = "Account->Actor->Server"."id"`
582 }) 582 })
583 } 583 }
584 584
585
586 static listAllByAccount (accountId: number) {
587 const query = {
588 limit: VIDEO_CHANNELS.MAX_PER_USER,
589 include: [
590 {
591 attributes: [],
592 model: AccountModel,
593 where: {
594 id: accountId
595 },
596 required: true
597 }
598 ]
599 }
600
601 return VideoChannelModel.findAll(query)
602 }
603
604
585 static loadAndPopulateAccount (id: number, transaction?: Transaction): Promise<MChannelBannerAccountDefault> { 605 static loadAndPopulateAccount (id: number, transaction?: Transaction): Promise<MChannelBannerAccountDefault> {
586 return VideoChannelModel.unscoped() 606 return VideoChannelModel.unscoped()
587 .scope([ ScopeNames.WITH_ACTOR_BANNER, ScopeNames.WITH_ACCOUNT ]) 607 .scope([ ScopeNames.WITH_ACTOR_BANNER, ScopeNames.WITH_ACCOUNT ])