]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/models/pod-interface.ts
require -> import
[github/Chocobozzz/PeerTube.git] / server / models / pod-interface.ts
CommitLineData
e02643f3
C
1import * as Sequelize from 'sequelize'
2
3export namespace PodMethods {
4 export type ToFormatedJSON = () => void
5
6 export type CountAll = (callback) => void
7 export type IncrementScores = (ids, value, callback) => void
8 export type List = (callback) => void
9 export type ListAllIds = (transaction, callback) => void
10 export type ListRandomPodIdsWithRequest = (limit, tableWithPods, tableWithPodsJoins, callback) => void
11 export type ListBadPods = (callback) => void
12 export type Load = (id, callback) => void
13 export type LoadByHost = (host, callback) => void
14 export type RemoveAll = (callback) => void
15 export type UpdatePodsScore = (goodPods, badPods) => void
16}
17
18export interface PodClass {
19 countAll: PodMethods.CountAll
20 incrementScores: PodMethods.IncrementScores
21 list: PodMethods.List
22 listAllIds: PodMethods.ListAllIds
23 listRandomPodIdsWithRequest: PodMethods.ListRandomPodIdsWithRequest
24 listBadPods: PodMethods.ListBadPods
25 load: PodMethods.Load
26 loadByHost: PodMethods.LoadByHost
27 removeAll: PodMethods.RemoveAll
28 updatePodsScore: PodMethods.UpdatePodsScore
29}
30
31export interface PodAttributes {
32 host?: string
33 publicKey?: string
34 score?: number | Sequelize.literal // Sequelize literal for 'score +' + value
35 email?: string
36}
37
38export interface PodInstance extends PodClass, PodAttributes, Sequelize.Instance<PodAttributes> {
39 id: number
40 createdAt: Date
41 updatedAt: Date
42
43 toFormatedJSON: PodMethods.ToFormatedJSON,
44}
45
46export interface PodModel extends PodClass, Sequelize.Model<PodInstance, PodAttributes> {}