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