]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/models/video/video-channel-interface.ts
First step upload with new design
[github/Chocobozzz/PeerTube.git] / server / models / video / video-channel-interface.ts
1 import * as Promise from 'bluebird'
2 import * as Sequelize from 'sequelize'
3
4 import { ResultList } from '../../../shared'
5 import { VideoChannelObject } from '../../../shared/models/activitypub/objects/video-channel-object'
6 import { VideoChannel as FormattedVideoChannel } from '../../../shared/models/videos/video-channel.model'
7 import { AccountInstance } from '../account/account-interface'
8 import { VideoInstance } from './video-interface'
9 import { VideoChannelShareInstance } from './video-channel-share-interface'
10
11 export namespace VideoChannelMethods {
12 export type ToFormattedJSON = (this: VideoChannelInstance) => FormattedVideoChannel
13 export type ToActivityPubObject = (this: VideoChannelInstance) => VideoChannelObject
14 export type IsOwned = (this: VideoChannelInstance) => boolean
15
16 export type CountByAccount = (accountId: number) => Promise<number>
17 export type ListForApi = (start: number, count: number, sort: string) => Promise< ResultList<VideoChannelInstance> >
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>
22 export type LoadByUUID = (uuid: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance>
23 export type LoadByHostAndUUID = (uuid: string, serverHost: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance>
24 export type LoadAndPopulateAccountAndVideos = (id: number) => Promise<VideoChannelInstance>
25 export type LoadByUrl = (uuid: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance>
26 export type LoadByUUIDOrUrl = (uuid: string, url: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance>
27 }
28
29 export interface VideoChannelClass {
30 countByAccount: VideoChannelMethods.CountByAccount
31 listForApi: VideoChannelMethods.ListForApi
32 listByAccount: VideoChannelMethods.ListByAccount
33 loadByIdAndAccount: VideoChannelMethods.LoadByIdAndAccount
34 loadAndPopulateAccount: VideoChannelMethods.LoadAndPopulateAccount
35 loadByUUIDAndPopulateAccount: VideoChannelMethods.LoadByUUIDAndPopulateAccount
36 loadAndPopulateAccountAndVideos: VideoChannelMethods.LoadAndPopulateAccountAndVideos
37 loadByUrl: VideoChannelMethods.LoadByUrl
38 loadByUUIDOrUrl: VideoChannelMethods.LoadByUUIDOrUrl
39 }
40
41 export interface VideoChannelAttributes {
42 id?: number
43 uuid?: string
44 name: string
45 description: string
46 remote: boolean
47 url?: string
48
49 Account?: AccountInstance
50 Videos?: VideoInstance[]
51 VideoChannelShares?: VideoChannelShareInstance[]
52 }
53
54 export 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
61 toActivityPubObject: VideoChannelMethods.ToActivityPubObject
62 }
63
64 export interface VideoChannelModel extends VideoChannelClass, Sequelize.Model<VideoChannelInstance, VideoChannelAttributes> {}