aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/request-interface.ts
blob: 2bba8ce7fff42f08ce03007bba58cce727f086fe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import * as Sequelize from 'sequelize'

import { PodAttributes } from './pod-interface'

export namespace RequestMethods {
  export type CountTotalRequests = (callback) => void
  export type ListWithLimitAndRandom = (limitPods, limitRequestsPerPod, callback) => void
  export type RemoveWithEmptyTo = (callback) => void
  export type RemoveAll = (callback) => void
}

export interface RequestClass {
  countTotalRequests: RequestMethods.CountTotalRequests
  listWithLimitAndRandom: RequestMethods.ListWithLimitAndRandom
  removeWithEmptyTo: RequestMethods.RemoveWithEmptyTo
  removeAll: RequestMethods.RemoveAll
}

export interface RequestAttributes {
  request: object
  endpoint: string
}

export interface RequestInstance extends Sequelize.Instance<RequestAttributes> {
  id: number
  createdAt: Date
  updatedAt: Date

  setPods: Sequelize.HasManySetAssociationsMixin<PodAttributes, number>
}

export interface RequestModel extends RequestClass, Sequelize.Model<RequestInstance, RequestAttributes> {}