diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-06-16 09:45:46 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-06-16 09:45:46 +0200 |
commit | 74889a71fe687dda74f2a687653122327807af36 (patch) | |
tree | e938e8b6401b74fbec80513a877d9967f2c0dbcd /server/models/request/request-video-event-interface.ts | |
parent | 15a302943d84bc0978b84fe33110c4daa451d311 (diff) | |
download | PeerTube-74889a71fe687dda74f2a687653122327807af36.tar.gz PeerTube-74889a71fe687dda74f2a687653122327807af36.tar.zst PeerTube-74889a71fe687dda74f2a687653122327807af36.zip |
Reorganize model files
Diffstat (limited to 'server/models/request/request-video-event-interface.ts')
-rw-r--r-- | server/models/request/request-video-event-interface.ts | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/server/models/request/request-video-event-interface.ts b/server/models/request/request-video-event-interface.ts new file mode 100644 index 000000000..219d8edc0 --- /dev/null +++ b/server/models/request/request-video-event-interface.ts | |||
@@ -0,0 +1,48 @@ | |||
1 | import * as Sequelize from 'sequelize' | ||
2 | |||
3 | import { VideoInstance } from '../video' | ||
4 | import { PodInstance } from '../pod' | ||
5 | |||
6 | export type RequestsVideoEventGrouped = { | ||
7 | [ podId: number ]: { | ||
8 | id: number | ||
9 | type: string | ||
10 | count: number | ||
11 | video: VideoInstance | ||
12 | pod: PodInstance | ||
13 | }[] | ||
14 | } | ||
15 | |||
16 | export namespace RequestVideoEventMethods { | ||
17 | export type CountTotalRequestsCallback = (err: Error, total: number) => void | ||
18 | export type CountTotalRequests = (callback: CountTotalRequestsCallback) => void | ||
19 | |||
20 | export type ListWithLimitAndRandomCallback = (err: Error, requestsGrouped?: RequestsVideoEventGrouped) => void | ||
21 | export type ListWithLimitAndRandom = (limitPods: number, limitRequestsPerPod: number, callback: ListWithLimitAndRandomCallback) => void | ||
22 | |||
23 | export type RemoveByRequestIdsAndPodCallback = () => void | ||
24 | export type RemoveByRequestIdsAndPod = (ids: number[], podId: number, callback: RemoveByRequestIdsAndPodCallback) => void | ||
25 | |||
26 | export type RemoveAllCallback = () => void | ||
27 | export type RemoveAll = (callback: RemoveAllCallback) => void | ||
28 | } | ||
29 | |||
30 | export interface RequestVideoEventClass { | ||
31 | countTotalRequests: RequestVideoEventMethods.CountTotalRequests | ||
32 | listWithLimitAndRandom: RequestVideoEventMethods.ListWithLimitAndRandom | ||
33 | removeByRequestIdsAndPod: RequestVideoEventMethods.RemoveByRequestIdsAndPod | ||
34 | removeAll: RequestVideoEventMethods.RemoveAll | ||
35 | } | ||
36 | |||
37 | export interface RequestVideoEventAttributes { | ||
38 | type: string | ||
39 | count: number | ||
40 | } | ||
41 | |||
42 | export interface RequestVideoEventInstance extends RequestVideoEventClass, RequestVideoEventAttributes, Sequelize.Instance<RequestVideoEventAttributes> { | ||
43 | id: number | ||
44 | |||
45 | Video: VideoInstance | ||
46 | } | ||
47 | |||
48 | export interface RequestVideoEventModel extends RequestVideoEventClass, Sequelize.Model<RequestVideoEventInstance, RequestVideoEventAttributes> {} | ||