aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos/comment.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/videos/comment.ts')
-rw-r--r--server/controllers/api/videos/comment.ts88
1 files changed, 88 insertions, 0 deletions
diff --git a/server/controllers/api/videos/comment.ts b/server/controllers/api/videos/comment.ts
new file mode 100644
index 000000000..b69aa5d40
--- /dev/null
+++ b/server/controllers/api/videos/comment.ts
@@ -0,0 +1,88 @@
1// import * as express from 'express'
2// import { logger, getFormattedObjects } from '../../../helpers'
3// import {
4// authenticate,
5// ensureUserHasRight,
6// videosBlacklistAddValidator,
7// videosBlacklistRemoveValidator,
8// paginationValidator,
9// blacklistSortValidator,
10// setBlacklistSort,
11// setPagination,
12// asyncMiddleware
13// } from '../../../middlewares'
14// import { BlacklistedVideo, UserRight } from '../../../../shared'
15// import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
16//
17// const videoCommentRouter = express.Router()
18//
19// videoCommentRouter.get('/:videoId/comment',
20// authenticate,
21// ensureUserHasRight(UserRight.MANAGE_VIDEO_BLACKLIST),
22// asyncMiddleware(listVideoCommentsThreadsValidator),
23// asyncMiddleware(listVideoCommentsThreads)
24// )
25//
26// videoCommentRouter.post('/:videoId/comment',
27// authenticate,
28// ensureUserHasRight(UserRight.MANAGE_VIDEO_BLACKLIST),
29// asyncMiddleware(videosBlacklistAddValidator),
30// asyncMiddleware(addVideoToBlacklist)
31// )
32//
33// videoCommentRouter.get('/blacklist',
34// authenticate,
35// ensureUserHasRight(UserRight.MANAGE_VIDEO_BLACKLIST),
36// paginationValidator,
37// blacklistSortValidator,
38// setBlacklistSort,
39// setPagination,
40// asyncMiddleware(listBlacklist)
41// )
42//
43// videoCommentRouter.delete('/:videoId/blacklist',
44// authenticate,
45// ensureUserHasRight(UserRight.MANAGE_VIDEO_BLACKLIST),
46// asyncMiddleware(videosBlacklistRemoveValidator),
47// asyncMiddleware(removeVideoFromBlacklistController)
48// )
49//
50// // ---------------------------------------------------------------------------
51//
52// export {
53// videoCommentRouter
54// }
55//
56// // ---------------------------------------------------------------------------
57//
58// async function addVideoToBlacklist (req: express.Request, res: express.Response, next: express.NextFunction) {
59// const videoInstance = res.locals.video
60//
61// const toCreate = {
62// videoId: videoInstance.id
63// }
64//
65// await VideoBlacklistModel.create(toCreate)
66// return res.type('json').status(204).end()
67// }
68//
69// async function listBlacklist (req: express.Request, res: express.Response, next: express.NextFunction) {
70// const resultList = await VideoBlacklistModel.listForApi(req.query.start, req.query.count, req.query.sort)
71//
72// return res.json(getFormattedObjects<BlacklistedVideo, VideoBlacklistModel>(resultList.data, resultList.total))
73// }
74//
75// async function removeVideoFromBlacklistController (req: express.Request, res: express.Response, next: express.NextFunction) {
76// const blacklistedVideo = res.locals.blacklistedVideo as VideoBlacklistModel
77//
78// try {
79// await blacklistedVideo.destroy()
80//
81// logger.info('Video %s removed from blacklist.', res.locals.video.uuid)
82//
83// return res.sendStatus(204)
84// } catch (err) {
85// logger.error('Some error while removing video %s from blacklist.', res.locals.video.uuid, err)
86// throw err
87// }
88// }