diff options
Diffstat (limited to 'server/models/pod/pod-interface.ts')
-rw-r--r-- | server/models/pod/pod-interface.ts | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/server/models/pod/pod-interface.ts b/server/models/pod/pod-interface.ts index d88847c45..f6963d47e 100644 --- a/server/models/pod/pod-interface.ts +++ b/server/models/pod/pod-interface.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import * as Sequelize from 'sequelize' |
2 | import * as Promise from 'bluebird' | ||
2 | 3 | ||
3 | // Don't use barrel, import just what we need | 4 | // Don't use barrel, import just what we need |
4 | import { Pod as FormatedPod } from '../../../shared/models/pod.model' | 5 | import { Pod as FormatedPod } from '../../../shared/models/pod.model' |
@@ -6,32 +7,23 @@ import { Pod as FormatedPod } from '../../../shared/models/pod.model' | |||
6 | export namespace PodMethods { | 7 | export namespace PodMethods { |
7 | export type ToFormatedJSON = (this: PodInstance) => FormatedPod | 8 | export type ToFormatedJSON = (this: PodInstance) => FormatedPod |
8 | 9 | ||
9 | export type CountAllCallback = (err: Error, total: number) => void | 10 | export type CountAll = () => Promise<number> |
10 | export type CountAll = (callback) => void | ||
11 | 11 | ||
12 | export type IncrementScoresCallback = (err: Error) => void | 12 | export type IncrementScores = (ids: number[], value: number) => Promise<[ number, PodInstance[] ]> |
13 | export type IncrementScores = (ids: number[], value: number, callback?: IncrementScoresCallback) => void | ||
14 | 13 | ||
15 | export type ListCallback = (err: Error, podInstances?: PodInstance[]) => void | 14 | export type List = () => Promise<PodInstance[]> |
16 | export type List = (callback: ListCallback) => void | ||
17 | 15 | ||
18 | export type ListAllIdsCallback = (err: Error, ids?: number[]) => void | 16 | export type ListAllIds = (transaction: Sequelize.Transaction) => Promise<number[]> |
19 | export type ListAllIds = (transaction: Sequelize.Transaction, callback: ListAllIdsCallback) => void | ||
20 | 17 | ||
21 | export type ListRandomPodIdsWithRequestCallback = (err: Error, podInstanceIds?: number[]) => void | 18 | export type ListRandomPodIdsWithRequest = (limit: number, tableWithPods: string, tableWithPodsJoins: string) => Promise<number[]> |
22 | export type ListRandomPodIdsWithRequest = (limit: number, tableWithPods: string, tableWithPodsJoins: string, callback: ListRandomPodIdsWithRequestCallback) => void | ||
23 | 19 | ||
24 | export type ListBadPodsCallback = (err: Error, podInstances?: PodInstance[]) => void | 20 | export type ListBadPods = () => Promise<PodInstance[]> |
25 | export type ListBadPods = (callback: ListBadPodsCallback) => void | ||
26 | 21 | ||
27 | export type LoadCallback = (err: Error, podInstance: PodInstance) => void | 22 | export type Load = (id: number) => Promise<PodInstance> |
28 | export type Load = (id: number, callback: LoadCallback) => void | ||
29 | 23 | ||
30 | export type LoadByHostCallback = (err: Error, podInstance: PodInstance) => void | 24 | export type LoadByHost = (host: string) => Promise<PodInstance> |
31 | export type LoadByHost = (host: string, callback: LoadByHostCallback) => void | ||
32 | 25 | ||
33 | export type RemoveAllCallback = (err: Error) => void | 26 | export type RemoveAll = () => Promise<number> |
34 | export type RemoveAll = (callback: RemoveAllCallback) => void | ||
35 | 27 | ||
36 | export type UpdatePodsScore = (goodPods: number[], badPods: number[]) => void | 28 | export type UpdatePodsScore = (goodPods: number[], badPods: number[]) => void |
37 | } | 29 | } |