PeerTube/server/models/video/video-channel-interface.ts

65 lines
3.1 KiB
TypeScript
Raw Normal View History

2017-10-24 12:41:09 -05:00
import * as Promise from 'bluebird'
2017-11-23 10:36:15 -06:00
import * as Sequelize from 'sequelize'
2017-10-24 12:41:09 -05:00
2017-11-09 10:51:58 -06:00
import { ResultList } from '../../../shared'
2017-11-23 10:36:15 -06:00
import { VideoChannelObject } from '../../../shared/models/activitypub/objects/video-channel-object'
2017-10-24 12:41:09 -05:00
import { VideoChannel as FormattedVideoChannel } from '../../../shared/models/videos/video-channel.model'
2017-11-09 10:51:58 -06:00
import { AccountInstance } from '../account/account-interface'
2017-11-23 10:36:15 -06:00
import { VideoInstance } from './video-interface'
import { VideoChannelShareInstance } from './video-channel-share-interface'
2017-10-24 12:41:09 -05:00
export namespace VideoChannelMethods {
export type ToFormattedJSON = (this: VideoChannelInstance) => FormattedVideoChannel
2017-11-09 10:51:58 -06:00
export type ToActivityPubObject = (this: VideoChannelInstance) => VideoChannelObject
2017-10-24 12:41:09 -05:00
export type IsOwned = (this: VideoChannelInstance) => boolean
2017-11-09 10:51:58 -06:00
export type CountByAccount = (accountId: number) => Promise<number>
2017-10-24 12:41:09 -05:00
export type ListForApi = (start: number, count: number, sort: string) => Promise< ResultList<VideoChannelInstance> >
2017-11-09 10:51:58 -06:00
export type LoadByIdAndAccount = (id: number, accountId: number) => Promise<VideoChannelInstance>
export type ListByAccount = (accountId: number) => Promise< ResultList<VideoChannelInstance> >
export type LoadAndPopulateAccount = (id: number) => Promise<VideoChannelInstance>
export type LoadByUUIDAndPopulateAccount = (uuid: string) => Promise<VideoChannelInstance>
2017-10-24 12:41:09 -05:00
export type LoadByUUID = (uuid: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance>
2017-11-15 04:00:25 -06:00
export type LoadByHostAndUUID = (uuid: string, serverHost: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance>
2017-11-09 10:51:58 -06:00
export type LoadAndPopulateAccountAndVideos = (id: number) => Promise<VideoChannelInstance>
2017-11-10 07:34:45 -06:00
export type LoadByUrl = (uuid: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance>
export type LoadByUUIDOrUrl = (uuid: string, url: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance>
2017-10-24 12:41:09 -05:00
}
export interface VideoChannelClass {
2017-11-09 10:51:58 -06:00
countByAccount: VideoChannelMethods.CountByAccount
2017-10-24 12:41:09 -05:00
listForApi: VideoChannelMethods.ListForApi
2017-11-09 10:51:58 -06:00
listByAccount: VideoChannelMethods.ListByAccount
loadByIdAndAccount: VideoChannelMethods.LoadByIdAndAccount
loadAndPopulateAccount: VideoChannelMethods.LoadAndPopulateAccount
loadByUUIDAndPopulateAccount: VideoChannelMethods.LoadByUUIDAndPopulateAccount
loadAndPopulateAccountAndVideos: VideoChannelMethods.LoadAndPopulateAccountAndVideos
2017-11-10 07:34:45 -06:00
loadByUrl: VideoChannelMethods.LoadByUrl
loadByUUIDOrUrl: VideoChannelMethods.LoadByUUIDOrUrl
2017-10-24 12:41:09 -05:00
}
export interface VideoChannelAttributes {
id?: number
uuid?: string
name: string
description: string
remote: boolean
2017-11-10 07:34:45 -06:00
url?: string
2017-10-24 12:41:09 -05:00
2017-11-09 10:51:58 -06:00
Account?: AccountInstance
2017-10-24 12:41:09 -05:00
Videos?: VideoInstance[]
VideoChannelShares?: VideoChannelShareInstance[]
2017-10-24 12:41:09 -05:00
}
export interface VideoChannelInstance extends VideoChannelClass, VideoChannelAttributes, Sequelize.Instance<VideoChannelAttributes> {
id: number
createdAt: Date
updatedAt: Date
isOwned: VideoChannelMethods.IsOwned
toFormattedJSON: VideoChannelMethods.ToFormattedJSON
2017-11-09 10:51:58 -06:00
toActivityPubObject: VideoChannelMethods.ToActivityPubObject
2017-10-24 12:41:09 -05:00
}
export interface VideoChannelModel extends VideoChannelClass, Sequelize.Model<VideoChannelInstance, VideoChannelAttributes> {}