From 4c7e60bc17ee5830399bac4aa273356903421b4c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 16 Jul 2021 14:27:30 +0200 Subject: Reorganize imports --- server/middlewares/cache.ts | 2 +- server/middlewares/servers.ts | 2 +- server/middlewares/user-right.ts | 2 +- server/middlewares/validators/activitypub/activity.ts | 4 ++-- server/middlewares/validators/bulk.ts | 3 +-- server/middlewares/validators/feeds.ts | 1 - server/middlewares/validators/shared/videos.ts | 3 +-- server/middlewares/validators/videos/video-live.ts | 3 +-- .../middlewares/validators/videos/video-ownership-changes.ts | 10 ++++++++-- 9 files changed, 16 insertions(+), 14 deletions(-) (limited to 'server/middlewares') diff --git a/server/middlewares/cache.ts b/server/middlewares/cache.ts index 1ced06042..e508b22a6 100644 --- a/server/middlewares/cache.ts +++ b/server/middlewares/cache.ts @@ -1,6 +1,6 @@ -import { Redis } from '../lib/redis' import * as apicache from 'apicache' import { HttpStatusCode } from '../../shared/models/http/http-error-codes' +import { Redis } from '../lib/redis' // Ensure Redis is initialized Redis.Instance.init() diff --git a/server/middlewares/servers.ts b/server/middlewares/servers.ts index 49a2241b3..cf70d901e 100644 --- a/server/middlewares/servers.ts +++ b/server/middlewares/servers.ts @@ -1,6 +1,6 @@ import * as express from 'express' -import { getHostWithPort } from '../helpers/express-utils' import { HttpStatusCode } from '../../shared/models/http/http-error-codes' +import { getHostWithPort } from '../helpers/express-utils' function setBodyHostsPort (req: express.Request, res: express.Response, next: express.NextFunction) { if (!req.body.hosts) return next() diff --git a/server/middlewares/user-right.ts b/server/middlewares/user-right.ts index 87a1766cf..c8c694f05 100644 --- a/server/middlewares/user-right.ts +++ b/server/middlewares/user-right.ts @@ -1,7 +1,7 @@ import * as express from 'express' import { UserRight } from '../../shared' -import { logger } from '../helpers/logger' import { HttpStatusCode } from '../../shared/models/http/http-error-codes' +import { logger } from '../helpers/logger' function ensureUserHasRight (userRight: UserRight) { return function (req: express.Request, res: express.Response, next: express.NextFunction) { diff --git a/server/middlewares/validators/activitypub/activity.ts b/server/middlewares/validators/activitypub/activity.ts index d65a8e455..d24e4427b 100644 --- a/server/middlewares/validators/activitypub/activity.ts +++ b/server/middlewares/validators/activitypub/activity.ts @@ -1,8 +1,8 @@ import * as express from 'express' -import { isRootActivityValid } from '../../../helpers/custom-validators/activitypub/activity' -import { logger } from '../../../helpers/logger' import { getServerActor } from '@server/models/application/application' import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' +import { isRootActivityValid } from '../../../helpers/custom-validators/activitypub/activity' +import { logger } from '../../../helpers/logger' async function activityPubValidator (req: express.Request, res: express.Response, next: express.NextFunction) { logger.debug('Checking activity pub parameters') diff --git a/server/middlewares/validators/bulk.ts b/server/middlewares/validators/bulk.ts index 4057b1e01..6fec58149 100644 --- a/server/middlewares/validators/bulk.ts +++ b/server/middlewares/validators/bulk.ts @@ -1,8 +1,7 @@ import * as express from 'express' import { body } from 'express-validator' import { isBulkRemoveCommentsOfScopeValid } from '@server/helpers/custom-validators/bulk' -import { HttpStatusCode } from '@shared/models' -import { UserRight } from '@shared/models' +import { HttpStatusCode, UserRight } from '@shared/models' import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model' import { logger } from '../../helpers/logger' import { areValidationErrors, doesAccountNameWithHostExist } from './shared' diff --git a/server/middlewares/validators/feeds.ts b/server/middlewares/validators/feeds.ts index 1a5a8ffa0..d29bebf64 100644 --- a/server/middlewares/validators/feeds.ts +++ b/server/middlewares/validators/feeds.ts @@ -1,6 +1,5 @@ import * as express from 'express' import { param, query } from 'express-validator' - import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' import { isValidRSSFeed } from '../../helpers/custom-validators/feeds' import { exists, isIdOrUUIDValid, isIdValid, toCompleteUUID } from '../../helpers/custom-validators/misc' diff --git a/server/middlewares/validators/shared/videos.ts b/server/middlewares/validators/shared/videos.ts index 7f42a4893..71b81654f 100644 --- a/server/middlewares/validators/shared/videos.ts +++ b/server/middlewares/validators/shared/videos.ts @@ -12,8 +12,7 @@ import { MVideoImmutable, MVideoThumbnail } from '@server/types/models' -import { HttpStatusCode } from '@shared/models' -import { UserRight } from '@shared/models' +import { HttpStatusCode, UserRight } from '@shared/models' async function doesVideoExist (id: number | string, res: Response, fetchType: VideoLoadType = 'all') { const userId = res.locals.oauth ? res.locals.oauth.token.User.id : undefined diff --git a/server/middlewares/validators/videos/video-live.ts b/server/middlewares/validators/videos/video-live.ts index 5c8a4269d..97e8b4510 100644 --- a/server/middlewares/validators/videos/video-live.ts +++ b/server/middlewares/validators/videos/video-live.ts @@ -5,8 +5,7 @@ import { isLocalLiveVideoAccepted } from '@server/lib/moderation' import { Hooks } from '@server/lib/plugins/hooks' import { VideoModel } from '@server/models/video/video' import { VideoLiveModel } from '@server/models/video/video-live' -import { HttpStatusCode } from '@shared/models' -import { ServerErrorCode, UserRight, VideoState } from '@shared/models' +import { HttpStatusCode, ServerErrorCode, UserRight, VideoState } from '@shared/models' import { isBooleanValid, isIdValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc' import { isVideoNameValid } from '../../../helpers/custom-validators/videos' import { cleanUpReqFiles } from '../../../helpers/express-utils' diff --git a/server/middlewares/validators/videos/video-ownership-changes.ts b/server/middlewares/validators/videos/video-ownership-changes.ts index 06f86a4c8..a7f0b72c3 100644 --- a/server/middlewares/validators/videos/video-ownership-changes.ts +++ b/server/middlewares/validators/videos/video-ownership-changes.ts @@ -6,8 +6,14 @@ import { logger } from '@server/helpers/logger' import { isAbleToUploadVideo } from '@server/lib/user' import { AccountModel } from '@server/models/account/account' import { MVideoWithAllFiles } from '@server/types/models' -import { HttpStatusCode } from '@shared/models' -import { ServerErrorCode, UserRight, VideoChangeOwnershipAccept, VideoChangeOwnershipStatus, VideoState } from '@shared/models' +import { + HttpStatusCode, + ServerErrorCode, + UserRight, + VideoChangeOwnershipAccept, + VideoChangeOwnershipStatus, + VideoState +} from '@shared/models' import { areValidationErrors, checkUserCanManageVideo, -- cgit v1.2.3