aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/request/request-video-qadu-interface.ts
blob: 625b063dcc60709a98deb69de738a83f30f1fc28 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import * as Sequelize from 'sequelize'

import { VideoInstance } from '../video'
import { PodInstance } from '../pod'

export type RequestsVideoQaduGrouped = {
  [ podId: number ]: {
    request: RequestVideoQaduInstance
    video: VideoInstance
    pod: PodInstance
  }
}

export namespace RequestVideoQaduMethods {
  export type CountTotalRequestsCallback = (err: Error, total: number) => void
  export type CountTotalRequests = (callback: CountTotalRequestsCallback) => void

  export type ListWithLimitAndRandomCallback = (err: Error, requestsGrouped?: RequestsVideoQaduGrouped) => void
  export type ListWithLimitAndRandom = (limitPods: number, limitRequestsPerPod: number, callback: ListWithLimitAndRandomCallback) => void

  export type RemoveByRequestIdsAndPodCallback = () => void
  export type RemoveByRequestIdsAndPod = (ids: number[], podId: number, callback: RemoveByRequestIdsAndPodCallback) => void

  export type RemoveAllCallback = () => void
  export type RemoveAll = (callback: RemoveAllCallback) => void
}

export interface RequestVideoQaduClass {
  countTotalRequests: RequestVideoQaduMethods.CountTotalRequests
  listWithLimitAndRandom: RequestVideoQaduMethods.ListWithLimitAndRandom
  removeByRequestIdsAndPod: RequestVideoQaduMethods.RemoveByRequestIdsAndPod
  removeAll: RequestVideoQaduMethods.RemoveAll
}

export interface RequestVideoQaduAttributes {
  type: string
}

export interface RequestVideoQaduInstance extends RequestVideoQaduClass, RequestVideoQaduAttributes, Sequelize.Instance<RequestVideoQaduAttributes> {
  id: number

  Pod: PodInstance
  Video: VideoInstance
}

export interface RequestVideoQaduModel extends RequestVideoQaduClass, Sequelize.Model<RequestVideoQaduInstance, RequestVideoQaduAttributes> {}