diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-07-05 13:26:25 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-07-05 14:14:16 +0200 |
commit | 6fcd19ba737f1f5614a56c6925adb882dea43b8d (patch) | |
tree | 3365a96d82bc7f00ae504a568725c8e914150cf8 /server/models/request/request-video-event-interface.ts | |
parent | 5fe7e898316e18369c3e1aba307b55077adc7bfb (diff) | |
download | PeerTube-6fcd19ba737f1f5614a56c6925adb882dea43b8d.tar.gz PeerTube-6fcd19ba737f1f5614a56c6925adb882dea43b8d.tar.zst PeerTube-6fcd19ba737f1f5614a56c6925adb882dea43b8d.zip |
Move to promises
Closes https://github.com/Chocobozzz/PeerTube/issues/74
Diffstat (limited to 'server/models/request/request-video-event-interface.ts')
-rw-r--r-- | server/models/request/request-video-event-interface.ts | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/server/models/request/request-video-event-interface.ts b/server/models/request/request-video-event-interface.ts index 3ed03339a..a5032e1b1 100644 --- a/server/models/request/request-video-event-interface.ts +++ b/server/models/request/request-video-event-interface.ts | |||
@@ -1,5 +1,7 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import * as Sequelize from 'sequelize' |
2 | import * as Promise from 'bluebird' | ||
2 | 3 | ||
4 | import { AbstractRequestClass, AbstractRequestToPodClass } from './abstract-request-interface' | ||
3 | import { VideoInstance } from '../video' | 5 | import { VideoInstance } from '../video' |
4 | import { PodInstance } from '../pod' | 6 | import { PodInstance } from '../pod' |
5 | 7 | ||
@@ -16,20 +18,16 @@ export type RequestsVideoEventGrouped = { | |||
16 | } | 18 | } |
17 | 19 | ||
18 | export namespace RequestVideoEventMethods { | 20 | export namespace RequestVideoEventMethods { |
19 | export type CountTotalRequestsCallback = (err: Error, total: number) => void | 21 | export type CountTotalRequests = () => Promise<number> |
20 | export type CountTotalRequests = (callback: CountTotalRequestsCallback) => void | ||
21 | 22 | ||
22 | export type ListWithLimitAndRandomCallback = (err: Error, requestsGrouped?: RequestsVideoEventGrouped) => void | 23 | export type ListWithLimitAndRandom = (limitPods: number, limitRequestsPerPod: number) => Promise<RequestsVideoEventGrouped> |
23 | export type ListWithLimitAndRandom = (limitPods: number, limitRequestsPerPod: number, callback: ListWithLimitAndRandomCallback) => void | ||
24 | 24 | ||
25 | export type RemoveByRequestIdsAndPodCallback = () => void | 25 | export type RemoveByRequestIdsAndPod = (ids: number[], podId: number) => Promise<number> |
26 | export type RemoveByRequestIdsAndPod = (ids: number[], podId: number, callback: RemoveByRequestIdsAndPodCallback) => void | ||
27 | 26 | ||
28 | export type RemoveAllCallback = () => void | 27 | export type RemoveAll = () => Promise<void> |
29 | export type RemoveAll = (callback: RemoveAllCallback) => void | ||
30 | } | 28 | } |
31 | 29 | ||
32 | export interface RequestVideoEventClass { | 30 | export interface RequestVideoEventClass extends AbstractRequestClass<RequestsVideoEventGrouped>, AbstractRequestToPodClass { |
33 | countTotalRequests: RequestVideoEventMethods.CountTotalRequests | 31 | countTotalRequests: RequestVideoEventMethods.CountTotalRequests |
34 | listWithLimitAndRandom: RequestVideoEventMethods.ListWithLimitAndRandom | 32 | listWithLimitAndRandom: RequestVideoEventMethods.ListWithLimitAndRandom |
35 | removeByRequestIdsAndPod: RequestVideoEventMethods.RemoveByRequestIdsAndPod | 33 | removeByRequestIdsAndPod: RequestVideoEventMethods.RemoveByRequestIdsAndPod |
@@ -41,10 +39,12 @@ export interface RequestVideoEventAttributes { | |||
41 | count: number | 39 | count: number |
42 | } | 40 | } |
43 | 41 | ||
44 | export interface RequestVideoEventInstance extends RequestVideoEventClass, RequestVideoEventAttributes, Sequelize.Instance<RequestVideoEventAttributes> { | 42 | export interface RequestVideoEventInstance |
43 | extends RequestVideoEventClass, RequestVideoEventAttributes, Sequelize.Instance<RequestVideoEventAttributes> { | ||
45 | id: number | 44 | id: number |
46 | 45 | ||
47 | Video: VideoInstance | 46 | Video: VideoInstance |
48 | } | 47 | } |
49 | 48 | ||
50 | export interface RequestVideoEventModel extends RequestVideoEventClass, Sequelize.Model<RequestVideoEventInstance, RequestVideoEventAttributes> {} | 49 | export interface RequestVideoEventModel |
50 | extends RequestVideoEventClass, Sequelize.Model<RequestVideoEventInstance, RequestVideoEventAttributes> {} | ||