X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Frequest-video-event-interface.ts;h=ad576a2b1cef869526bccc92f214c02966abe72f;hb=69818c9394366b954b6ba3bd697bd9d2b09f2a16;hp=a31c7108f1e6246da7a7be2b5149a69130031a23;hpb=e02643f32e4c97ca307f8fc5b69be79c40d70a3b;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/request-video-event-interface.ts b/server/models/request-video-event-interface.ts index a31c7108f..ad576a2b1 100644 --- a/server/models/request-video-event-interface.ts +++ b/server/models/request-video-event-interface.ts @@ -1,10 +1,30 @@ import * as Sequelize from 'sequelize' +import { VideoInstance } from './video-interface' +import { PodInstance } from './pod-interface' + +export type RequestsVideoEventGrouped = { + [ podId: number ]: { + id: number + type: string + count: number + video: VideoInstance + pod: PodInstance + }[] +} + export namespace RequestVideoEventMethods { - export type CountTotalRequests = (callback) => void - export type ListWithLimitAndRandom = (limitPods, limitRequestsPerPod, callback) => void - export type RemoveByRequestIdsAndPod = (ids, podId, callback) => void - export type RemoveAll = (callback) => void + export type CountTotalRequestsCallback = (err: Error, total: number) => void + export type CountTotalRequests = (callback: CountTotalRequestsCallback) => void + + export type ListWithLimitAndRandomCallback = (err: Error, requestsGrouped?: RequestsVideoEventGrouped) => 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 RequestVideoEventClass { @@ -19,8 +39,10 @@ export interface RequestVideoEventAttributes { count: number } -export interface RequestVideoEventInstance extends Sequelize.Instance { +export interface RequestVideoEventInstance extends RequestVideoEventClass, RequestVideoEventAttributes, Sequelize.Instance { id: number + + Video: VideoInstance } export interface RequestVideoEventModel extends RequestVideoEventClass, Sequelize.Model {}