aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/request/request-video-event-interface.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-06-16 09:45:46 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-06-16 09:45:46 +0200
commit74889a71fe687dda74f2a687653122327807af36 (patch)
treee938e8b6401b74fbec80513a877d9967f2c0dbcd /server/models/request/request-video-event-interface.ts
parent15a302943d84bc0978b84fe33110c4daa451d311 (diff)
downloadPeerTube-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.ts48
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 @@
1import * as Sequelize from 'sequelize'
2
3import { VideoInstance } from '../video'
4import { PodInstance } from '../pod'
5
6export type RequestsVideoEventGrouped = {
7 [ podId: number ]: {
8 id: number
9 type: string
10 count: number
11 video: VideoInstance
12 pod: PodInstance
13 }[]
14}
15
16export 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
30export interface RequestVideoEventClass {
31 countTotalRequests: RequestVideoEventMethods.CountTotalRequests
32 listWithLimitAndRandom: RequestVideoEventMethods.ListWithLimitAndRandom
33 removeByRequestIdsAndPod: RequestVideoEventMethods.RemoveByRequestIdsAndPod
34 removeAll: RequestVideoEventMethods.RemoveAll
35}
36
37export interface RequestVideoEventAttributes {
38 type: string
39 count: number
40}
41
42export interface RequestVideoEventInstance extends RequestVideoEventClass, RequestVideoEventAttributes, Sequelize.Instance<RequestVideoEventAttributes> {
43 id: number
44
45 Video: VideoInstance
46}
47
48export interface RequestVideoEventModel extends RequestVideoEventClass, Sequelize.Model<RequestVideoEventInstance, RequestVideoEventAttributes> {}