]>
Commit | Line | Data |
---|---|---|
1 | import * as Sequelize from 'sequelize' | |
2 | import * as Promise from 'bluebird' | |
3 | ||
4 | import { ResultList } from '../../../shared' | |
5 | ||
6 | // Don't use barrel, import just what we need | |
7 | import { VideoChannel as FormattedVideoChannel } from '../../../shared/models/videos/video-channel.model' | |
8 | import { VideoInstance } from './video-interface' | |
9 | import { AccountInstance } from '../account/account-interface' | |
10 | import { VideoChannelObject } from '../../../shared/models/activitypub/objects/video-channel-object' | |
11 | ||
12 | export namespace VideoChannelMethods { | |
13 | export type ToFormattedJSON = (this: VideoChannelInstance) => FormattedVideoChannel | |
14 | export type ToActivityPubObject = (this: VideoChannelInstance) => VideoChannelObject | |
15 | export type IsOwned = (this: VideoChannelInstance) => boolean | |
16 | ||
17 | export type CountByAccount = (accountId: number) => Promise<number> | |
18 | export type ListOwned = () => Promise<VideoChannelInstance[]> | |
19 | export type ListForApi = (start: number, count: number, sort: string) => Promise< ResultList<VideoChannelInstance> > | |
20 | export type LoadByIdAndAccount = (id: number, accountId: number) => Promise<VideoChannelInstance> | |
21 | export type ListByAccount = (accountId: number) => Promise< ResultList<VideoChannelInstance> > | |
22 | export type LoadAndPopulateAccount = (id: number) => Promise<VideoChannelInstance> | |
23 | export type LoadByUUIDAndPopulateAccount = (uuid: string) => Promise<VideoChannelInstance> | |
24 | export type LoadByUUID = (uuid: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance> | |
25 | export type LoadByHostAndUUID = (uuid: string, serverHost: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance> | |
26 | export type LoadAndPopulateAccountAndVideos = (id: number) => Promise<VideoChannelInstance> | |
27 | export type LoadByUrl = (uuid: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance> | |
28 | export type LoadByUUIDOrUrl = (uuid: string, url: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance> | |
29 | } | |
30 | ||
31 | export interface VideoChannelClass { | |
32 | countByAccount: VideoChannelMethods.CountByAccount | |
33 | listForApi: VideoChannelMethods.ListForApi | |
34 | listByAccount: VideoChannelMethods.ListByAccount | |
35 | listOwned: VideoChannelMethods.ListOwned | |
36 | loadByIdAndAccount: VideoChannelMethods.LoadByIdAndAccount | |
37 | loadByUUID: VideoChannelMethods.LoadByUUID | |
38 | loadByHostAndUUID: VideoChannelMethods.LoadByHostAndUUID | |
39 | loadAndPopulateAccount: VideoChannelMethods.LoadAndPopulateAccount | |
40 | loadByUUIDAndPopulateAccount: VideoChannelMethods.LoadByUUIDAndPopulateAccount | |
41 | loadAndPopulateAccountAndVideos: VideoChannelMethods.LoadAndPopulateAccountAndVideos | |
42 | loadByUrl: VideoChannelMethods.LoadByUrl | |
43 | loadByUUIDOrUrl: VideoChannelMethods.LoadByUUIDOrUrl | |
44 | } | |
45 | ||
46 | export interface VideoChannelAttributes { | |
47 | id?: number | |
48 | uuid?: string | |
49 | name: string | |
50 | description: string | |
51 | remote: boolean | |
52 | url?: string | |
53 | ||
54 | Account?: AccountInstance | |
55 | Videos?: VideoInstance[] | |
56 | } | |
57 | ||
58 | export interface VideoChannelInstance extends VideoChannelClass, VideoChannelAttributes, Sequelize.Instance<VideoChannelAttributes> { | |
59 | id: number | |
60 | createdAt: Date | |
61 | updatedAt: Date | |
62 | ||
63 | isOwned: VideoChannelMethods.IsOwned | |
64 | toFormattedJSON: VideoChannelMethods.ToFormattedJSON | |
65 | toActivityPubObject: VideoChannelMethods.ToActivityPubObject | |
66 | } | |
67 | ||
68 | export interface VideoChannelModel extends VideoChannelClass, Sequelize.Model<VideoChannelInstance, VideoChannelAttributes> {} |