Create types for model enums

This commit is contained in:
Chocobozzz
2017-06-16 10:36:18 +02:00
parent 70c065d64c
commit ee9e7b61f5
21 changed files with 89 additions and 29 deletions

View File

@@ -28,10 +28,18 @@ import {
RequestVideoEventScheduler,
RequestVideoEventSchedulerOptions
} from './request'
import { PodInstance, VideoInstance } from '../models'
import {
PodInstance,
VideoInstance
} from '../models'
import {
RequestEndpoint,
RequestVideoEventType,
RequestVideoQaduType
} from '../../shared'
type QaduParam = { videoId: string, type: string }
type EventParam = { videoId: string, type: string }
type QaduParam = { videoId: string, type: RequestVideoQaduType }
type EventParam = { videoId: string, type: RequestVideoEventType }
const ENDPOINT_ACTIONS = REQUEST_ENDPOINT_ACTIONS[REQUEST_ENDPOINTS.VIDEOS]
@@ -391,7 +399,7 @@ function makeRequestsToWinningPods (cert: string, podsList: PodInstance[], callb
// Wrapper that populate "toIds" argument with all our friends if it is not specified
type CreateRequestOptions = {
type: string
endpoint: string
endpoint: RequestEndpoint
data: Object
toIds?: number[]
transaction: Sequelize.Transaction

View File

@@ -7,10 +7,11 @@ import {
REQUESTS_LIMIT_PODS,
REQUESTS_LIMIT_PER_POD
} from '../../initializers'
import { RequestEndpoint } from '../../../shared'
export type RequestSchedulerOptions = {
type: string
endpoint: string
endpoint: RequestEndpoint
data: Object
toIds: number[]
transaction: Sequelize.Transaction

View File

@@ -7,9 +7,10 @@ import {
REQUESTS_VIDEO_EVENT_LIMIT_PER_POD,
REQUEST_VIDEO_EVENT_ENDPOINT
} from '../../initializers'
import { RequestVideoEventType } from '../../../shared'
export type RequestVideoEventSchedulerOptions = {
type: string
type: RequestVideoEventType
videoId: string
count?: number
transaction?: Sequelize.Transaction

View File

@@ -9,9 +9,10 @@ import {
REQUEST_VIDEO_QADU_ENDPOINT,
REQUEST_VIDEO_QADU_TYPES
} from '../../initializers'
import { RequestVideoQaduType } from '../../../shared'
export type RequestVideoQaduSchedulerOptions = {
type: string
type: RequestVideoQaduType
videoId: string
transaction?: Sequelize.Transaction
}