diff options
Diffstat (limited to 'server/controllers/api/videos')
-rw-r--r-- | server/controllers/api/videos/abuse.ts | 14 | ||||
-rw-r--r-- | server/controllers/api/videos/blacklist.ts | 16 | ||||
-rw-r--r-- | server/controllers/api/videos/channel.ts | 16 | ||||
-rw-r--r-- | server/controllers/api/videos/comment.ts | 3 | ||||
-rw-r--r-- | server/controllers/api/videos/index.ts | 41 | ||||
-rw-r--r-- | server/controllers/api/videos/rate.ts | 3 |
6 files changed, 28 insertions, 65 deletions
diff --git a/server/controllers/api/videos/abuse.ts b/server/controllers/api/videos/abuse.ts index fecdaf5a3..e78f0f6fc 100644 --- a/server/controllers/api/videos/abuse.ts +++ b/server/controllers/api/videos/abuse.ts | |||
@@ -1,17 +1,13 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { UserRight, VideoAbuseCreate } from '../../../../shared' | 2 | import { UserRight, VideoAbuseCreate } from '../../../../shared' |
3 | import { getFormattedObjects, logger, retryTransactionWrapper } from '../../../helpers' | 3 | import { retryTransactionWrapper } from '../../../helpers/database-utils' |
4 | import { logger } from '../../../helpers/logger' | ||
5 | import { getFormattedObjects } from '../../../helpers/utils' | ||
4 | import { sequelizeTypescript } from '../../../initializers' | 6 | import { sequelizeTypescript } from '../../../initializers' |
5 | import { sendVideoAbuse } from '../../../lib/activitypub/send' | 7 | import { sendVideoAbuse } from '../../../lib/activitypub/send' |
6 | import { | 8 | import { |
7 | asyncMiddleware, | 9 | asyncMiddleware, authenticate, ensureUserHasRight, paginationValidator, setPagination, setVideoAbusesSort, |
8 | authenticate, | 10 | videoAbuseReportValidator, videoAbusesSortValidator |
9 | ensureUserHasRight, | ||
10 | paginationValidator, | ||
11 | setPagination, | ||
12 | setVideoAbusesSort, | ||
13 | videoAbuseReportValidator, | ||
14 | videoAbusesSortValidator | ||
15 | } from '../../../middlewares' | 11 | } from '../../../middlewares' |
16 | import { AccountModel } from '../../../models/account/account' | 12 | import { AccountModel } from '../../../models/account/account' |
17 | import { VideoModel } from '../../../models/video/video' | 13 | import { VideoModel } from '../../../models/video/video' |
diff --git a/server/controllers/api/videos/blacklist.ts b/server/controllers/api/videos/blacklist.ts index d08c6e13f..c9087fd97 100644 --- a/server/controllers/api/videos/blacklist.ts +++ b/server/controllers/api/videos/blacklist.ts | |||
@@ -1,17 +1,11 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { logger, getFormattedObjects } from '../../../helpers' | 2 | import { BlacklistedVideo, UserRight } from '../../../../shared' |
3 | import { logger } from '../../../helpers/logger' | ||
4 | import { getFormattedObjects } from '../../../helpers/utils' | ||
3 | import { | 5 | import { |
4 | authenticate, | 6 | asyncMiddleware, authenticate, blacklistSortValidator, ensureUserHasRight, paginationValidator, setBlacklistSort, setPagination, |
5 | ensureUserHasRight, | 7 | videosBlacklistAddValidator, videosBlacklistRemoveValidator |
6 | videosBlacklistAddValidator, | ||
7 | videosBlacklistRemoveValidator, | ||
8 | paginationValidator, | ||
9 | blacklistSortValidator, | ||
10 | setBlacklistSort, | ||
11 | setPagination, | ||
12 | asyncMiddleware | ||
13 | } from '../../../middlewares' | 8 | } from '../../../middlewares' |
14 | import { BlacklistedVideo, UserRight } from '../../../../shared' | ||
15 | import { VideoBlacklistModel } from '../../../models/video/video-blacklist' | 9 | import { VideoBlacklistModel } from '../../../models/video/video-blacklist' |
16 | 10 | ||
17 | const blacklistRouter = express.Router() | 11 | const blacklistRouter = express.Router() |
diff --git a/server/controllers/api/videos/channel.ts b/server/controllers/api/videos/channel.ts index cc00d9f8d..7c62b5476 100644 --- a/server/controllers/api/videos/channel.ts +++ b/server/controllers/api/videos/channel.ts | |||
@@ -1,20 +1,14 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { VideoChannelCreate, VideoChannelUpdate } from '../../../../shared' | 2 | import { VideoChannelCreate, VideoChannelUpdate } from '../../../../shared' |
3 | import { getFormattedObjects, logger, resetSequelizeInstance, retryTransactionWrapper } from '../../../helpers' | 3 | import { retryTransactionWrapper } from '../../../helpers/database-utils' |
4 | import { logger } from '../../../helpers/logger' | ||
5 | import { getFormattedObjects, resetSequelizeInstance } from '../../../helpers/utils' | ||
4 | import { sequelizeTypescript } from '../../../initializers' | 6 | import { sequelizeTypescript } from '../../../initializers' |
5 | import { setAsyncActorKeys } from '../../../lib/activitypub' | 7 | import { setAsyncActorKeys } from '../../../lib/activitypub' |
6 | import { createVideoChannel } from '../../../lib/video-channel' | 8 | import { createVideoChannel } from '../../../lib/video-channel' |
7 | import { | 9 | import { |
8 | asyncMiddleware, | 10 | asyncMiddleware, authenticate, listVideoAccountChannelsValidator, paginationValidator, setPagination, setVideoChannelsSort, |
9 | authenticate, | 11 | videoChannelsAddValidator, videoChannelsGetValidator, videoChannelsRemoveValidator, videoChannelsSortValidator, |
10 | listVideoAccountChannelsValidator, | ||
11 | paginationValidator, | ||
12 | setPagination, | ||
13 | setVideoChannelsSort, | ||
14 | videoChannelsAddValidator, | ||
15 | videoChannelsGetValidator, | ||
16 | videoChannelsRemoveValidator, | ||
17 | videoChannelsSortValidator, | ||
18 | videoChannelsUpdateValidator | 12 | videoChannelsUpdateValidator |
19 | } from '../../../middlewares' | 13 | } from '../../../middlewares' |
20 | import { AccountModel } from '../../../models/account/account' | 14 | import { AccountModel } from '../../../models/account/account' |
diff --git a/server/controllers/api/videos/comment.ts b/server/controllers/api/videos/comment.ts index 276948098..b11da2ef7 100644 --- a/server/controllers/api/videos/comment.ts +++ b/server/controllers/api/videos/comment.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { VideoCommentCreate } from '../../../../shared/models/videos/video-comment.model' | 2 | import { VideoCommentCreate } from '../../../../shared/models/videos/video-comment.model' |
3 | import { getFormattedObjects, retryTransactionWrapper } from '../../../helpers' | 3 | import { retryTransactionWrapper } from '../../../helpers/database-utils' |
4 | import { getFormattedObjects } from '../../../helpers/utils' | ||
4 | import { sequelizeTypescript } from '../../../initializers' | 5 | import { sequelizeTypescript } from '../../../initializers' |
5 | import { buildFormattedCommentTree, createVideoComment } from '../../../lib/video-comment' | 6 | import { buildFormattedCommentTree, createVideoComment } from '../../../lib/video-comment' |
6 | import { asyncMiddleware, authenticate, paginationValidator, setPagination, setVideoCommentThreadsSort } from '../../../middlewares' | 7 | import { asyncMiddleware, authenticate, paginationValidator, setPagination, setVideoCommentThreadsSort } from '../../../middlewares' |
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 8e54d95ab..11e3da5cc 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -2,44 +2,21 @@ import * as express from 'express' | |||
2 | import * as multer from 'multer' | 2 | import * as multer from 'multer' |
3 | import { extname, join } from 'path' | 3 | import { extname, join } from 'path' |
4 | import { VideoCreate, VideoPrivacy, VideoUpdate } from '../../../../shared' | 4 | import { VideoCreate, VideoPrivacy, VideoUpdate } from '../../../../shared' |
5 | import { renamePromise } from '../../../helpers/core-utils' | ||
6 | import { retryTransactionWrapper } from '../../../helpers/database-utils' | ||
7 | import { getVideoFileHeight } from '../../../helpers/ffmpeg-utils' | ||
8 | import { logger } from '../../../helpers/logger' | ||
9 | import { generateRandomString, getFormattedObjects, getServerActor, resetSequelizeInstance } from '../../../helpers/utils' | ||
5 | import { | 10 | import { |
6 | generateRandomString, | 11 | CONFIG, sequelizeTypescript, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_MIMETYPE_EXT, |
7 | getFormattedObjects, | ||
8 | getVideoFileHeight, | ||
9 | logger, | ||
10 | renamePromise, | ||
11 | resetSequelizeInstance, | ||
12 | retryTransactionWrapper | ||
13 | } from '../../../helpers' | ||
14 | import { getServerActor } from '../../../helpers/utils' | ||
15 | import { | ||
16 | CONFIG, | ||
17 | sequelizeTypescript, | ||
18 | VIDEO_CATEGORIES, | ||
19 | VIDEO_LANGUAGES, | ||
20 | VIDEO_LICENCES, | ||
21 | VIDEO_MIMETYPE_EXT, | ||
22 | VIDEO_PRIVACIES | 12 | VIDEO_PRIVACIES |
23 | } from '../../../initializers' | 13 | } from '../../../initializers' |
24 | import { | 14 | import { fetchRemoteVideoDescription, getVideoActivityPubUrl, shareVideoByServerAndChannel } from '../../../lib/activitypub' |
25 | fetchRemoteVideoDescription, | ||
26 | getVideoActivityPubUrl, | ||
27 | shareVideoByServerAndChannel | ||
28 | } from '../../../lib/activitypub' | ||
29 | import { sendCreateVideo, sendCreateViewToOrigin, sendCreateViewToVideoFollowers, sendUpdateVideo } from '../../../lib/activitypub/send' | 15 | import { sendCreateVideo, sendCreateViewToOrigin, sendCreateViewToVideoFollowers, sendUpdateVideo } from '../../../lib/activitypub/send' |
30 | import { transcodingJobScheduler } from '../../../lib/jobs/transcoding-job-scheduler' | 16 | import { transcodingJobScheduler } from '../../../lib/jobs/transcoding-job-scheduler' |
31 | import { | 17 | import { |
32 | asyncMiddleware, | 18 | asyncMiddleware, authenticate, paginationValidator, setPagination, setVideosSort, videosAddValidator, videosGetValidator, |
33 | authenticate, | 19 | videosRemoveValidator, videosSearchValidator, videosSortValidator, videosUpdateValidator |
34 | paginationValidator, | ||
35 | setPagination, | ||
36 | setVideosSort, | ||
37 | videosAddValidator, | ||
38 | videosGetValidator, | ||
39 | videosRemoveValidator, | ||
40 | videosSearchValidator, | ||
41 | videosSortValidator, | ||
42 | videosUpdateValidator | ||
43 | } from '../../../middlewares' | 20 | } from '../../../middlewares' |
44 | import { TagModel } from '../../../models/video/tag' | 21 | import { TagModel } from '../../../models/video/tag' |
45 | import { VideoModel } from '../../../models/video/video' | 22 | import { VideoModel } from '../../../models/video/video' |
diff --git a/server/controllers/api/videos/rate.ts b/server/controllers/api/videos/rate.ts index 48b744b0c..b470f27f6 100644 --- a/server/controllers/api/videos/rate.ts +++ b/server/controllers/api/videos/rate.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { UserVideoRateUpdate } from '../../../../shared' | 2 | import { UserVideoRateUpdate } from '../../../../shared' |
3 | import { logger, retryTransactionWrapper } from '../../../helpers' | 3 | import { retryTransactionWrapper } from '../../../helpers/database-utils' |
4 | import { logger } from '../../../helpers/logger' | ||
4 | import { sequelizeTypescript, VIDEO_RATE_TYPES } from '../../../initializers' | 5 | import { sequelizeTypescript, VIDEO_RATE_TYPES } from '../../../initializers' |
5 | import { sendVideoRateChangeToFollowers, sendVideoRateChangeToOrigin } from '../../../lib/activitypub' | 6 | import { sendVideoRateChangeToFollowers, sendVideoRateChangeToOrigin } from '../../../lib/activitypub' |
6 | import { asyncMiddleware, authenticate, videoRateValidator } from '../../../middlewares' | 7 | import { asyncMiddleware, authenticate, videoRateValidator } from '../../../middlewares' |