2017-10-24 12:41:09 -05:00
|
|
|
import * as Sequelize from 'sequelize'
|
|
|
|
import * as Promise from 'bluebird'
|
|
|
|
|
2017-11-09 10:51:58 -06:00
|
|
|
import { ResultList } from '../../../shared'
|
2017-10-24 12:41:09 -05:00
|
|
|
|
|
|
|
// Don't use barrel, import just what we need
|
|
|
|
import { VideoChannel as FormattedVideoChannel } from '../../../shared/models/videos/video-channel.model'
|
|
|
|
import { VideoInstance } from './video-interface'
|
2017-11-09 10:51:58 -06:00
|
|
|
import { AccountInstance } from '../account/account-interface'
|
|
|
|
import { VideoChannelObject } from '../../../shared/models/activitypub/objects/video-channel-object'
|
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 ListOwned = () => Promise<VideoChannelInstance[]>
|
|
|
|
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>
|
|
|
|
export type LoadByHostAndUUID = (uuid: string, podHost: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance>
|
2017-11-09 10:51:58 -06:00
|
|
|
export type LoadAndPopulateAccountAndVideos = (id: number) => 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
|
2017-10-24 12:41:09 -05:00
|
|
|
listOwned: VideoChannelMethods.ListOwned
|
2017-11-09 10:51:58 -06:00
|
|
|
loadByIdAndAccount: VideoChannelMethods.LoadByIdAndAccount
|
2017-10-24 12:41:09 -05:00
|
|
|
loadByUUID: VideoChannelMethods.LoadByUUID
|
|
|
|
loadByHostAndUUID: VideoChannelMethods.LoadByHostAndUUID
|
2017-11-09 10:51:58 -06:00
|
|
|
loadAndPopulateAccount: VideoChannelMethods.LoadAndPopulateAccount
|
|
|
|
loadByUUIDAndPopulateAccount: VideoChannelMethods.LoadByUUIDAndPopulateAccount
|
|
|
|
loadAndPopulateAccountAndVideos: VideoChannelMethods.LoadAndPopulateAccountAndVideos
|
2017-10-24 12:41:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface VideoChannelAttributes {
|
|
|
|
id?: number
|
|
|
|
uuid?: string
|
|
|
|
name: string
|
|
|
|
description: string
|
|
|
|
remote: boolean
|
2017-11-09 10:51:58 -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[]
|
|
|
|
}
|
|
|
|
|
|
|
|
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> {}
|