diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-10-24 19:41:09 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-10-26 09:11:38 +0200 |
commit | 72c7248b6fdcdb2175e726ff51b42e7555f2bd84 (patch) | |
tree | 1bfdee99dbe2392cc997edba8e314e2a8a401c72 /server/models/video/video-channel-interface.ts | |
parent | 8113a93a0d9f31aa9e23702bbc31b8a76275ae22 (diff) | |
download | PeerTube-72c7248b6fdcdb2175e726ff51b42e7555f2bd84.tar.gz PeerTube-72c7248b6fdcdb2175e726ff51b42e7555f2bd84.tar.zst PeerTube-72c7248b6fdcdb2175e726ff51b42e7555f2bd84.zip |
Add video channels
Diffstat (limited to 'server/models/video/video-channel-interface.ts')
-rw-r--r-- | server/models/video/video-channel-interface.ts | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/server/models/video/video-channel-interface.ts b/server/models/video/video-channel-interface.ts new file mode 100644 index 000000000..b8d3e0f42 --- /dev/null +++ b/server/models/video/video-channel-interface.ts | |||
@@ -0,0 +1,64 @@ | |||
1 | import * as Sequelize from 'sequelize' | ||
2 | import * as Promise from 'bluebird' | ||
3 | |||
4 | import { ResultList, RemoteVideoChannelCreateData, RemoteVideoChannelUpdateData } 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 { AuthorInstance } from './author-interface' | ||
9 | import { VideoInstance } from './video-interface' | ||
10 | |||
11 | export namespace VideoChannelMethods { | ||
12 | export type ToFormattedJSON = (this: VideoChannelInstance) => FormattedVideoChannel | ||
13 | export type ToAddRemoteJSON = (this: VideoChannelInstance) => RemoteVideoChannelCreateData | ||
14 | export type ToUpdateRemoteJSON = (this: VideoChannelInstance) => RemoteVideoChannelUpdateData | ||
15 | export type IsOwned = (this: VideoChannelInstance) => boolean | ||
16 | |||
17 | export type CountByAuthor = (authorId: 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 LoadByIdAndAuthor = (id: number, authorId: number) => Promise<VideoChannelInstance> | ||
21 | export type ListByAuthor = (authorId: number) => Promise< ResultList<VideoChannelInstance> > | ||
22 | export type LoadAndPopulateAuthor = (id: number) => Promise<VideoChannelInstance> | ||
23 | export type LoadByUUIDAndPopulateAuthor = (uuid: string) => Promise<VideoChannelInstance> | ||
24 | export type LoadByUUID = (uuid: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance> | ||
25 | export type LoadByHostAndUUID = (uuid: string, podHost: string, t?: Sequelize.Transaction) => Promise<VideoChannelInstance> | ||
26 | export type LoadAndPopulateAuthorAndVideos = (id: number) => Promise<VideoChannelInstance> | ||
27 | } | ||
28 | |||
29 | export interface VideoChannelClass { | ||
30 | countByAuthor: VideoChannelMethods.CountByAuthor | ||
31 | listForApi: VideoChannelMethods.ListForApi | ||
32 | listByAuthor: VideoChannelMethods.ListByAuthor | ||
33 | listOwned: VideoChannelMethods.ListOwned | ||
34 | loadByIdAndAuthor: VideoChannelMethods.LoadByIdAndAuthor | ||
35 | loadByUUID: VideoChannelMethods.LoadByUUID | ||
36 | loadByHostAndUUID: VideoChannelMethods.LoadByHostAndUUID | ||
37 | loadAndPopulateAuthor: VideoChannelMethods.LoadAndPopulateAuthor | ||
38 | loadByUUIDAndPopulateAuthor: VideoChannelMethods.LoadByUUIDAndPopulateAuthor | ||
39 | loadAndPopulateAuthorAndVideos: VideoChannelMethods.LoadAndPopulateAuthorAndVideos | ||
40 | } | ||
41 | |||
42 | export interface VideoChannelAttributes { | ||
43 | id?: number | ||
44 | uuid?: string | ||
45 | name: string | ||
46 | description: string | ||
47 | remote: boolean | ||
48 | |||
49 | Author?: AuthorInstance | ||
50 | Videos?: VideoInstance[] | ||
51 | } | ||
52 | |||
53 | export interface VideoChannelInstance extends VideoChannelClass, VideoChannelAttributes, Sequelize.Instance<VideoChannelAttributes> { | ||
54 | id: number | ||
55 | createdAt: Date | ||
56 | updatedAt: Date | ||
57 | |||
58 | isOwned: VideoChannelMethods.IsOwned | ||
59 | toFormattedJSON: VideoChannelMethods.ToFormattedJSON | ||
60 | toAddRemoteJSON: VideoChannelMethods.ToAddRemoteJSON | ||
61 | toUpdateRemoteJSON: VideoChannelMethods.ToUpdateRemoteJSON | ||
62 | } | ||
63 | |||
64 | export interface VideoChannelModel extends VideoChannelClass, Sequelize.Model<VideoChannelInstance, VideoChannelAttributes> {} | ||