Table,
UpdatedAt
} from 'sequelize-typescript'
+import { CONFIG } from '@server/initializers/config'
import { MAccountActor } from '@server/types/models'
-import { AttributesOnly, pick } from '@shared/core-utils'
+import { pick } from '@shared/core-utils'
+import { AttributesOnly } from '@shared/typescript-utils'
import { ActivityPubActor } from '../../../shared/models/activitypub'
import { VideoChannel, VideoChannelSummary } from '../../../shared/models/videos'
import {
})
}
- static listByAccount (options: {
+ static listByAccountForAPI (options: {
accountId: number
start: number
count: number
})
}
+ static listAllByAccount (accountId: number) {
+ const query = {
+ limit: CONFIG.VIDEO_CHANNELS.MAX_PER_USER,
+ include: [
+ {
+ attributes: [],
+ model: AccountModel,
+ where: {
+ id: accountId
+ },
+ required: true
+ }
+ ]
+ }
+
+ return VideoChannelModel.findAll(query)
+ }
+
static loadAndPopulateAccount (id: number, transaction?: Transaction): Promise<MChannelBannerAccountDefault> {
return VideoChannelModel.unscoped()
.scope([ ScopeNames.WITH_ACTOR_BANNER, ScopeNames.WITH_ACCOUNT ])