PeerTube/server/models/request-video-event-interfa...

49 lines
1.8 KiB
TypeScript
Raw Normal View History

2017-05-22 13:58:25 -05:00
import * as Sequelize from 'sequelize'
2017-06-10 15:15:25 -05:00
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
}[]
}
2017-05-22 13:58:25 -05:00
export namespace RequestVideoEventMethods {
2017-06-10 15:15:25 -05:00
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
2017-05-22 13:58:25 -05:00
}
export interface RequestVideoEventClass {
countTotalRequests: RequestVideoEventMethods.CountTotalRequests
listWithLimitAndRandom: RequestVideoEventMethods.ListWithLimitAndRandom
removeByRequestIdsAndPod: RequestVideoEventMethods.RemoveByRequestIdsAndPod
removeAll: RequestVideoEventMethods.RemoveAll
}
export interface RequestVideoEventAttributes {
type: string
count: number
}
2017-06-10 15:15:25 -05:00
export interface RequestVideoEventInstance extends RequestVideoEventClass, RequestVideoEventAttributes, Sequelize.Instance<RequestVideoEventAttributes> {
2017-05-22 13:58:25 -05:00
id: number
2017-06-10 15:15:25 -05:00
Video: VideoInstance
2017-05-22 13:58:25 -05:00
}
export interface RequestVideoEventModel extends RequestVideoEventClass, Sequelize.Model<RequestVideoEventInstance, RequestVideoEventAttributes> {}