diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-06-10 22:15:25 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-06-10 22:15:25 +0200 |
commit | 69818c9394366b954b6ba3bd697bd9d2b09f2a16 (patch) | |
tree | ad199a18ec3c322460d6f9523fc383ee562554e0 /server/models/request-interface.ts | |
parent | 4d4e5cd4dca78480ec7f40e747f424cd107376a4 (diff) | |
download | PeerTube-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.ts | 27 |
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 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import * as Sequelize from 'sequelize' |
2 | 2 | ||
3 | import { PodAttributes } from './pod-interface' | 3 | import { PodInstance, PodAttributes } from './pod-interface' |
4 | |||
5 | export type RequestsGrouped = { | ||
6 | [ podId: number ]: { | ||
7 | request: RequestInstance, | ||
8 | pod: PodInstance | ||
9 | }[] | ||
10 | } | ||
4 | 11 | ||
5 | export namespace RequestMethods { | 12 | export 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 | ||
12 | export interface RequestClass { | 26 | export interface RequestClass { |
@@ -21,12 +35,13 @@ export interface RequestAttributes { | |||
21 | endpoint: string | 35 | endpoint: string |
22 | } | 36 | } |
23 | 37 | ||
24 | export interface RequestInstance extends Sequelize.Instance<RequestAttributes> { | 38 | export 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 | ||
32 | export interface RequestModel extends RequestClass, Sequelize.Model<RequestInstance, RequestAttributes> {} | 47 | export interface RequestModel extends RequestClass, Sequelize.Model<RequestInstance, RequestAttributes> {} |