diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-05-22 20:58:25 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-05-25 17:32:16 +0200 |
commit | e02643f32e4c97ca307f8fc5b69be79c40d70a3b (patch) | |
tree | b7f6269913cd5a0e4f26a9461a043deb0c168be0 /server/models/video-interface.ts | |
parent | 65fcc3119c334b75dd13bcfdebf186afdc580a8f (diff) | |
download | PeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.tar.gz PeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.tar.zst PeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.zip |
Type models
Diffstat (limited to 'server/models/video-interface.ts')
-rw-r--r-- | server/models/video-interface.ts | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/server/models/video-interface.ts b/server/models/video-interface.ts new file mode 100644 index 000000000..b8dbeea35 --- /dev/null +++ b/server/models/video-interface.ts | |||
@@ -0,0 +1,75 @@ | |||
1 | import * as Sequelize from 'sequelize' | ||
2 | |||
3 | export namespace VideoMethods { | ||
4 | export type GenerateMagnetUri = () => void | ||
5 | export type GetVideoFilename = () => void | ||
6 | export type GetThumbnailName = () => void | ||
7 | export type GetPreviewName = () => void | ||
8 | export type GetTorrentName = () => void | ||
9 | export type IsOwned = () => void | ||
10 | export type ToFormatedJSON = () => void | ||
11 | export type ToAddRemoteJSON = (callback) => void | ||
12 | export type ToUpdateRemoteJSON = (callback) => void | ||
13 | export type TranscodeVideofile = (callback) => void | ||
14 | |||
15 | export type GenerateThumbnailFromData = (video, thumbnailData, callback) => void | ||
16 | export type GetDurationFromFile = (videoPath, callback) => void | ||
17 | export type List = (callback) => void | ||
18 | export type ListForApi = (start, count, sort, callback) => void | ||
19 | export type LoadByHostAndRemoteId = (fromHost, remoteId, callback) => void | ||
20 | export type ListOwnedAndPopulateAuthorAndTags = (callback) => void | ||
21 | export type ListOwnedByAuthor = (author, callback) => void | ||
22 | export type Load = (id, callback) => void | ||
23 | export type LoadAndPopulateAuthor = (id, callback) => void | ||
24 | export type LoadAndPopulateAuthorAndPodAndTags = (id, callback) => void | ||
25 | export type SearchAndPopulateAuthorAndPodAndTags = (value, field, start, count, sort, callback) => void | ||
26 | } | ||
27 | |||
28 | export interface VideoClass { | ||
29 | generateMagnetUri: VideoMethods.GenerateMagnetUri | ||
30 | getVideoFilename: VideoMethods.GetVideoFilename | ||
31 | getThumbnailName: VideoMethods.GetThumbnailName | ||
32 | getPreviewName: VideoMethods.GetPreviewName | ||
33 | getTorrentName: VideoMethods.GetTorrentName | ||
34 | isOwned: VideoMethods.IsOwned | ||
35 | toFormatedJSON: VideoMethods.ToFormatedJSON | ||
36 | toAddRemoteJSON: VideoMethods.ToAddRemoteJSON | ||
37 | toUpdateRemoteJSON: VideoMethods.ToUpdateRemoteJSON | ||
38 | transcodeVideofile: VideoMethods.TranscodeVideofile | ||
39 | |||
40 | generateThumbnailFromData: VideoMethods.GenerateThumbnailFromData | ||
41 | getDurationFromFile: VideoMethods.GetDurationFromFile | ||
42 | list: VideoMethods.List | ||
43 | listForApi: VideoMethods.ListForApi | ||
44 | loadByHostAndRemoteId: VideoMethods.LoadByHostAndRemoteId | ||
45 | listOwnedAndPopulateAuthorAndTags: VideoMethods.ListOwnedAndPopulateAuthorAndTags | ||
46 | listOwnedByAuthor: VideoMethods.ListOwnedByAuthor | ||
47 | load: VideoMethods.Load | ||
48 | loadAndPopulateAuthor: VideoMethods.LoadAndPopulateAuthor | ||
49 | loadAndPopulateAuthorAndPodAndTags: VideoMethods.LoadAndPopulateAuthorAndPodAndTags | ||
50 | searchAndPopulateAuthorAndPodAndTags: VideoMethods.SearchAndPopulateAuthorAndPodAndTags | ||
51 | } | ||
52 | |||
53 | export interface VideoAttributes { | ||
54 | name: string | ||
55 | extname: string | ||
56 | remoteId: string | ||
57 | category: number | ||
58 | licence: number | ||
59 | language: number | ||
60 | nsfw: boolean | ||
61 | description: string | ||
62 | infoHash?: string | ||
63 | duration: number | ||
64 | views?: number | ||
65 | likes?: number | ||
66 | dislikes?: number | ||
67 | } | ||
68 | |||
69 | export interface VideoInstance extends VideoClass, VideoAttributes, Sequelize.Instance<VideoAttributes> { | ||
70 | id: string | ||
71 | createdAt: Date | ||
72 | updatedAt: Date | ||
73 | } | ||
74 | |||
75 | export interface VideoModel extends VideoClass, Sequelize.Model<VideoInstance, VideoAttributes> {} | ||