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

63 lines
3.0 KiB
TypeScript
Raw Normal View History

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