From 7d9ba5c08999c6482f0bc5e0c09c6f55b7724090 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 11 May 2021 11:15:29 +0200 Subject: Cleanup models directory organization --- server/middlewares/validators/follows.ts | 16 ++++++++-------- server/middlewares/validators/user-subscriptions.ts | 8 ++++---- server/middlewares/validators/users.ts | 4 ++-- server/middlewares/validators/videos/video-channels.ts | 4 ++-- server/middlewares/validators/webfinger.ts | 6 +++--- 5 files changed, 19 insertions(+), 19 deletions(-) (limited to 'server/middlewares') diff --git a/server/middlewares/validators/follows.ts b/server/middlewares/validators/follows.ts index bb849dc72..1d18de8cd 100644 --- a/server/middlewares/validators/follows.ts +++ b/server/middlewares/validators/follows.ts @@ -1,18 +1,18 @@ import * as express from 'express' import { body, param, query } from 'express-validator' +import { isFollowStateValid } from '@server/helpers/custom-validators/follows' +import { getServerActor } from '@server/models/application/application' +import { MActorFollowActorsDefault } from '@server/types/models' +import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' import { isTestInstance } from '../../helpers/core-utils' +import { isActorTypeValid, isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor' import { isEachUniqueHostValid, isHostValid } from '../../helpers/custom-validators/servers' import { logger } from '../../helpers/logger' +import { loadActorUrlOrGetFromWebfinger } from '../../helpers/webfinger' import { SERVER_ACTOR_NAME, WEBSERVER } from '../../initializers/constants' -import { ActorFollowModel } from '../../models/activitypub/actor-follow' +import { ActorModel } from '../../models/actor/actor' +import { ActorFollowModel } from '../../models/actor/actor-follow' import { areValidationErrors } from './utils' -import { ActorModel } from '../../models/activitypub/actor' -import { loadActorUrlOrGetFromWebfinger } from '../../helpers/webfinger' -import { isActorTypeValid, isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor' -import { MActorFollowActorsDefault } from '@server/types/models' -import { isFollowStateValid } from '@server/helpers/custom-validators/follows' -import { getServerActor } from '@server/models/application/application' -import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' const listFollowsValidator = [ query('state') diff --git a/server/middlewares/validators/user-subscriptions.ts b/server/middlewares/validators/user-subscriptions.ts index 0d0c8ccbf..1823892b6 100644 --- a/server/middlewares/validators/user-subscriptions.ts +++ b/server/middlewares/validators/user-subscriptions.ts @@ -1,12 +1,12 @@ import * as express from 'express' import { body, param, query } from 'express-validator' -import { logger } from '../../helpers/logger' -import { areValidationErrors } from './utils' -import { ActorFollowModel } from '../../models/activitypub/actor-follow' +import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' import { areValidActorHandles, isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor' import { toArray } from '../../helpers/custom-validators/misc' +import { logger } from '../../helpers/logger' import { WEBSERVER } from '../../initializers/constants' -import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' +import { ActorFollowModel } from '../../models/actor/actor-follow' +import { areValidationErrors } from './utils' const userSubscriptionListValidator = [ query('search').optional().not().isEmpty().withMessage('Should have a valid search'), diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts index 37119e279..548d5df4d 100644 --- a/server/middlewares/validators/users.ts +++ b/server/middlewares/validators/users.ts @@ -34,8 +34,8 @@ import { doesVideoExist } from '../../helpers/middlewares' import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup' import { isThemeRegistered } from '../../lib/plugins/theme-utils' import { Redis } from '../../lib/redis' -import { UserModel } from '../../models/account/user' -import { ActorModel } from '../../models/activitypub/actor' +import { UserModel } from '../../models/user/user' +import { ActorModel } from '../../models/actor/actor' import { areValidationErrors } from './utils' const usersListValidator = [ diff --git a/server/middlewares/validators/videos/video-channels.ts b/server/middlewares/validators/videos/video-channels.ts index 2463d281c..e881f0d3e 100644 --- a/server/middlewares/validators/videos/video-channels.ts +++ b/server/middlewares/validators/videos/video-channels.ts @@ -3,6 +3,7 @@ import { body, param, query } from 'express-validator' import { VIDEO_CHANNELS } from '@server/initializers/constants' import { MChannelAccountDefault, MUser } from '@server/types/models' import { UserRight } from '../../../../shared' +import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' import { isActorPreferredUsernameValid } from '../../../helpers/custom-validators/activitypub/actor' import { isBooleanValid, toBooleanOrNull } from '../../../helpers/custom-validators/misc' import { @@ -12,10 +13,9 @@ import { } from '../../../helpers/custom-validators/video-channels' import { logger } from '../../../helpers/logger' import { doesLocalVideoChannelNameExist, doesVideoChannelNameWithHostExist } from '../../../helpers/middlewares' -import { ActorModel } from '../../../models/activitypub/actor' +import { ActorModel } from '../../../models/actor/actor' import { VideoChannelModel } from '../../../models/video/video-channel' import { areValidationErrors } from '../utils' -import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' const videoChannelsAddValidator = [ body('name').custom(isActorPreferredUsernameValid).withMessage('Should have a valid channel name'), diff --git a/server/middlewares/validators/webfinger.ts b/server/middlewares/validators/webfinger.ts index a71422ed8..c2dfccc96 100644 --- a/server/middlewares/validators/webfinger.ts +++ b/server/middlewares/validators/webfinger.ts @@ -1,11 +1,11 @@ import * as express from 'express' import { query } from 'express-validator' +import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' import { isWebfingerLocalResourceValid } from '../../helpers/custom-validators/webfinger' +import { getHostWithPort } from '../../helpers/express-utils' import { logger } from '../../helpers/logger' -import { ActorModel } from '../../models/activitypub/actor' +import { ActorModel } from '../../models/actor/actor' import { areValidationErrors } from './utils' -import { getHostWithPort } from '../../helpers/express-utils' -import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' const webfingerValidator = [ query('resource').custom(isWebfingerLocalResourceValid).withMessage('Should have a valid webfinger resource'), -- cgit v1.2.3