]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/models/request-video-event-interface.ts
Type functions
[github/Chocobozzz/PeerTube.git] / server / models / request-video-event-interface.ts
1 import * as Sequelize from 'sequelize'
2
3 import { VideoInstance } from './video-interface'
4 import { PodInstance } from './pod-interface'
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> {}