diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-06-16 09:45:46 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-06-16 09:45:46 +0200 |
commit | 74889a71fe687dda74f2a687653122327807af36 (patch) | |
tree | e938e8b6401b74fbec80513a877d9967f2c0dbcd /server/models/pod-interface.ts | |
parent | 15a302943d84bc0978b84fe33110c4daa451d311 (diff) | |
download | PeerTube-74889a71fe687dda74f2a687653122327807af36.tar.gz PeerTube-74889a71fe687dda74f2a687653122327807af36.tar.zst PeerTube-74889a71fe687dda74f2a687653122327807af36.zip |
Reorganize model files
Diffstat (limited to 'server/models/pod-interface.ts')
-rw-r--r-- | server/models/pod-interface.ts | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/server/models/pod-interface.ts b/server/models/pod-interface.ts deleted file mode 100644 index 8f362bd5c..000000000 --- a/server/models/pod-interface.ts +++ /dev/null | |||
@@ -1,67 +0,0 @@ | |||
1 | import * as Sequelize from 'sequelize' | ||
2 | |||
3 | // Don't use barrel, import just what we need | ||
4 | import { Pod as FormatedPod } from '../../shared/models/pod.model' | ||
5 | |||
6 | export namespace PodMethods { | ||
7 | export type ToFormatedJSON = () => FormatedPod | ||
8 | |||
9 | export type CountAllCallback = (err: Error, total: number) => void | ||
10 | export type CountAll = (callback) => void | ||
11 | |||
12 | export type IncrementScoresCallback = (err: Error) => void | ||
13 | export type IncrementScores = (ids: number[], value: number, callback?: IncrementScoresCallback) => void | ||
14 | |||
15 | export type ListCallback = (err: Error, podInstances?: PodInstance[]) => void | ||
16 | export type List = (callback: ListCallback) => void | ||
17 | |||
18 | export type ListAllIdsCallback = (err: Error, ids?: number[]) => void | ||
19 | export type ListAllIds = (transaction: Sequelize.Transaction, callback: ListAllIdsCallback) => void | ||
20 | |||
21 | export type ListRandomPodIdsWithRequestCallback = (err: Error, podInstanceIds?: number[]) => void | ||
22 | export type ListRandomPodIdsWithRequest = (limit: number, tableWithPods: string, tableWithPodsJoins: string, callback: ListRandomPodIdsWithRequestCallback) => void | ||
23 | |||
24 | export type ListBadPodsCallback = (err: Error, podInstances?: PodInstance[]) => void | ||
25 | export type ListBadPods = (callback: ListBadPodsCallback) => void | ||
26 | |||
27 | export type LoadCallback = (err: Error, podInstance: PodInstance) => void | ||
28 | export type Load = (id: number, callback: LoadCallback) => void | ||
29 | |||
30 | export type LoadByHostCallback = (err: Error, podInstance: PodInstance) => void | ||
31 | export type LoadByHost = (host: string, callback: LoadByHostCallback) => void | ||
32 | |||
33 | export type RemoveAllCallback = (err: Error) => void | ||
34 | export type RemoveAll = (callback: RemoveAllCallback) => void | ||
35 | |||
36 | export type UpdatePodsScore = (goodPods: number[], badPods: number[]) => void | ||
37 | } | ||
38 | |||
39 | export interface PodClass { | ||
40 | countAll: PodMethods.CountAll | ||
41 | incrementScores: PodMethods.IncrementScores | ||
42 | list: PodMethods.List | ||
43 | listAllIds: PodMethods.ListAllIds | ||
44 | listRandomPodIdsWithRequest: PodMethods.ListRandomPodIdsWithRequest | ||
45 | listBadPods: PodMethods.ListBadPods | ||
46 | load: PodMethods.Load | ||
47 | loadByHost: PodMethods.LoadByHost | ||
48 | removeAll: PodMethods.RemoveAll | ||
49 | updatePodsScore: PodMethods.UpdatePodsScore | ||
50 | } | ||
51 | |||
52 | export interface PodAttributes { | ||
53 | host?: string | ||
54 | publicKey?: string | ||
55 | score?: number | Sequelize.literal // Sequelize literal for 'score +' + value | ||
56 | email?: string | ||
57 | } | ||
58 | |||
59 | export interface PodInstance extends PodClass, PodAttributes, Sequelize.Instance<PodAttributes> { | ||
60 | id: number | ||
61 | createdAt: Date | ||
62 | updatedAt: Date | ||
63 | |||
64 | toFormatedJSON: PodMethods.ToFormatedJSON, | ||
65 | } | ||
66 | |||
67 | export interface PodModel extends PodClass, Sequelize.Model<PodInstance, PodAttributes> {} | ||