Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Cleanup models directory organization

Chocobozzz7d9ba5c08999
diff --git a/scripts/prune-storage.ts b/scripts/prune-storage.ts
index 32314b0b7c..0f2d1320e1 100755
--- a/scripts/prune-storage.ts
+++ b/scripts/prune-storage.ts
@@ -11,7 +11,7 @@ import { VideoRedundancyModel } from '../server/models/redundancy/video-redundan
import * as Bluebird from 'bluebird'
import { getUUIDFromFilename } from '../server/helpers/utils'
import { ThumbnailModel } from '../server/models/video/thumbnail'
-import { ActorImageModel } from '../server/models/account/actor-image'
+import { ActorImageModel } from '../server/models/actor/actor-image'
import { uniq, values } from 'lodash'
import { ThumbnailType } from '@shared/models'
diff --git a/scripts/reset-password.ts b/scripts/reset-password.ts
index 7e7de6b8ae..7c1a64a3f6 100755
--- a/scripts/reset-password.ts
+++ b/scripts/reset-password.ts
@@ -3,7 +3,7 @@ registerTSPaths()
import * as program from 'commander'
import { initDatabaseModels } from '../server/initializers/database'
-import { UserModel } from '../server/models/account/user'
+import { UserModel } from '../server/models/user/user'
import { isUserPasswordValid } from '../server/helpers/custom-validators/users'
program
diff --git a/scripts/update-host.ts b/scripts/update-host.ts
index e497be4e26..5926842250 100755
--- a/scripts/update-host.ts
+++ b/scripts/update-host.ts
@@ -2,9 +2,9 @@ import { registerTSPaths } from '../server/helpers/register-ts-paths'
registerTSPaths()
import { WEBSERVER } from '../server/initializers/constants'
-import { ActorFollowModel } from '../server/models/activitypub/actor-follow'
+import { ActorFollowModel } from '../server/models/actor/actor-follow'
import { VideoModel } from '../server/models/video/video'
-import { ActorModel } from '../server/models/activitypub/actor'
+import { ActorModel } from '../server/models/actor/actor'
import {
getLocalAccountActivityPubUrl,
getLocalVideoActivityPubUrl,
diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts
index 1b4acc2349..1982e171de 100644
--- a/server/controllers/activitypub/client.ts
+++ b/server/controllers/activitypub/client.ts
@@ -30,7 +30,7 @@ import { videoFileRedundancyGetValidator, videoPlaylistRedundancyGetValidator }
import { videoPlaylistElementAPGetValidator, videoPlaylistsGetValidator } from '../../middlewares/validators/videos/video-playlists'
import { AccountModel } from '../../models/account/account'
import { AccountVideoRateModel } from '../../models/account/account-video-rate'
-import { ActorFollowModel } from '../../models/activitypub/actor-follow'
+import { ActorFollowModel } from '../../models/actor/actor-follow'
import { VideoModel } from '../../models/video/video'
import { VideoCaptionModel } from '../../models/video/video-caption'
import { VideoCommentModel } from '../../models/video/video-comment'
diff --git a/server/controllers/api/server/follows.ts b/server/controllers/api/server/follows.ts
index 80025bc5ba..daeef22de4 100644
--- a/server/controllers/api/server/follows.ts
+++ b/server/controllers/api/server/follows.ts
@@ -1,9 +1,15 @@
import * as express from 'express'
+import { getServerActor } from '@server/models/application/application'
+import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
import { UserRight } from '../../../../shared/models/users'
import { logger } from '../../../helpers/logger'
import { getFormattedObjects } from '../../../helpers/utils'
import { SERVER_ACTOR_NAME } from '../../../initializers/constants'
+import { sequelizeTypescript } from '../../../initializers/database'
+import { autoFollowBackIfNeeded } from '../../../lib/activitypub/follow'
import { sendAccept, sendReject, sendUndoFollow } from '../../../lib/activitypub/send'
+import { JobQueue } from '../../../lib/job-queue'
+import { removeRedundanciesOfServer } from '../../../lib/redundancy'
import {
asyncMiddleware,
authenticate,
@@ -19,16 +25,10 @@ import {
followingSortValidator,
followValidator,
getFollowerValidator,
- removeFollowingValidator,
- listFollowsValidator
+ listFollowsValidator,
+ removeFollowingValidator
} from '../../../middlewares/validators'
-import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
-import { JobQueue } from '../../../lib/job-queue'
-import { removeRedundanciesOfServer } from '../../../lib/redundancy'
-import { sequelizeTypescript } from '../../../initializers/database'
-import { autoFollowBackIfNeeded } from '../../../lib/activitypub/follow'
-import { getServerActor } from '@server/models/application/application'
-import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
+import { ActorFollowModel } from '../../../models/actor/actor-follow'
const serverFollowsRouter = express.Router()
serverFollowsRouter.get('/following',
diff --git a/server/controllers/api/server/server-blocklist.ts b/server/controllers/api/server/server-blocklist.ts
index 6e341c0fb2..a86bc7d191 100644
--- a/server/controllers/api/server/server-blocklist.ts
+++ b/server/controllers/api/server/server-blocklist.ts
@@ -1,7 +1,7 @@
import 'multer'
import * as express from 'express'
import { logger } from '@server/helpers/logger'
-import { UserNotificationModel } from '@server/models/account/user-notification'
+import { UserNotificationModel } from '@server/models/user/user-notification'
import { getServerActor } from '@server/models/application/application'
import { UserRight } from '../../../../shared/models/users'
import { getFormattedObjects } from '../../../helpers/utils'
diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts
index e2b1ea7cd8..c655d1648c 100644
--- a/server/controllers/api/users/index.ts
+++ b/server/controllers/api/users/index.ts
@@ -45,7 +45,7 @@ import {
usersResetPasswordValidator,
usersVerifyEmailValidator
} from '../../../middlewares/validators'
-import { UserModel } from '../../../models/account/user'
+import { UserModel } from '../../../models/user/user'
import { meRouter } from './me'
import { myAbusesRouter } from './my-abuses'
import { myBlocklistRouter } from './my-blocklist'
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts
index 0763d19007..d97652840d 100644
--- a/server/controllers/api/users/me.ts
+++ b/server/controllers/api/users/me.ts
@@ -28,7 +28,7 @@ import { deleteMeValidator, videoImportsSortValidator, videosSortValidator } fro
import { updateAvatarValidator } from '../../../middlewares/validators/actor-image'
import { AccountModel } from '../../../models/account/account'
import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
-import { UserModel } from '../../../models/account/user'
+import { UserModel } from '../../../models/user/user'
import { VideoModel } from '../../../models/video/video'
import { VideoImportModel } from '../../../models/video/video-import'
diff --git a/server/controllers/api/users/my-blocklist.ts b/server/controllers/api/users/my-blocklist.ts
index faaef3ac04..a1561b751b 100644
--- a/server/controllers/api/users/my-blocklist.ts
+++ b/server/controllers/api/users/my-blocklist.ts
@@ -20,7 +20,7 @@ import {
import { AccountBlocklistModel } from '../../../models/account/account-blocklist'
import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../../../lib/blocklist'
import { ServerBlocklistModel } from '../../../models/server/server-blocklist'
-import { UserNotificationModel } from '@server/models/account/user-notification'
+import { UserNotificationModel } from '@server/models/user/user-notification'
import { logger } from '@server/helpers/logger'
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
diff --git a/server/controllers/api/users/my-history.ts b/server/controllers/api/users/my-history.ts
index 72c7da3739..cff1697ab7 100644
--- a/server/controllers/api/users/my-history.ts
+++ b/server/controllers/api/users/my-history.ts
@@ -9,7 +9,7 @@ import {
userHistoryRemoveValidator
} from '../../../middlewares'
import { getFormattedObjects } from '../../../helpers/utils'
-import { UserVideoHistoryModel } from '../../../models/account/user-video-history'
+import { UserVideoHistoryModel } from '../../../models/user/user-video-history'
import { sequelizeTypescript } from '../../../initializers/database'
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
diff --git a/server/controllers/api/users/my-notifications.ts b/server/controllers/api/users/my-notifications.ts
index 0a9101a46d..2909770dae 100644
--- a/server/controllers/api/users/my-notifications.ts
+++ b/server/controllers/api/users/my-notifications.ts
@@ -1,5 +1,9 @@
-import * as express from 'express'
import 'multer'
+import * as express from 'express'
+import { UserNotificationModel } from '@server/models/user/user-notification'
+import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
+import { UserNotificationSetting } from '../../../../shared/models/users'
+import { getFormattedObjects } from '../../../helpers/utils'
import {
asyncMiddleware,
asyncRetryTransactionMiddleware,
@@ -9,17 +13,13 @@ import {
setDefaultSort,
userNotificationsSortValidator
} from '../../../middlewares'
-import { getFormattedObjects } from '../../../helpers/utils'
-import { UserNotificationModel } from '../../../models/account/user-notification'
-import { meRouter } from './me'
import {
listUserNotificationsValidator,
markAsReadUserNotificationsValidator,
updateNotificationSettingsValidator
} from '../../../middlewares/validators/user-notifications'
-import { UserNotificationSetting } from '../../../../shared/models/users'
-import { UserNotificationSettingModel } from '../../../models/account/user-notification-setting'
-import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
+import { UserNotificationSettingModel } from '../../../models/user/user-notification-setting'
+import { meRouter } from './me'
const myNotificationsRouter = express.Router()
diff --git a/server/controllers/api/users/my-subscriptions.ts b/server/controllers/api/users/my-subscriptions.ts
index 56b93276fd..46a73d49e7 100644
--- a/server/controllers/api/users/my-subscriptions.ts
+++ b/server/controllers/api/users/my-subscriptions.ts
@@ -27,7 +27,7 @@ import {
userSubscriptionsSortValidator,
videosSortValidator
} from '../../../middlewares/validators'
-import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
+import { ActorFollowModel } from '../../../models/actor/actor-follow'
import { VideoModel } from '../../../models/video/video'
const mySubscriptionsRouter = express.Router()
diff --git a/server/controllers/api/videos/watching.ts b/server/controllers/api/videos/watching.ts
index 627f12aa9d..08190e5833 100644
--- a/server/controllers/api/videos/watching.ts
+++ b/server/controllers/api/videos/watching.ts
@@ -1,7 +1,7 @@
import * as express from 'express'
import { UserWatchingVideo } from '../../../../shared'
import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoWatchingValidator } from '../../../middlewares'
-import { UserVideoHistoryModel } from '../../../models/account/user-video-history'
+import { UserVideoHistoryModel } from '../../../models/user/user-video-history'
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
const watchingRouter = express.Router()
diff --git a/server/controllers/lazy-static.ts b/server/controllers/lazy-static.ts
index 6f71fdb164..25d3b49b46 100644
--- a/server/controllers/lazy-static.ts
+++ b/server/controllers/lazy-static.ts
@@ -7,7 +7,7 @@ import { LAZY_STATIC_PATHS, STATIC_MAX_AGE } from '../initializers/constants'
import { actorImagePathUnsafeCache, pushActorImageProcessInQueue } from '../lib/actor-image'
import { VideosCaptionCache, VideosPreviewCache } from '../lib/files-cache'
import { asyncMiddleware } from '../middlewares'
-import { ActorImageModel } from '../models/account/actor-image'
+import { ActorImageModel } from '../models/actor/actor-image'
const lazyStaticRouter = express.Router()
diff --git a/server/controllers/static.ts b/server/controllers/static.ts
index 5cf4e9575d..97c48b1d74 100644
--- a/server/controllers/static.ts
+++ b/server/controllers/static.ts
@@ -20,7 +20,7 @@ import {
import { getThemeOrDefault } from '../lib/plugins/theme-utils'
import { asyncMiddleware } from '../middlewares'
import { cacheRoute } from '../middlewares/cache'
-import { UserModel } from '../models/account/user'
+import { UserModel } from '../models/user/user'
import { VideoModel } from '../models/video/video'
import { VideoCommentModel } from '../models/video/video-comment'
diff --git a/server/helpers/actor.ts b/server/helpers/actor.ts
index a60d3ed5d0..5f742505ba 100644
--- a/server/helpers/actor.ts
+++ b/server/helpers/actor.ts
@@ -1,5 +1,5 @@
-import { ActorModel } from '../models/activitypub/actor'
+import { ActorModel } from '../models/actor/actor'
import { MActorAccountChannelId, MActorFull } from '../types/models'
type ActorFetchByUrlType = 'all' | 'association-ids'
diff --git a/server/helpers/middlewares/accounts.ts b/server/helpers/middlewares/accounts.ts
index 13ae6cdf4d..5addd3e1a2 100644
--- a/server/helpers/middlewares/accounts.ts
+++ b/server/helpers/middlewares/accounts.ts
@@ -1,5 +1,5 @@
import { Response } from 'express'
-import { UserModel } from '@server/models/account/user'
+import { UserModel } from '@server/models/user/user'
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
import { AccountModel } from '../../models/account/account'
import { MAccountDefault } from '../../types/models'
diff --git a/server/helpers/signup.ts b/server/helpers/signup.ts
index ed872539b1..8fa81e601d 100644
--- a/server/helpers/signup.ts
+++ b/server/helpers/signup.ts
@@ -1,4 +1,4 @@
-import { UserModel } from '../models/account/user'
+import { UserModel } from '../models/user/user'
import * as ipaddr from 'ipaddr.js'
import { CONFIG } from '../initializers/config'
diff --git a/server/helpers/webfinger.ts b/server/helpers/webfinger.ts
index da7e880778..33367f6517 100644
--- a/server/helpers/webfinger.ts
+++ b/server/helpers/webfinger.ts
@@ -1,10 +1,10 @@
import * as WebFinger from 'webfinger.js'
import { WebFingerData } from '../../shared'
-import { ActorModel } from '../models/activitypub/actor'
-import { isTestInstance } from './core-utils'
-import { isActivityPubUrlValid } from './custom-validators/activitypub/misc'
import { WEBSERVER } from '../initializers/constants'
+import { ActorModel } from '../models/actor/actor'
import { MActorFull } from '../types/models'
+import { isTestInstance } from './core-utils'
+import { isActivityPubUrlValid } from './custom-validators/activitypub/misc'
const webfinger = new WebFinger({
webfist_fallback: false,
diff --git a/server/initializers/checker-after-init.ts b/server/initializers/checker-after-init.ts
index a93c8b7fd3..911734fa00 100644
--- a/server/initializers/checker-after-init.ts
+++ b/server/initializers/checker-after-init.ts
@@ -7,7 +7,7 @@ import { RecentlyAddedStrategy } from '../../shared/models/redundancy'
import { isProdInstance, isTestInstance, parseSemVersion } from '../helpers/core-utils'
import { isArray } from '../helpers/custom-validators/misc'
import { logger } from '../helpers/logger'
-import { UserModel } from '../models/account/user'
+import { UserModel } from '../models/user/user'
import { ApplicationModel, getServerActor } from '../models/application/application'
import { OAuthClientModel } from '../models/oauth/oauth-client'
import { CONFIG, isEmailEnabled } from './config'
diff --git a/server/initializers/database.ts b/server/initializers/database.ts
index edf12bc413..75a13ec8b0 100644
--- a/server/initializers/database.ts
+++ b/server/initializers/database.ts
@@ -2,6 +2,9 @@ import { QueryTypes, Transaction } from 'sequelize'
import { Sequelize as SequelizeTypescript } from 'sequelize-typescript'
import { TrackerModel } from '@server/models/server/tracker'
import { VideoTrackerModel } from '@server/models/server/video-tracker'
+import { UserModel } from '@server/models/user/user'
+import { UserNotificationModel } from '@server/models/user/user-notification'
+import { UserVideoHistoryModel } from '@server/models/user/user-video-history'
import { isTestInstance } from '../helpers/core-utils'
import { logger } from '../helpers/logger'
import { AbuseModel } from '../models/abuse/abuse'
@@ -11,13 +14,9 @@ import { VideoCommentAbuseModel } from '../models/abuse/video-comment-abuse'
import { AccountModel } from '../models/account/account'
import { AccountBlocklistModel } from '../models/account/account-blocklist'
import { AccountVideoRateModel } from '../models/account/account-video-rate'
-import { ActorImageModel } from '../models/account/actor-image'
-import { UserModel } from '../models/account/user'
-import { UserNotificationModel } from '../models/account/user-notification'
-import { UserNotificationSettingModel } from '../models/account/user-notification-setting'
-import { UserVideoHistoryModel } from '../models/account/user-video-history'
-import { ActorModel } from '../models/activitypub/actor'
-import { ActorFollowModel } from '../models/activitypub/actor-follow'
+import { ActorModel } from '../models/actor/actor'
+import { ActorFollowModel } from '../models/actor/actor-follow'
+import { ActorImageModel } from '../models/actor/actor-image'
import { ApplicationModel } from '../models/application/application'
import { OAuthClientModel } from '../models/oauth/oauth-client'
import { OAuthTokenModel } from '../models/oauth/oauth-token'
@@ -25,6 +24,7 @@ import { VideoRedundancyModel } from '../models/redundancy/video-redundancy'
import { PluginModel } from '../models/server/plugin'
import { ServerModel } from '../models/server/server'
import { ServerBlocklistModel } from '../models/server/server-blocklist'
+import { UserNotificationSettingModel } from '../models/user/user-notification-setting'
import { ScheduleVideoUpdateModel } from '../models/video/schedule-video-update'
import { TagModel } from '../models/video/tag'
import { ThumbnailModel } from '../models/video/thumbnail'
diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts
index 8dcff64e27..676f886533 100644
--- a/server/initializers/installer.ts
+++ b/server/initializers/installer.ts
@@ -2,7 +2,7 @@ import * as passwordGenerator from 'password-generator'
import { UserRole } from '../../shared'
import { logger } from '../helpers/logger'
import { createApplicationActor, createUserAccountAndChannelAndPlaylist } from '../lib/user'
-import { UserModel } from '../models/account/user'
+import { UserModel } from '../models/user/user'
import { ApplicationModel } from '../models/application/application'
import { OAuthClientModel } from '../models/oauth/oauth-client'
import { applicationExist, clientsExist, usersExist } from './checker-after-init'
diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts
index 5fe7381c97..8865b62770 100644
--- a/server/lib/activitypub/actor.ts
+++ b/server/lib/activitypub/actor.ts
@@ -20,8 +20,8 @@ import { getUrlFromWebfinger } from '../../helpers/webfinger'
import { MIMETYPES, WEBSERVER } from '../../initializers/constants'
import { sequelizeTypescript } from '../../initializers/database'
import { AccountModel } from '../../models/account/account'
-import { ActorImageModel } from '../../models/account/actor-image'
-import { ActorModel } from '../../models/activitypub/actor'
+import { ActorModel } from '../../models/actor/actor'
+import { ActorImageModel } from '../../models/actor/actor-image'
import { ServerModel } from '../../models/server/server'
import { VideoChannelModel } from '../../models/video/video-channel'
import {
diff --git a/server/lib/activitypub/audience.ts b/server/lib/activitypub/audience.ts
index 2986714d30..d0558f1917 100644
--- a/server/lib/activitypub/audience.ts
+++ b/server/lib/activitypub/audience.ts
@@ -1,7 +1,7 @@
import { Transaction } from 'sequelize'
import { ActivityAudience } from '../../../shared/models/activitypub'
import { ACTIVITY_PUB } from '../../initializers/constants'
-import { ActorModel } from '../../models/activitypub/actor'
+import { ActorModel } from '../../models/actor/actor'
import { VideoModel } from '../../models/video/video'
import { VideoShareModel } from '../../models/video/video-share'
import { MActorFollowersUrl, MActorLight, MActorUrl, MCommentOwner, MCommentOwnerVideo, MVideoId } from '../../types/models'
diff --git a/server/lib/activitypub/process/process-accept.ts b/server/lib/activitypub/process/process-accept.ts
index 1799829f8b..8ad470cf41 100644
--- a/server/lib/activitypub/process/process-accept.ts
+++ b/server/lib/activitypub/process/process-accept.ts
@@ -1,8 +1,8 @@
import { ActivityAccept } from '../../../../shared/models/activitypub'
-import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
-import { addFetchOutboxJob } from '../actor'
+import { ActorFollowModel } from '../../../models/actor/actor-follow'
import { APProcessorOptions } from '../../../types/activitypub-processor.model'
import { MActorDefault, MActorSignature } from '../../../types/models'
+import { addFetchOutboxJob } from '../actor'
async function processAcceptActivity (options: APProcessorOptions<ActivityAccept>) {
const { byActor: targetActor, inboxActor } = options
diff --git a/server/lib/activitypub/process/process-delete.ts b/server/lib/activitypub/process/process-delete.ts
index 88a9683180..20214246c3 100644
--- a/server/lib/activitypub/process/process-delete.ts
+++ b/server/lib/activitypub/process/process-delete.ts
@@ -2,7 +2,7 @@ import { ActivityDelete } from '../../../../shared/models/activitypub'
import { retryTransactionWrapper } from '../../../helpers/database-utils'
import { logger } from '../../../helpers/logger'
import { sequelizeTypescript } from '../../../initializers/database'
-import { ActorModel } from '../../../models/activitypub/actor'
+import { ActorModel } from '../../../models/actor/actor'
import { VideoModel } from '../../../models/video/video'
import { VideoCommentModel } from '../../../models/video/video-comment'
import { VideoPlaylistModel } from '../../../models/video/video-playlist'
diff --git a/server/lib/activitypub/process/process-follow.ts b/server/lib/activitypub/process/process-follow.ts
index 38d684512e..9009c64696 100644
--- a/server/lib/activitypub/process/process-follow.ts
+++ b/server/lib/activitypub/process/process-follow.ts
@@ -1,17 +1,17 @@
+import { getServerActor } from '@server/models/application/application'
import { ActivityFollow } from '../../../../shared/models/activitypub'
+import { getAPId } from '../../../helpers/activitypub'
import { retryTransactionWrapper } from '../../../helpers/database-utils'
import { logger } from '../../../helpers/logger'
-import { sequelizeTypescript } from '../../../initializers/database'
-import { ActorModel } from '../../../models/activitypub/actor'
-import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
-import { sendAccept, sendReject } from '../send'
-import { Notifier } from '../../notifier'
-import { getAPId } from '../../../helpers/activitypub'
import { CONFIG } from '../../../initializers/config'
+import { sequelizeTypescript } from '../../../initializers/database'
+import { ActorModel } from '../../../models/actor/actor'
+import { ActorFollowModel } from '../../../models/actor/actor-follow'
import { APProcessorOptions } from '../../../types/activitypub-processor.model'
import { MActorFollowActors, MActorSignature } from '../../../types/models'
+import { Notifier } from '../../notifier'
import { autoFollowBackIfNeeded } from '../follow'
-import { getServerActor } from '@server/models/application/application'
+import { sendAccept, sendReject } from '../send'
async function processFollowActivity (options: APProcessorOptions<ActivityFollow>) {
const { activity, byActor } = options
diff --git a/server/lib/activitypub/process/process-reject.ts b/server/lib/activitypub/process/process-reject.ts
index 03b669fd99..7f7ab305fd 100644
--- a/server/lib/activitypub/process/process-reject.ts
+++ b/server/lib/activitypub/process/process-reject.ts
@@ -1,6 +1,6 @@
import { ActivityReject } from '../../../../shared/models/activitypub/activity'
import { sequelizeTypescript } from '../../../initializers/database'
-import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
+import { ActorFollowModel } from '../../../models/actor/actor-follow'
import { APProcessorOptions } from '../../../types/activitypub-processor.model'
import { MActor } from '../../../types/models'
diff --git a/server/lib/activitypub/process/process-undo.ts b/server/lib/activitypub/process/process-undo.ts
index e520c2f0d2..9f031b5287 100644
--- a/server/lib/activitypub/process/process-undo.ts
+++ b/server/lib/activitypub/process/process-undo.ts
@@ -4,8 +4,8 @@ import { retryTransactionWrapper } from '../../../helpers/database-utils'
import { logger } from '../../../helpers/logger'
import { sequelizeTypescript } from '../../../initializers/database'
import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
-import { ActorModel } from '../../../models/activitypub/actor'
-import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
+import { ActorModel } from '../../../models/actor/actor'
+import { ActorFollowModel } from '../../../models/actor/actor-follow'
import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy'
import { VideoShareModel } from '../../../models/video/video-share'
import { APProcessorOptions } from '../../../types/activitypub-processor.model'
diff --git a/server/lib/activitypub/process/process-update.ts b/server/lib/activitypub/process/process-update.ts
index 6df9b93b23..6cd9d0fbae 100644
--- a/server/lib/activitypub/process/process-update.ts
+++ b/server/lib/activitypub/process/process-update.ts
@@ -1,23 +1,23 @@
+import { isRedundancyAccepted } from '@server/lib/redundancy'
+import { ActorImageType } from '@shared/models'
import { ActivityUpdate, CacheFileObject, VideoObject } from '../../../../shared/models/activitypub'
import { ActivityPubActor } from '../../../../shared/models/activitypub/activitypub-actor'
+import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object'
+import { isCacheFileObjectValid } from '../../../helpers/custom-validators/activitypub/cache-file'
+import { sanitizeAndCheckVideoTorrentObject } from '../../../helpers/custom-validators/activitypub/videos'
import { resetSequelizeInstance, retryTransactionWrapper } from '../../../helpers/database-utils'
import { logger } from '../../../helpers/logger'
import { sequelizeTypescript } from '../../../initializers/database'
import { AccountModel } from '../../../models/account/account'
-import { ActorModel } from '../../../models/activitypub/actor'
+import { ActorModel } from '../../../models/actor/actor'
import { VideoChannelModel } from '../../../models/video/video-channel'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MAccountIdActor, MActorSignature } from '../../../types/models'
import { getImageInfoIfExists, updateActorImageInstance, updateActorInstance } from '../actor'
-import { getOrCreateVideoAndAccountAndChannel, getOrCreateVideoChannelFromVideoObject, updateVideoFromAP } from '../videos'
-import { sanitizeAndCheckVideoTorrentObject } from '../../../helpers/custom-validators/activitypub/videos'
-import { isCacheFileObjectValid } from '../../../helpers/custom-validators/activitypub/cache-file'
import { createOrUpdateCacheFile } from '../cache-file'
-import { forwardVideoRelatedActivity } from '../send/utils'
-import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object'
import { createOrUpdateVideoPlaylist } from '../playlist'
-import { APProcessorOptions } from '../../../types/activitypub-processor.model'
-import { MActorSignature, MAccountIdActor } from '../../../types/models'
-import { isRedundancyAccepted } from '@server/lib/redundancy'
-import { ActorImageType } from '@shared/models'
+import { forwardVideoRelatedActivity } from '../send/utils'
+import { getOrCreateVideoAndAccountAndChannel, getOrCreateVideoChannelFromVideoObject, updateVideoFromAP } from '../videos'
async function processUpdateActivity (options: APProcessorOptions<ActivityUpdate>) {
const { activity, byActor } = options
diff --git a/server/lib/activitypub/send/send-delete.ts b/server/lib/activitypub/send/send-delete.ts
index e0acced183..d31f8c10ba 100644
--- a/server/lib/activitypub/send/send-delete.ts
+++ b/server/lib/activitypub/send/send-delete.ts
@@ -2,7 +2,7 @@ import { Transaction } from 'sequelize'
import { getServerActor } from '@server/models/application/application'
import { ActivityAudience, ActivityDelete } from '../../../../shared/models/activitypub'
import { logger } from '../../../helpers/logger'
-import { ActorModel } from '../../../models/activitypub/actor'
+import { ActorModel } from '../../../models/actor/actor'
import { VideoCommentModel } from '../../../models/video/video-comment'
import { VideoShareModel } from '../../../models/video/video-share'
import { MActorUrl } from '../../../types/models'
diff --git a/server/lib/activitypub/send/send-view.ts b/server/lib/activitypub/send/send-view.ts
index 9254dc7c58..153e942959 100644
--- a/server/lib/activitypub/send/send-view.ts
+++ b/server/lib/activitypub/send/send-view.ts
@@ -2,7 +2,7 @@ import { Transaction } from 'sequelize'
import { MActorAudience, MVideoImmutable, MVideoUrl } from '@server/types/models'
import { ActivityAudience, ActivityView } from '../../../../shared/models/activitypub'
import { logger } from '../../../helpers/logger'
-import { ActorModel } from '../../../models/activitypub/actor'
+import { ActorModel } from '../../../models/actor/actor'
import { audiencify, getAudience } from '../audience'
import { getLocalVideoViewActivityPubUrl } from '../url'
import { sendVideoRelatedActivity } from './utils'
diff --git a/server/lib/activitypub/send/utils.ts b/server/lib/activitypub/send/utils.ts
index 85a9f009d9..db0e91b717 100644
--- a/server/lib/activitypub/send/utils.ts
+++ b/server/lib/activitypub/send/utils.ts
@@ -1,14 +1,14 @@
import { Transaction } from 'sequelize'
+import { getServerActor } from '@server/models/application/application'
+import { ContextType } from '@shared/models/activitypub/context'
import { Activity, ActivityAudience } from '../../../../shared/models/activitypub'
+import { afterCommitIfTransaction } from '../../../helpers/database-utils'
import { logger } from '../../../helpers/logger'
-import { ActorModel } from '../../../models/activitypub/actor'
-import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
+import { ActorModel } from '../../../models/actor/actor'
+import { ActorFollowModel } from '../../../models/actor/actor-follow'
+import { MActor, MActorId, MActorLight, MActorWithInboxes, MVideoAccountLight, MVideoId, MVideoImmutable } from '../../../types/models'
import { JobQueue } from '../../job-queue'
import { getActorsInvolvedInVideo, getAudienceFromFollowersOf, getRemoteVideoAudience } from '../audience'
-import { afterCommitIfTransaction } from '../../../helpers/database-utils'
-import { MActor, MActorId, MActorLight, MActorWithInboxes, MVideoAccountLight, MVideoId, MVideoImmutable } from '../../../types/models'
-import { getServerActor } from '@server/models/application/application'
-import { ContextType } from '@shared/models/activitypub/context'
async function sendVideoRelatedActivity (activityBuilder: (audience: ActivityAudience) => Activity, options: {
byActor: MActorLight
diff --git a/server/lib/auth/oauth-model.ts b/server/lib/auth/oauth-model.ts
index b9c69eb2db..ae728d080b 100644
--- a/server/lib/auth/oauth-model.ts
+++ b/server/lib/auth/oauth-model.ts
@@ -1,7 +1,7 @@
import * as express from 'express'
import { AccessDeniedError } from 'oauth2-server'
import { PluginManager } from '@server/lib/plugins/plugin-manager'
-import { ActorModel } from '@server/models/activitypub/actor'
+import { ActorModel } from '@server/models/actor/actor'
import { MOAuthClient } from '@server/types/models'
import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
import { MUser } from '@server/types/models/user/user'
@@ -9,7 +9,7 @@ import { UserAdminFlag } from '@shared/models/users/user-flag.model'
import { UserRole } from '@shared/models/users/user-role'
import { logger } from '../../helpers/logger'
import { CONFIG } from '../../initializers/config'
-import { UserModel } from '../../models/account/user'
+import { UserModel } from '../../models/user/user'
import { OAuthClientModel } from '../../models/oauth/oauth-client'
import { OAuthTokenModel } from '../../models/oauth/oauth-token'
import { createUserAccountAndChannelAndPlaylist } from '../user'
diff --git a/server/lib/job-queue/handlers/activitypub-follow.ts b/server/lib/job-queue/handlers/activitypub-follow.ts
index 82c95be800..ec8df89697 100644
--- a/server/lib/job-queue/handlers/activitypub-follow.ts
+++ b/server/lib/job-queue/handlers/activitypub-follow.ts
@@ -1,18 +1,18 @@
import * as Bull from 'bull'
-import { logger } from '../../../helpers/logger'
-import { REMOTE_SCHEME, WEBSERVER } from '../../../initializers/constants'
-import { sendFollow } from '../../activitypub/send'
+import { getLocalActorFollowActivityPubUrl } from '@server/lib/activitypub/url'
+import { ActivitypubFollowPayload } from '@shared/models'
import { sanitizeHost } from '../../../helpers/core-utils'
-import { loadActorUrlOrGetFromWebfinger } from '../../../helpers/webfinger'
-import { getOrCreateActorAndServerAndModel } from '../../activitypub/actor'
import { retryTransactionWrapper } from '../../../helpers/database-utils'
-import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
-import { ActorModel } from '../../../models/activitypub/actor'
-import { Notifier } from '../../notifier'
+import { logger } from '../../../helpers/logger'
+import { loadActorUrlOrGetFromWebfinger } from '../../../helpers/webfinger'
+import { REMOTE_SCHEME, WEBSERVER } from '../../../initializers/constants'
import { sequelizeTypescript } from '../../../initializers/database'
+import { ActorModel } from '../../../models/actor/actor'
+import { ActorFollowModel } from '../../../models/actor/actor-follow'
import { MActor, MActorFollowActors, MActorFull } from '../../../types/models'
-import { ActivitypubFollowPayload } from '@shared/models'
-import { getLocalActorFollowActivityPubUrl } from '@server/lib/activitypub/url'
+import { getOrCreateActorAndServerAndModel } from '../../activitypub/actor'
+import { sendFollow } from '../../activitypub/send'
+import { Notifier } from '../../notifier'
async function processActivityPubFollow (job: Bull.Job) {
const payload = job.data as ActivitypubFollowPayload
diff --git a/server/lib/job-queue/handlers/activitypub-refresher.ts b/server/lib/job-queue/handlers/activitypub-refresher.ts
index 666e568684..c09b1bcc8f 100644
--- a/server/lib/job-queue/handlers/activitypub-refresher.ts
+++ b/server/lib/job-queue/handlers/activitypub-refresher.ts
@@ -1,12 +1,12 @@
import * as Bull from 'bull'
+import { refreshVideoPlaylistIfNeeded } from '@server/lib/activitypub/playlist'
+import { RefreshPayload } from '@shared/models'
import { logger } from '../../../helpers/logger'
import { fetchVideoByUrl } from '../../../helpers/video'
+import { ActorModel } from '../../../models/actor/actor'
+import { VideoPlaylistModel } from '../../../models/video/video-playlist'
import { refreshActorIfNeeded } from '../../activitypub/actor'
import { refreshVideoIfNeeded } from '../../activitypub/videos'
-import { ActorModel } from '../../../models/activitypub/actor'
-import { VideoPlaylistModel } from '../../../models/video/video-playlist'
-import { RefreshPayload } from '@shared/models'
-import { refreshVideoPlaylistIfNeeded } from '@server/lib/activitypub/playlist'
async function refreshAPObject (job: Bull.Job) {
const payload = job.data as RefreshPayload
diff --git a/server/lib/job-queue/handlers/actor-keys.ts b/server/lib/job-queue/handlers/actor-keys.ts
index 1253078438..3eef565d03 100644
--- a/server/lib/job-queue/handlers/actor-keys.ts
+++ b/server/lib/job-queue/handlers/actor-keys.ts
@@ -1,6 +1,6 @@
import * as Bull from 'bull'
import { generateAndSaveActorKeys } from '@server/lib/activitypub/actor'
-import { ActorModel } from '@server/models/activitypub/actor'
+import { ActorModel } from '@server/models/actor/actor'
import { ActorKeysPayload } from '@shared/models'
import { logger } from '../../../helpers/logger'
diff --git a/server/lib/job-queue/handlers/utils/activitypub-http-utils.ts b/server/lib/job-queue/handlers/utils/activitypub-http-utils.ts
index e8a91450de..37e7c1fad4 100644
--- a/server/lib/job-queue/handlers/utils/activitypub-http-utils.ts
+++ b/server/lib/job-queue/handlers/utils/activitypub-http-utils.ts
@@ -1,10 +1,10 @@
+import { buildDigest } from '@server/helpers/peertube-crypto'
+import { getServerActor } from '@server/models/application/application'
+import { ContextType } from '@shared/models/activitypub/context'
import { buildSignedActivity } from '../../../../helpers/activitypub'
-import { ActorModel } from '../../../../models/activitypub/actor'
import { ACTIVITY_PUB, HTTP_SIGNATURE } from '../../../../initializers/constants'
+import { ActorModel } from '../../../../models/actor/actor'
import { MActor } from '../../../../types/models'
-import { getServerActor } from '@server/models/application/application'
-import { buildDigest } from '@server/helpers/peertube-crypto'
-import { ContextType } from '@shared/models/activitypub/context'
type Payload <T> = { body: T, contextType?: ContextType, signatureActorId?: number }
diff --git a/server/lib/job-queue/handlers/video-file-import.ts b/server/lib/job-queue/handlers/video-file-import.ts
index 71f2cafcd7..8297a15716 100644
--- a/server/lib/job-queue/handlers/video-file-import.ts
+++ b/server/lib/job-queue/handlers/video-file-import.ts
@@ -3,7 +3,7 @@ import { copy, stat } from 'fs-extra'
import { extname } from 'path'
import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
import { generateVideoFilename, getVideoFilePath } from '@server/lib/video-paths'
-import { UserModel } from '@server/models/account/user'
+import { UserModel } from '@server/models/user/user'
import { MVideoFullLight } from '@server/types/models'
import { VideoFileImportPayload } from '@shared/models'
import { getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffprobe-utils'
diff --git a/server/lib/job-queue/handlers/video-transcoding.ts b/server/lib/job-queue/handlers/video-transcoding.ts
index e31bc82f55..8d659daa6f 100644
--- a/server/lib/job-queue/handlers/video-transcoding.ts
+++ b/server/lib/job-queue/handlers/video-transcoding.ts
@@ -2,7 +2,7 @@ import * as Bull from 'bull'
import { TranscodeOptionsType } from '@server/helpers/ffmpeg-utils'
import { getTranscodingJobPriority, publishAndFederateIfNeeded } from '@server/lib/video'
import { getVideoFilePath } from '@server/lib/video-paths'
-import { UserModel } from '@server/models/account/user'
+import { UserModel } from '@server/models/user/user'
import { MUser, MUserId, MVideoFullLight, MVideoUUID, MVideoWithFile } from '@server/types/models'
import {
HLSTranscodingPayload,
diff --git a/server/lib/live-manager.ts b/server/lib/live-manager.ts
index fe2a43f612..8e7fd55117 100644
--- a/server/lib/live-manager.ts
+++ b/server/lib/live-manager.ts
@@ -11,7 +11,7 @@ import { computeResolutionsToTranscode, getVideoFileFPS, getVideoFileResolution
import { logger } from '@server/helpers/logger'
import { CONFIG, registerConfigChangedHandler } from '@server/initializers/config'
import { MEMOIZE_TTL, P2P_MEDIA_LOADER_PEER_VERSION, VIDEO_LIVE, VIEW_LIFETIME, WEBSERVER } from '@server/initializers/constants'
-import { UserModel } from '@server/models/account/user'
+import { UserModel } from '@server/models/user/user'
import { VideoModel } from '@server/models/video/video'
import { VideoFileModel } from '@server/models/video/video-file'
import { VideoLiveModel } from '@server/models/video/video-live'
diff --git a/server/lib/moderation.ts b/server/lib/moderation.ts
index 925d64902a..d830860051 100644
--- a/server/lib/moderation.ts
+++ b/server/lib/moderation.ts
@@ -24,8 +24,8 @@ import { VideoObject } from '../../shared/models/activitypub/objects'
import { VideoCommentObject } from '../../shared/models/activitypub/objects/video-comment-object'
import { LiveVideoCreate, VideoCreate, VideoImportCreate } from '../../shared/models/videos'
import { VideoCommentCreate } from '../../shared/models/videos/video-comment.model'
-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 { VideoModel } from '../models/video/video'
import { VideoCommentModel } from '../models/video/video-comment'
import { sendAbuse } from './activitypub/send/send-flag'
diff --git a/server/lib/notifier.ts b/server/lib/notifier.ts
index da7f7cc050..1f9ff16df2 100644
--- a/server/lib/notifier.ts
+++ b/server/lib/notifier.ts
@@ -17,8 +17,8 @@ import { VideoPrivacy, VideoState } from '../../shared/models/videos'
import { logger } from '../helpers/logger'
import { CONFIG } from '../initializers/config'
import { AccountBlocklistModel } from '../models/account/account-blocklist'
-import { UserModel } from '../models/account/user'
-import { UserNotificationModel } from '../models/account/user-notification'
+import { UserModel } from '../models/user/user'
+import { UserNotificationModel } from '../models/user/user-notification'
import { MAbuseFull, MAbuseMessage, MAccountServer, MActorFollowFull, MApplication, MPlugin } from '../types/models'
import { MCommentOwnerVideo, MVideoAccountLight, MVideoFullLight } from '../types/models/video'
import { isBlockedByServerOrAccount } from './blocklist'
diff --git a/server/lib/plugins/plugin-helpers-builder.ts b/server/lib/plugins/plugin-helpers-builder.ts
index f1bc24d8b1..cb1cd4d9a2 100644
--- a/server/lib/plugins/plugin-helpers-builder.ts
+++ b/server/lib/plugins/plugin-helpers-builder.ts
@@ -17,7 +17,7 @@ import { VideoBlacklistCreate } from '@shared/models'
import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../blocklist'
import { getServerConfig } from '../config'
import { blacklistVideo, unblacklistVideo } from '../video-blacklist'
-import { UserModel } from '@server/models/account/user'
+import { UserModel } from '@server/models/user/user'
function buildPluginHelpers (pluginModel: MPlugin, npmName: string): PeerTubeHelpers {
const logger = buildPluginLogger(npmName)
diff --git a/server/lib/redundancy.ts b/server/lib/redundancy.ts
index da620b607a..2a92412491 100644
--- a/server/lib/redundancy.ts
+++ b/server/lib/redundancy.ts
@@ -1,12 +1,12 @@
-import { VideoRedundancyModel } from '../models/redundancy/video-redundancy'
-import { sendUndoCacheFile } from './activitypub/send'
import { Transaction } from 'sequelize'
-import { MActorSignature, MVideoRedundancyVideo } from '@server/types/models'
-import { CONFIG } from '@server/initializers/config'
import { logger } from '@server/helpers/logger'
-import { ActorFollowModel } from '@server/models/activitypub/actor-follow'
-import { Activity } from '@shared/models'
+import { CONFIG } from '@server/initializers/config'
+import { ActorFollowModel } from '@server/models/actor/actor-follow'
import { getServerActor } from '@server/models/application/application'
+import { MActorSignature, MVideoRedundancyVideo } from '@server/types/models'
+import { Activity } from '@shared/models'
+import { VideoRedundancyModel } from '../models/redundancy/video-redundancy'
+import { sendUndoCacheFile } from './activitypub/send'
async function removeVideoRedundancy (videoRedundancy: MVideoRedundancyVideo, t?: Transaction) {
const serverActor = await getServerActor()
diff --git a/server/lib/schedulers/actor-follow-scheduler.ts b/server/lib/schedulers/actor-follow-scheduler.ts
index 598c0211f4..1b80316e98 100644
--- a/server/lib/schedulers/actor-follow-scheduler.ts
+++ b/server/lib/schedulers/actor-follow-scheduler.ts
@@ -1,9 +1,9 @@
import { isTestInstance } from '../../helpers/core-utils'
import { logger } from '../../helpers/logger'
-import { ActorFollowModel } from '../../models/activitypub/actor-follow'
-import { AbstractScheduler } from './abstract-scheduler'
import { ACTOR_FOLLOW_SCORE, SCHEDULER_INTERVALS_MS } from '../../initializers/constants'
+import { ActorFollowModel } from '../../models/actor/actor-follow'
import { ActorFollowScoreCache } from '../files-cache'
+import { AbstractScheduler } from './abstract-scheduler'
export class ActorFollowScheduler extends AbstractScheduler {
diff --git a/server/lib/schedulers/auto-follow-index-instances.ts b/server/lib/schedulers/auto-follow-index-instances.ts
index 0b8cd13898..aaa5feed5f 100644
--- a/server/lib/schedulers/auto-follow-index-instances.ts
+++ b/server/lib/schedulers/auto-follow-index-instances.ts
@@ -1,7 +1,7 @@
import { chunk } from 'lodash'
import { doJSONRequest } from '@server/helpers/requests'
import { JobQueue } from '@server/lib/job-queue'
-import { ActorFollowModel } from '@server/models/activitypub/actor-follow'
+import { ActorFollowModel } from '@server/models/actor/actor-follow'
import { getServerActor } from '@server/models/application/application'
import { logger } from '../../helpers/logger'
import { CONFIG } from '../../initializers/config'
diff --git a/server/lib/schedulers/remove-old-history-scheduler.ts b/server/lib/schedulers/remove-old-history-scheduler.ts
index 17a42b2c4b..225669ea2a 100644
--- a/server/lib/schedulers/remove-old-history-scheduler.ts
+++ b/server/lib/schedulers/remove-old-history-scheduler.ts
@@ -1,7 +1,7 @@
import { logger } from '../../helpers/logger'
import { AbstractScheduler } from './abstract-scheduler'
import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'
-import { UserVideoHistoryModel } from '../../models/account/user-video-history'
+import { UserVideoHistoryModel } from '../../models/user/user-video-history'
import { CONFIG } from '../../initializers/config'
export class RemoveOldHistoryScheduler extends AbstractScheduler {
diff --git a/server/lib/stat-manager.ts b/server/lib/stat-manager.ts
index 09ba208bdd..25ed219274 100644
--- a/server/lib/stat-manager.ts
+++ b/server/lib/stat-manager.ts
@@ -1,6 +1,6 @@
import { CONFIG } from '@server/initializers/config'
-import { UserModel } from '@server/models/account/user'
-import { ActorFollowModel } from '@server/models/activitypub/actor-follow'
+import { UserModel } from '@server/models/user/user'
+import { ActorFollowModel } from '@server/models/actor/actor-follow'
import { VideoRedundancyModel } from '@server/models/redundancy/video-redundancy'
import { VideoModel } from '@server/models/video/video'
import { VideoChannelModel } from '@server/models/video/video-channel'
diff --git a/server/lib/user.ts b/server/lib/user.ts
index 9b0a0a2f11..8a6fcebc7b 100644
--- a/server/lib/user.ts
+++ b/server/lib/user.ts
@@ -1,14 +1,15 @@
import { Transaction } from 'sequelize/types'
import { v4 as uuidv4 } from 'uuid'
-import { UserModel } from '@server/models/account/user'
+import { UserModel } from '@server/models/user/user'
+import { MActorDefault } from '@server/types/models/actor'
import { ActivityPubActorType } from '../../shared/models/activitypub'
import { UserNotificationSetting, UserNotificationSettingValue } from '../../shared/models/users'
import { SERVER_ACTOR_NAME, WEBSERVER } from '../initializers/constants'
import { sequelizeTypescript } from '../initializers/database'
import { AccountModel } from '../models/account/account'
-import { UserNotificationSettingModel } from '../models/account/user-notification-setting'
-import { ActorModel } from '../models/activitypub/actor'
-import { MAccountDefault, MActorDefault, MChannelActor } from '../types/models'
+import { ActorModel } from '../models/actor/actor'
+import { UserNotificationSettingModel } from '../models/user/user-notification-setting'
+import { MAccountDefault, MChannelActor } from '../types/models'
import { MUser, MUserDefault, MUserId } from '../types/models/user'
import { buildActorInstance, generateAndSaveActorKeys } from './activitypub/actor'
import { getLocalAccountActivityPubUrl } from './activitypub/url'
diff --git a/server/middlewares/validators/follows.ts b/server/middlewares/validators/follows.ts
index bb849dc723..1d18de8cd9 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 0d0c8ccbf1..1823892b64 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 37119e2797..548d5df4df 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 2463d281cb..e881f0d3eb 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 a71422ed8d..c2dfccc96e 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'),
diff --git a/server/models/account/account-blocklist.ts b/server/models/account/account-blocklist.ts
index fe9168ab8a..9f3be22bdc 100644
--- a/server/models/account/account-blocklist.ts
+++ b/server/models/account/account-blocklist.ts
@@ -2,7 +2,7 @@ import { Op } from 'sequelize'
import { BelongsTo, Column, CreatedAt, ForeignKey, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript'
import { MAccountBlocklist, MAccountBlocklistAccounts, MAccountBlocklistFormattable } from '@server/types/models'
import { AccountBlock } from '../../../shared/models'
-import { ActorModel } from '../activitypub/actor'
+import { ActorModel } from '../actor/actor'
import { ServerModel } from '../server/server'
import { getSort, searchAttribute } from '../utils'
import { AccountModel } from './account'
diff --git a/server/models/account/account-video-rate.ts b/server/models/account/account-video-rate.ts
index 801f76bbae..576a445767 100644
--- a/server/models/account/account-video-rate.ts
+++ b/server/models/account/account-video-rate.ts
@@ -11,7 +11,7 @@ import { AccountVideoRate } from '../../../shared'
import { VideoRateType } from '../../../shared/models/videos'
import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
import { CONSTRAINTS_FIELDS, VIDEO_RATE_TYPES } from '../../initializers/constants'
-import { ActorModel } from '../activitypub/actor'
+import { ActorModel } from '../actor/actor'
import { buildLocalAccountIdsIn, getSort, throwIfNotValid } from '../utils'
import { VideoModel } from '../video/video'
import { ScopeNames as VideoChannelScopeNames, SummaryOptions, VideoChannelModel } from '../video/video-channel'
diff --git a/server/models/account/account.ts b/server/models/account/account.ts
index d33353af71..7b2af706d5 100644
--- a/server/models/account/account.ts
+++ b/server/models/account/account.ts
@@ -30,19 +30,19 @@ import {
MAccountSummaryFormattable,
MChannelActor
} from '../../types/models'
-import { ActorModel } from '../activitypub/actor'
-import { ActorFollowModel } from '../activitypub/actor-follow'
+import { ActorModel } from '../actor/actor'
+import { ActorFollowModel } from '../actor/actor-follow'
+import { ActorImageModel } from '../actor/actor-image'
import { ApplicationModel } from '../application/application'
-import { ActorImageModel } from './actor-image'
import { ServerModel } from '../server/server'
import { ServerBlocklistModel } from '../server/server-blocklist'
+import { UserModel } from '../user/user'
import { getSort, throwIfNotValid } from '../utils'
import { VideoModel } from '../video/video'
import { VideoChannelModel } from '../video/video-channel'
import { VideoCommentModel } from '../video/video-comment'
import { VideoPlaylistModel } from '../video/video-playlist'
import { AccountBlocklistModel } from './account-blocklist'
-import { UserModel } from './user'
export enum ScopeNames {
SUMMARY = 'SUMMARY'
diff --git a/server/models/activitypub/actor-follow.ts b/server/models/actor/actor-follow.ts
similarity index 100%
rename from server/models/activitypub/actor-follow.ts
rename to server/models/actor/actor-follow.ts
diff --git a/server/models/account/actor-image.ts b/server/models/actor/actor-image.ts
similarity index 100%
rename from server/models/account/actor-image.ts
rename to server/models/actor/actor-image.ts
diff --git a/server/models/activitypub/actor.ts b/server/models/actor/actor.ts
similarity index 99%
rename from server/models/activitypub/actor.ts
rename to server/models/actor/actor.ts
index 1af9efac2b..5cf6fb8f16 100644
--- a/server/models/activitypub/actor.ts
+++ b/server/models/actor/actor.ts
@@ -51,12 +51,12 @@ import {
MActorWithInboxes
} from '../../types/models'
import { AccountModel } from '../account/account'
-import { ActorImageModel } from '../account/actor-image'
import { ServerModel } from '../server/server'
import { isOutdated, throwIfNotValid } from '../utils'
import { VideoModel } from '../video/video'
import { VideoChannelModel } from '../video/video-channel'
import { ActorFollowModel } from './actor-follow'
+import { ActorImageModel } from './actor-image'
enum ScopeNames {
FULL = 'FULL'
diff --git a/server/models/oauth/oauth-token.ts b/server/models/oauth/oauth-token.ts
index 27e643aa71..aa512a985c 100644
--- a/server/models/oauth/oauth-token.ts
+++ b/server/models/oauth/oauth-token.ts
@@ -17,8 +17,8 @@ import { MUserAccountId } from '@server/types/models'
import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
import { logger } from '../../helpers/logger'
import { AccountModel } from '../account/account'
-import { UserModel } from '../account/user'
-import { ActorModel } from '../activitypub/actor'
+import { ActorModel } from '../actor/actor'
+import { UserModel } from '../user/user'
import { OAuthClientModel } from './oauth-client'
export type OAuthTokenInfo = {
diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts
index 53ebadeafb..b6538c8fd5 100644
--- a/server/models/redundancy/video-redundancy.ts
+++ b/server/models/redundancy/video-redundancy.ts
@@ -29,7 +29,7 @@ import { isActivityPubUrlValid, isUrlValid } from '../../helpers/custom-validato
import { logger } from '../../helpers/logger'
import { CONFIG } from '../../initializers/config'
import { CONSTRAINTS_FIELDS, MIMETYPES } from '../../initializers/constants'
-import { ActorModel } from '../activitypub/actor'
+import { ActorModel } from '../actor/actor'
import { ServerModel } from '../server/server'
import { getSort, getVideoSort, parseAggregateResult, throwIfNotValid } from '../utils'
import { ScheduleVideoUpdateModel } from '../video/schedule-video-update'
diff --git a/server/models/server/server.ts b/server/models/server/server.ts
index 0e58beeaf1..fb4c15d977 100644
--- a/server/models/server/server.ts
+++ b/server/models/server/server.ts
@@ -1,7 +1,7 @@
import { AllowNull, Column, CreatedAt, Default, HasMany, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'
import { MServer, MServerFormattable } from '@server/types/models/server'
import { isHostValid } from '../../helpers/custom-validators/servers'
-import { ActorModel } from '../activitypub/actor'
+import { ActorModel } from '../actor/actor'
import { throwIfNotValid } from '../utils'
import { ServerBlocklistModel } from './server-blocklist'
diff --git a/server/models/account/user-notification-setting.ts b/server/models/user/user-notification-setting.ts
similarity index 100%
rename from server/models/account/user-notification-setting.ts
rename to server/models/user/user-notification-setting.ts
diff --git a/server/models/account/user-notification.ts b/server/models/user/user-notification.ts
similarity index 98%
rename from server/models/account/user-notification.ts
rename to server/models/user/user-notification.ts
index 805095002d..f7f9ac867c 100644
--- a/server/models/account/user-notification.ts
+++ b/server/models/user/user-notification.ts
@@ -7,8 +7,10 @@ import { isUserNotificationTypeValid } from '../../helpers/custom-validators/use
import { AbuseModel } from '../abuse/abuse'
import { VideoAbuseModel } from '../abuse/video-abuse'
import { VideoCommentAbuseModel } from '../abuse/video-comment-abuse'
-import { ActorModel } from '../activitypub/actor'
-import { ActorFollowModel } from '../activitypub/actor-follow'
+import { AccountModel } from '../account/account'
+import { ActorModel } from '../actor/actor'
+import { ActorFollowModel } from '../actor/actor-follow'
+import { ActorImageModel } from '../actor/actor-image'
import { ApplicationModel } from '../application/application'
import { PluginModel } from '../server/plugin'
import { ServerModel } from '../server/server'
@@ -18,8 +20,6 @@ import { VideoBlacklistModel } from '../video/video-blacklist'
import { VideoChannelModel } from '../video/video-channel'
import { VideoCommentModel } from '../video/video-comment'
import { VideoImportModel } from '../video/video-import'
-import { AccountModel } from './account'
-import { ActorImageModel } from './actor-image'
import { UserModel } from './user'
enum ScopeNames {
diff --git a/server/models/account/user-video-history.ts b/server/models/user/user-video-history.ts
similarity index 100%
rename from server/models/account/user-video-history.ts
rename to server/models/user/user-video-history.ts
diff --git a/server/models/account/user.ts b/server/models/user/user.ts
similarity index 99%
rename from server/models/account/user.ts
rename to server/models/user/user.ts
index 513455773f..8d2564e546 100644
--- a/server/models/account/user.ts
+++ b/server/models/user/user.ts
@@ -60,8 +60,10 @@ import {
import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto'
import { DEFAULT_USER_THEME_NAME, NSFW_POLICY_TYPES } from '../../initializers/constants'
import { getThemeOrDefault } from '../../lib/plugins/theme-utils'
-import { ActorModel } from '../activitypub/actor'
-import { ActorFollowModel } from '../activitypub/actor-follow'
+import { AccountModel } from '../account/account'
+import { ActorModel } from '../actor/actor'
+import { ActorFollowModel } from '../actor/actor-follow'
+import { ActorImageModel } from '../actor/actor-image'
import { OAuthTokenModel } from '../oauth/oauth-token'
import { getSort, throwIfNotValid } from '../utils'
import { VideoModel } from '../video/video'
@@ -69,9 +71,7 @@ import { VideoChannelModel } from '../video/video-channel'
import { VideoImportModel } from '../video/video-import'
import { VideoLiveModel } from '../video/video-live'
import { VideoPlaylistModel } from '../video/video-playlist'
-import { AccountModel } from './account'
import { UserNotificationSettingModel } from './user-notification-setting'
-import { ActorImageModel } from './actor-image'
enum ScopeNames {
FOR_ME_API = 'FOR_ME_API',
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts
index 081b21f2d7..8e4b78723c 100644
--- a/server/models/video/video-channel.ts
+++ b/server/models/video/video-channel.ts
@@ -36,9 +36,9 @@ import {
MChannelSummaryFormattable
} from '../../types/models/video'
import { AccountModel, ScopeNames as AccountModelScopeNames, SummaryOptions as AccountSummaryOptions } from '../account/account'
-import { ActorImageModel } from '../account/actor-image'
-import { ActorModel, unusedActorAttributesForAPI } from '../activitypub/actor'
-import { ActorFollowModel } from '../activitypub/actor-follow'
+import { ActorModel, unusedActorAttributesForAPI } from '../actor/actor'
+import { ActorFollowModel } from '../actor/actor-follow'
+import { ActorImageModel } from '../actor/actor-image'
import { ServerModel } from '../server/server'
import { buildServerIdsFollowedBy, buildTrigramSearchIndex, createSimilarityAttribute, getSort, throwIfNotValid } from '../utils'
import { VideoModel } from './video'
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts
index 151c2bc81a..87c66dc9fd 100644
--- a/server/models/video/video-comment.ts
+++ b/server/models/video/video-comment.ts
@@ -39,7 +39,7 @@ import {
} from '../../types/models/video'
import { VideoCommentAbuseModel } from '../abuse/video-comment-abuse'
import { AccountModel } from '../account/account'
-import { ActorModel, unusedActorAttributesForAPI } from '../activitypub/actor'
+import { ActorModel, unusedActorAttributesForAPI } from '../actor/actor'
import {
buildBlockedAccountSQL,
buildBlockedAccountSQLOptimized,
diff --git a/server/models/video/video-import.ts b/server/models/video/video-import.ts
index 8324166ccd..d8f09e1e54 100644
--- a/server/models/video/video-import.ts
+++ b/server/models/video/video-import.ts
@@ -13,15 +13,15 @@ import {
Table,
UpdatedAt
} from 'sequelize-typescript'
+import { afterCommitIfTransaction } from '@server/helpers/database-utils'
import { MVideoImportDefault, MVideoImportFormattable } from '@server/types/models/video/video-import'
import { VideoImport, VideoImportState } from '../../../shared'
import { isVideoImportStateValid, isVideoImportTargetUrlValid } from '../../helpers/custom-validators/video-imports'
import { isVideoMagnetUriValid } from '../../helpers/custom-validators/videos'
import { CONSTRAINTS_FIELDS, VIDEO_IMPORT_STATES } from '../../initializers/constants'
-import { UserModel } from '../account/user'
+import { UserModel } from '../user/user'
import { getSort, throwIfNotValid } from '../utils'
import { ScopeNames as VideoModelScopeNames, VideoModel } from './video'
-import { afterCommitIfTransaction } from '@server/helpers/database-utils'
@DefaultScope(() => ({
include: [
diff --git a/server/models/video/video-playlist.ts b/server/models/video/video-playlist.ts
index efe5be36d2..b48dd29451 100644
--- a/server/models/video/video-playlist.ts
+++ b/server/models/video/video-playlist.ts
@@ -50,11 +50,11 @@ import {
MVideoPlaylistIdWithElements
} from '../../types/models/video/video-playlist'
import { AccountModel, ScopeNames as AccountScopeNames, SummaryOptions } from '../account/account'
+import { ActorModel } from '../actor/actor'
import { buildServerIdsFollowedBy, buildWhereIdOrUUID, getPlaylistSort, isOutdated, throwIfNotValid } from '../utils'
import { ThumbnailModel } from './thumbnail'
import { ScopeNames as VideoChannelScopeNames, VideoChannelModel } from './video-channel'
import { VideoPlaylistElementModel } from './video-playlist-element'
-import { ActorModel } from '../activitypub/actor'
enum ScopeNames {
AVAILABLE_FOR_LIST = 'AVAILABLE_FOR_LIST',
diff --git a/server/models/video/video-share.ts b/server/models/video/video-share.ts
index 5059c1fa69..99a24dbdf5 100644
--- a/server/models/video/video-share.ts
+++ b/server/models/video/video-share.ts
@@ -4,7 +4,7 @@ import { isActivityPubUrlValid } from '../../helpers/custom-validators/activityp
import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
import { MActorDefault } from '../../types/models'
import { MVideoShareActor, MVideoShareFull } from '../../types/models/video'
-import { ActorModel } from '../activitypub/actor'
+import { ActorModel } from '../actor/actor'
import { buildLocalActorIdsIn, throwIfNotValid } from '../utils'
import { VideoModel } from './video'
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 8c316e00c7..f8a099d9cd 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -100,14 +100,14 @@ import { MVideoFile, MVideoFileStreamingPlaylistVideo } from '../../types/models
import { VideoAbuseModel } from '../abuse/video-abuse'
import { AccountModel } from '../account/account'
import { AccountVideoRateModel } from '../account/account-video-rate'
-import { ActorImageModel } from '../account/actor-image'
-import { UserModel } from '../account/user'
-import { UserVideoHistoryModel } from '../account/user-video-history'
-import { ActorModel } from '../activitypub/actor'
+import { ActorModel } from '../actor/actor'
+import { ActorImageModel } from '../actor/actor-image'
import { VideoRedundancyModel } from '../redundancy/video-redundancy'
import { ServerModel } from '../server/server'
import { TrackerModel } from '../server/tracker'
import { VideoTrackerModel } from '../server/video-tracker'
+import { UserModel } from '../user/user'
+import { UserVideoHistoryModel } from '../user/user-video-history'
import { buildTrigramSearchIndex, buildWhereIdOrUUID, getVideoSort, isOutdated, throwIfNotValid } from '../utils'
import { ScheduleVideoUpdateModel } from './schedule-video-update'
import { TagModel } from './tag'
diff --git a/server/types/models/moderation/abuse-message.ts b/server/types/models/abuse/abuse-message.ts
similarity index 100%
rename from server/types/models/moderation/abuse-message.ts
rename to server/types/models/abuse/abuse-message.ts
diff --git a/server/types/models/moderation/abuse.ts b/server/types/models/abuse/abuse.ts
similarity index 100%
rename from server/types/models/moderation/abuse.ts
rename to server/types/models/abuse/abuse.ts
diff --git a/server/types/models/moderation/index.ts b/server/types/models/abuse/index.ts
similarity index 100%
rename from server/types/models/moderation/index.ts
rename to server/types/models/abuse/index.ts
diff --git a/server/types/models/account/account.ts b/server/types/models/account/account.ts
index 9513acad83..9848412919 100644
--- a/server/types/models/account/account.ts
+++ b/server/types/models/account/account.ts
@@ -1,7 +1,5 @@
import { FunctionProperties, PickWith } from '@shared/core-utils'
import { AccountModel } from '../../../models/account/account'
-import { MChannelDefault } from '../video/video-channels'
-import { MAccountBlocklistId } from './account-blocklist'
import {
MActor,
MActorAPAccount,
@@ -15,7 +13,9 @@ import {
MActorSummary,
MActorSummaryFormattable,
MActorUrl
-} from './actor'
+} from '../actor'
+import { MChannelDefault } from '../video/video-channels'
+import { MAccountBlocklistId } from './account-blocklist'
type Use<K extends keyof AccountModel, M> = PickWith<AccountModel, K, M>
diff --git a/server/types/models/account/index.ts b/server/types/models/account/index.ts
index e3fc00f940..dab2eea7e3 100644
--- a/server/types/models/account/index.ts
+++ b/server/types/models/account/index.ts
@@ -1,5 +1,2 @@
export * from './account'
export * from './account-blocklist'
-export * from './actor-follow'
-export * from './actor-image'
-export * from './actor'
diff --git a/server/types/models/account/actor-follow.ts b/server/types/models/actor/actor-follow.ts
similarity index 96%
rename from server/types/models/account/actor-follow.ts
rename to server/types/models/actor/actor-follow.ts
index 8e19c61408..98a6ca8a59 100644
--- a/server/types/models/account/actor-follow.ts
+++ b/server/types/models/actor/actor-follow.ts
@@ -1,5 +1,5 @@
import { PickWith } from '@shared/core-utils'
-import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
+import { ActorFollowModel } from '../../../models/actor/actor-follow'
import {
MActor,
MActorChannelAccountActor,
diff --git a/server/types/models/account/actor-image.ts b/server/types/models/actor/actor-image.ts
similarity index 83%
rename from server/types/models/account/actor-image.ts
rename to server/types/models/actor/actor-image.ts
index e59f8b141a..89adb01aee 100644
--- a/server/types/models/account/actor-image.ts
+++ b/server/types/models/actor/actor-image.ts
@@ -1,5 +1,5 @@
-import { ActorImageModel } from '../../../models/account/actor-image'
import { FunctionProperties } from '@shared/core-utils'
+import { ActorImageModel } from '../../../models/actor/actor-image'
export type MActorImage = ActorImageModel
diff --git a/server/types/models/account/actor.ts b/server/types/models/actor/actor.ts
similarity index 98%
rename from server/types/models/account/actor.ts
rename to server/types/models/actor/actor.ts
index 0b620872eb..b3a70cbcef 100644
--- a/server/types/models/account/actor.ts
+++ b/server/types/models/actor/actor.ts
@@ -1,9 +1,8 @@
-
import { FunctionProperties, PickWith, PickWithOpt } from '@shared/core-utils'
-import { ActorModel } from '../../../models/activitypub/actor'
+import { ActorModel } from '../../../models/actor/actor'
+import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from '../account'
import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server'
import { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video'
-import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account'
import { MActorImage, MActorImageFormattable } from './actor-image'
type Use<K extends keyof ActorModel, M> = PickWith<ActorModel, K, M>
diff --git a/server/types/models/actor/index.ts b/server/types/models/actor/index.ts
new file mode 100644
index 0000000000..b278152553
--- /dev/null
+++ b/server/types/models/actor/index.ts
@@ -0,0 +1,3 @@
+export * from './actor-follow'
+export * from './actor-image'
+export * from './actor'
diff --git a/server/types/models/index.ts b/server/types/models/index.ts
index b4fdb1ff33..704cb9844c 100644
--- a/server/types/models/index.ts
+++ b/server/types/models/index.ts
@@ -1,6 +1,7 @@
+export * from './abuse'
export * from './account'
+export * from './actor'
export * from './application'
-export * from './moderation'
export * from './oauth'
export * from './server'
export * from './user'
diff --git a/server/types/models/user/user-notification-setting.ts b/server/types/models/user/user-notification-setting.ts
index c674add1b7..d1db645e72 100644
--- a/server/types/models/user/user-notification-setting.ts
+++ b/server/types/models/user/user-notification-setting.ts
@@ -1,4 +1,4 @@
-import { UserNotificationSettingModel } from '@server/models/account/user-notification-setting'
+import { UserNotificationSettingModel } from '@server/models/user/user-notification-setting'
export type MNotificationSetting = Omit<UserNotificationSettingModel, 'User'>
diff --git a/server/types/models/user/user-notification.ts b/server/types/models/user/user-notification.ts
index 7ebb0485d1..918614dd1b 100644
--- a/server/types/models/user/user-notification.ts
+++ b/server/types/models/user/user-notification.ts
@@ -2,13 +2,13 @@ import { VideoAbuseModel } from '@server/models/abuse/video-abuse'
import { VideoCommentAbuseModel } from '@server/models/abuse/video-comment-abuse'
import { ApplicationModel } from '@server/models/application/application'
import { PluginModel } from '@server/models/server/plugin'
+import { UserNotificationModel } from '@server/models/user/user-notification'
import { PickWith, PickWithOpt } from '@shared/core-utils'
import { AbuseModel } from '../../../models/abuse/abuse'
import { AccountModel } from '../../../models/account/account'
-import { ActorImageModel } from '../../../models/account/actor-image'
-import { UserNotificationModel } from '../../../models/account/user-notification'
-import { ActorModel } from '../../../models/activitypub/actor'
-import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
+import { ActorModel } from '../../../models/actor/actor'
+import { ActorFollowModel } from '../../../models/actor/actor-follow'
+import { ActorImageModel } from '../../../models/actor/actor-image'
import { ServerModel } from '../../../models/server/server'
import { VideoModel } from '../../../models/video/video'
import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
diff --git a/server/types/models/user/user-video-history.ts b/server/types/models/user/user-video-history.ts
index 62673ab1bd..34e2930e7d 100644
--- a/server/types/models/user/user-video-history.ts
+++ b/server/types/models/user/user-video-history.ts
@@ -1,4 +1,4 @@
-import { UserVideoHistoryModel } from '../../../models/account/user-video-history'
+import { UserVideoHistoryModel } from '../../../models/user/user-video-history'
export type MUserVideoHistory = Omit<UserVideoHistoryModel, 'Video' | 'User'>
diff --git a/server/types/models/user/user.ts b/server/types/models/user/user.ts
index fa7de9c52e..f79220e115 100644
--- a/server/types/models/user/user.ts
+++ b/server/types/models/user/user.ts
@@ -1,7 +1,7 @@
import { AccountModel } from '@server/models/account/account'
+import { UserModel } from '@server/models/user/user'
import { MVideoPlaylist } from '@server/types/models'
import { PickWith, PickWithOpt } from '@shared/core-utils'
-import { UserModel } from '../../../models/account/user'
import {
MAccount,
MAccountDefault,
diff --git a/server/types/models/video/video-channels.ts b/server/types/models/video/video-channels.ts
index f577807ca4..c147567d95 100644
--- a/server/types/models/video/video-channels.ts
+++ b/server/types/models/video/video-channels.ts
@@ -9,7 +9,9 @@ import {
MAccountSummaryBlocks,
MAccountSummaryFormattable,
MAccountUrl,
- MAccountUserId,
+ MAccountUserId
+} from '../account'
+import {
MActor,
MActorAccountChannelId,
MActorAPChannel,
@@ -23,7 +25,7 @@ import {
MActorSummary,
MActorSummaryFormattable,
MActorUrl
-} from '../account'
+} from '../actor'
import { MVideo } from './video'
type Use<K extends keyof VideoChannelModel, M> = PickWith<VideoChannelModel, K, M>
diff --git a/server/types/models/video/video-share.ts b/server/types/models/video/video-share.ts
index b7a783bb6e..78f44e58cc 100644
--- a/server/types/models/video/video-share.ts
+++ b/server/types/models/video/video-share.ts
@@ -1,6 +1,6 @@
-import { VideoShareModel } from '../../../models/video/video-share'
import { PickWith } from '@shared/core-utils'
-import { MActorDefault } from '../account'
+import { VideoShareModel } from '../../../models/video/video-share'
+import { MActorDefault } from '../actor'
import { MVideo } from './video'
type Use<K extends keyof VideoShareModel, M> = PickWith<VideoShareModel, K, M>
diff --git a/server/types/plugins/register-server-option.model.ts b/server/types/plugins/register-server-option.model.ts
index 2432b7ac4e..8774bcd8c8 100644
--- a/server/types/plugins/register-server-option.model.ts
+++ b/server/types/plugins/register-server-option.model.ts
@@ -1,6 +1,6 @@
-import { Router, Response } from 'express'
+import { Response, Router } from 'express'
import { Logger } from 'winston'
-import { ActorModel } from '@server/models/activitypub/actor'
+import { ActorModel } from '@server/models/actor/actor'
import {
PluginPlaylistPrivacyManager,
PluginSettingsManager,