aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/request/request-video-event-interface.ts
diff options
context:
space:
mode:
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> {}