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

51 lines
1.7 KiB
TypeScript
Raw Normal View History

2017-05-22 13:58:25 -05:00
import * as Sequelize from 'sequelize'
import * as Promise from 'bluebird'
2017-05-22 13:58:25 -05:00
import { AbstractRequestClass, AbstractRequestToPodClass } from './abstract-request-interface'
2017-06-16 02:45:46 -05:00
import { VideoInstance } from '../video'
import { PodInstance } from '../pod'
2017-06-10 15:15:25 -05:00
2017-06-16 03:36:18 -05:00
import { RequestVideoEventType } from '../../../shared/models/request-scheduler.model'
2017-06-10 15:15:25 -05:00
export type RequestsVideoEventGrouped = {
[ podId: number ]: {
id: number
2017-06-16 03:36:18 -05:00
type: RequestVideoEventType
2017-06-10 15:15:25 -05:00
count: number
video: VideoInstance
pod: PodInstance
}[]
}
2017-05-22 13:58:25 -05:00
export namespace RequestVideoEventMethods {
export type CountTotalRequests = () => Promise<number>
2017-06-10 15:15:25 -05:00
export type ListWithLimitAndRandom = (limitPods: number, limitRequestsPerPod: number) => Promise<RequestsVideoEventGrouped>
2017-06-10 15:15:25 -05:00
export type RemoveByRequestIdsAndPod = (ids: number[], podId: number) => Promise<number>
2017-06-10 15:15:25 -05:00
export type RemoveAll = () => Promise<void>
2017-05-22 13:58:25 -05:00
}
export interface RequestVideoEventClass extends AbstractRequestClass<RequestsVideoEventGrouped>, AbstractRequestToPodClass {
2017-05-22 13:58:25 -05:00
countTotalRequests: RequestVideoEventMethods.CountTotalRequests
listWithLimitAndRandom: RequestVideoEventMethods.ListWithLimitAndRandom
removeByRequestIdsAndPod: RequestVideoEventMethods.RemoveByRequestIdsAndPod
removeAll: RequestVideoEventMethods.RemoveAll
}
export interface RequestVideoEventAttributes {
2017-06-16 03:36:18 -05:00
type: RequestVideoEventType
2017-05-22 13:58:25 -05:00
count: number
}
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> {}