]>
Commit | Line | Data |
---|---|---|
e02643f3 C |
1 | import * as Sequelize from 'sequelize' |
2 | ||
74889a71 C |
3 | import { VideoInstance } from '../video' |
4 | import { PodInstance } from '../pod' | |
69818c93 | 5 | |
ee9e7b61 C |
6 | import { RequestVideoEventType } from '../../../shared/models/request-scheduler.model' |
7 | ||
69818c93 C |
8 | export type RequestsVideoEventGrouped = { |
9 | [ podId: number ]: { | |
10 | id: number | |
ee9e7b61 | 11 | type: RequestVideoEventType |
69818c93 C |
12 | count: number |
13 | video: VideoInstance | |
14 | pod: PodInstance | |
15 | }[] | |
16 | } | |
17 | ||
e02643f3 | 18 | export namespace RequestVideoEventMethods { |
69818c93 C |
19 | export type CountTotalRequestsCallback = (err: Error, total: number) => void |
20 | export type CountTotalRequests = (callback: CountTotalRequestsCallback) => void | |
21 | ||
22 | export type ListWithLimitAndRandomCallback = (err: Error, requestsGrouped?: RequestsVideoEventGrouped) => void | |
23 | export type ListWithLimitAndRandom = (limitPods: number, limitRequestsPerPod: number, callback: ListWithLimitAndRandomCallback) => void | |
24 | ||
25 | export type RemoveByRequestIdsAndPodCallback = () => void | |
26 | export type RemoveByRequestIdsAndPod = (ids: number[], podId: number, callback: RemoveByRequestIdsAndPodCallback) => void | |
27 | ||
28 | export type RemoveAllCallback = () => void | |
29 | export type RemoveAll = (callback: RemoveAllCallback) => void | |
e02643f3 C |
30 | } |
31 | ||
32 | export interface RequestVideoEventClass { | |
33 | countTotalRequests: RequestVideoEventMethods.CountTotalRequests | |
34 | listWithLimitAndRandom: RequestVideoEventMethods.ListWithLimitAndRandom | |
35 | removeByRequestIdsAndPod: RequestVideoEventMethods.RemoveByRequestIdsAndPod | |
36 | removeAll: RequestVideoEventMethods.RemoveAll | |
37 | } | |
38 | ||
39 | export interface RequestVideoEventAttributes { | |
ee9e7b61 | 40 | type: RequestVideoEventType |
e02643f3 C |
41 | count: number |
42 | } | |
43 | ||
69818c93 | 44 | export interface RequestVideoEventInstance extends RequestVideoEventClass, RequestVideoEventAttributes, Sequelize.Instance<RequestVideoEventAttributes> { |
e02643f3 | 45 | id: number |
69818c93 C |
46 | |
47 | Video: VideoInstance | |
e02643f3 C |
48 | } |
49 | ||
50 | export interface RequestVideoEventModel extends RequestVideoEventClass, Sequelize.Model<RequestVideoEventInstance, RequestVideoEventAttributes> {} |