aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/request-interface.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-06-10 22:15:25 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-06-10 22:15:25 +0200
commit69818c9394366b954b6ba3bd697bd9d2b09f2a16 (patch)
treead199a18ec3c322460d6f9523fc383ee562554e0 /server/models/request-interface.ts
parent4d4e5cd4dca78480ec7f40e747f424cd107376a4 (diff)
downloadPeerTube-69818c9394366b954b6ba3bd697bd9d2b09f2a16.tar.gz
PeerTube-69818c9394366b954b6ba3bd697bd9d2b09f2a16.tar.zst
PeerTube-69818c9394366b954b6ba3bd697bd9d2b09f2a16.zip
Type functions
Diffstat (limited to 'server/models/request-interface.ts')
-rw-r--r--server/models/request-interface.ts27
1 files changed, 21 insertions, 6 deletions
diff --git a/server/models/request-interface.ts b/server/models/request-interface.ts
index 2bba8ce7f..4bbd79966 100644
--- a/server/models/request-interface.ts
+++ b/server/models/request-interface.ts
@@ -1,12 +1,26 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3import { PodAttributes } from './pod-interface' 3import { PodInstance, PodAttributes } from './pod-interface'
4
5export type RequestsGrouped = {
6 [ podId: number ]: {
7 request: RequestInstance,
8 pod: PodInstance
9 }[]
10}
4 11
5export namespace RequestMethods { 12export namespace RequestMethods {
6 export type CountTotalRequests = (callback) => void 13 export type CountTotalRequestsCallback = (err: Error, total: number) => void
7 export type ListWithLimitAndRandom = (limitPods, limitRequestsPerPod, callback) => void 14 export type CountTotalRequests = (callback: CountTotalRequestsCallback) => void
8 export type RemoveWithEmptyTo = (callback) => void 15
9 export type RemoveAll = (callback) => void 16 export type ListWithLimitAndRandomCallback = (err: Error, requestsGrouped?: RequestsGrouped) => void
17 export type ListWithLimitAndRandom = (limitPods, limitRequestsPerPod, callback: ListWithLimitAndRandomCallback) => void
18
19 export type RemoveWithEmptyToCallback = (err: Error) => void
20 export type RemoveWithEmptyTo = (callback: RemoveWithEmptyToCallback) => void
21
22 export type RemoveAllCallback = (err: Error) => void
23 export type RemoveAll = (callback: RemoveAllCallback) => void
10} 24}
11 25
12export interface RequestClass { 26export interface RequestClass {
@@ -21,12 +35,13 @@ export interface RequestAttributes {
21 endpoint: string 35 endpoint: string
22} 36}
23 37
24export interface RequestInstance extends Sequelize.Instance<RequestAttributes> { 38export interface RequestInstance extends RequestClass, RequestAttributes, Sequelize.Instance<RequestAttributes> {
25 id: number 39 id: number
26 createdAt: Date 40 createdAt: Date
27 updatedAt: Date 41 updatedAt: Date
28 42
29 setPods: Sequelize.HasManySetAssociationsMixin<PodAttributes, number> 43 setPods: Sequelize.HasManySetAssociationsMixin<PodAttributes, number>
44 Pods: PodInstance[]
30} 45}
31 46
32export interface RequestModel extends RequestClass, Sequelize.Model<RequestInstance, RequestAttributes> {} 47export interface RequestModel extends RequestClass, Sequelize.Model<RequestInstance, RequestAttributes> {}