]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/models/video/video-channel-interface.ts
Rename Pod -> Server
[github/Chocobozzz/PeerTube.git] / server / models / video / video-channel-interface.ts
CommitLineData
72c7248b
C
1import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird'
3
e4f97bab 4import { ResultList } from '../../../shared'
72c7248b
C
5
6// Don't use barrel, import just what we need
7import { VideoChannel as FormattedVideoChannel } from '../../../shared/models/videos/video-channel.model'
72c7248b 8import { VideoInstance } from './video-interface'
e4f97bab
C
9import { AccountInstance } from '../account/account-interface'
10import { VideoChannelObject } from '../../../shared/models/activitypub/objects/video-channel-object'
72c7248b
C
11
12export namespace VideoChannelMethods {
13 export type ToFormattedJSON = (this: VideoChannelInstance) => FormattedVideoChannel
e4f97bab 14 export type ToActivityPubObject = (this: VideoChannelInstance) => VideoChannelObject
72c7248b
C
15 export type IsOwned = (this: VideoChannelInstance) => boolean
16
e4f97bab 17 export type CountByAccount = (accountId: number) => Promise<number>
72c7248b
C
18 export type ListOwned = () => Promise<VideoChannelInstance[]>
19 export type ListForApi = (start: number, count: number, sort: string) => Promise< ResultList<VideoChannelInstance> >
e4f97bab
C
20 export type LoadByIdAndAccount = (id: number, accountId: number) => Promise<VideoChannelInstance>
21 export type ListByAccount = (accountId: number) => Promise< ResultList<VideoChannelInstance> >
22 export type LoadAndPopulateAccount = (id: number) => Promise<VideoChannelInstance>
23 export type LoadByUUIDAndPopulateAccount = (uuid: string) => Promise<VideoChannelInstance>
72c7248b 24 export type LoadByUUID = (uuid: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance>
60862425 25 export type LoadByHostAndUUID = (uuid: string, serverHost: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance>
e4f97bab 26 export type LoadAndPopulateAccountAndVideos = (id: number) => Promise<VideoChannelInstance>
0d0e8dd0
C
27 export type LoadByUrl = (uuid: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance>
28 export type LoadByUUIDOrUrl = (uuid: string, url: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance>
72c7248b
C
29}
30
31export interface VideoChannelClass {
e4f97bab 32 countByAccount: VideoChannelMethods.CountByAccount
72c7248b 33 listForApi: VideoChannelMethods.ListForApi
e4f97bab 34 listByAccount: VideoChannelMethods.ListByAccount
72c7248b 35 listOwned: VideoChannelMethods.ListOwned
e4f97bab 36 loadByIdAndAccount: VideoChannelMethods.LoadByIdAndAccount
72c7248b
C
37 loadByUUID: VideoChannelMethods.LoadByUUID
38 loadByHostAndUUID: VideoChannelMethods.LoadByHostAndUUID
e4f97bab
C
39 loadAndPopulateAccount: VideoChannelMethods.LoadAndPopulateAccount
40 loadByUUIDAndPopulateAccount: VideoChannelMethods.LoadByUUIDAndPopulateAccount
41 loadAndPopulateAccountAndVideos: VideoChannelMethods.LoadAndPopulateAccountAndVideos
0d0e8dd0
C
42 loadByUrl: VideoChannelMethods.LoadByUrl
43 loadByUUIDOrUrl: VideoChannelMethods.LoadByUUIDOrUrl
72c7248b
C
44}
45
46export interface VideoChannelAttributes {
47 id?: number
48 uuid?: string
49 name: string
50 description: string
51 remote: boolean
0d0e8dd0 52 url?: string
72c7248b 53
e4f97bab 54 Account?: AccountInstance
72c7248b
C
55 Videos?: VideoInstance[]
56}
57
58export interface VideoChannelInstance extends VideoChannelClass, VideoChannelAttributes, Sequelize.Instance<VideoChannelAttributes> {
59 id: number
60 createdAt: Date
61 updatedAt: Date
62
63 isOwned: VideoChannelMethods.IsOwned
64 toFormattedJSON: VideoChannelMethods.ToFormattedJSON
e4f97bab 65 toActivityPubObject: VideoChannelMethods.ToActivityPubObject
72c7248b
C
66}
67
68export interface VideoChannelModel extends VideoChannelClass, Sequelize.Model<VideoChannelInstance, VideoChannelAttributes> {}