aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-abuse.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-07-05 13:26:25 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-07-05 14:14:16 +0200
commit6fcd19ba737f1f5614a56c6925adb882dea43b8d (patch)
tree3365a96d82bc7f00ae504a568725c8e914150cf8 /server/models/video/video-abuse.ts
parent5fe7e898316e18369c3e1aba307b55077adc7bfb (diff)
downloadPeerTube-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/video/video-abuse.ts')
-rw-r--r--server/models/video/video-abuse.ts11
1 files changed, 3 insertions, 8 deletions
diff --git a/server/models/video/video-abuse.ts b/server/models/video/video-abuse.ts
index bc5f01e21..ab1a3ea7d 100644
--- a/server/models/video/video-abuse.ts
+++ b/server/models/video/video-abuse.ts
@@ -5,7 +5,6 @@ import { isVideoAbuseReporterUsernameValid, isVideoAbuseReasonValid } from '../.
5 5
6import { addMethodsToModel, getSort } from '../utils' 6import { addMethodsToModel, getSort } from '../utils'
7import { 7import {
8 VideoAbuseClass,
9 VideoAbuseInstance, 8 VideoAbuseInstance,
10 VideoAbuseAttributes, 9 VideoAbuseAttributes,
11 10
@@ -109,7 +108,7 @@ function associate (models) {
109 }) 108 })
110} 109}
111 110
112listForApi = function (start: number, count: number, sort: string, callback: VideoAbuseMethods.ListForApiCallback) { 111listForApi = function (start: number, count: number, sort: string) {
113 const query = { 112 const query = {
114 offset: start, 113 offset: start,
115 limit: count, 114 limit: count,
@@ -122,11 +121,7 @@ listForApi = function (start: number, count: number, sort: string, callback: Vid
122 ] 121 ]
123 } 122 }
124 123
125 return VideoAbuse.findAndCountAll(query).asCallback(function (err, result) { 124 return VideoAbuse.findAndCountAll(query).then(({ rows, count }) => {
126 if (err) return callback(err) 125 return { total: count, data: rows }
127
128 return callback(null, result.rows, result.count)
129 }) 126 })
130} 127}
131
132