import * as friends from '../../../lib/friends'
import {
logger,
- getFormatedObjects,
+ getFormattedObjects,
retryTransactionWrapper
} from '../../../helpers'
import {
setPagination
} from '../../../middlewares'
import { VideoInstance } from '../../../models'
+import { VideoAbuseCreate } from '../../../../shared'
const abuseVideoRouter = express.Router()
function listVideoAbuses (req: express.Request, res: express.Response, next: express.NextFunction) {
db.VideoAbuse.listForApi(req.query.start, req.query.count, req.query.sort)
- .then(result => res.json(getFormatedObjects(result.data, result.total)))
+ .then(result => res.json(getFormattedObjects(result.data, result.total)))
.catch(err => next(err))
}
}
function reportVideoAbuse (req: express.Request, res: express.Response) {
- const videoInstance = res.locals.video
+ const videoInstance = res.locals.video as VideoInstance
const reporterUsername = res.locals.oauth.token.User.username
+ const body: VideoAbuseCreate = req.body
const abuse = {
reporterUsername,
- reason: req.body.reason,
+ reason: body.reason,
videoId: videoInstance.id,
reporterPodId: null // This is our pod that reported this abuse
}
const reportData = {
reporterUsername,
reportReason: abuse.reason,
- videoRemoteId: videoInstance.remoteId
+ videoUUID: videoInstance.uuid
}
return friends.reportAbuseVideoToFriend(reportData, videoInstance, t).then(() => videoInstance)