Split types and typings
authorChocobozzz <me@florianbigard.com>
Thu, 18 Jun 2020 08:45:25 +0000 (10:45 +0200)
committerChocobozzz <me@florianbigard.com>
Thu, 18 Jun 2020 08:46:27 +0000 (10:46 +0200)
217 files changed:
server/controllers/activitypub/client.ts
server/controllers/activitypub/inbox.ts
server/controllers/activitypub/outbox.ts
server/controllers/api/search.ts
server/controllers/api/users/index.ts
server/controllers/api/video-channel.ts
server/controllers/api/video-playlist.ts
server/controllers/api/videos/abuse.ts
server/controllers/api/videos/captions.ts
server/controllers/api/videos/import.ts
server/controllers/api/videos/index.ts
server/controllers/api/videos/ownership.ts
server/controllers/static.ts
server/helpers/activitypub.ts
server/helpers/actor.ts
server/helpers/captions-utils.ts
server/helpers/custom-validators/video-ownership.ts
server/helpers/middlewares/accounts.ts
server/helpers/middlewares/video-captions.ts
server/helpers/middlewares/video-channels.ts
server/helpers/middlewares/video-playlists.ts
server/helpers/middlewares/videos.ts
server/helpers/peertube-crypto.ts
server/helpers/video.ts
server/helpers/webfinger.ts
server/helpers/webtorrent.ts
server/lib/activitypub/actor.ts
server/lib/activitypub/audience.ts
server/lib/activitypub/cache-file.ts
server/lib/activitypub/follow.ts
server/lib/activitypub/playlist.ts
server/lib/activitypub/process/process-accept.ts
server/lib/activitypub/process/process-announce.ts
server/lib/activitypub/process/process-create.ts
server/lib/activitypub/process/process-delete.ts
server/lib/activitypub/process/process-dislike.ts
server/lib/activitypub/process/process-flag.ts
server/lib/activitypub/process/process-follow.ts
server/lib/activitypub/process/process-like.ts
server/lib/activitypub/process/process-reject.ts
server/lib/activitypub/process/process-undo.ts
server/lib/activitypub/process/process-update.ts
server/lib/activitypub/process/process-view.ts
server/lib/activitypub/process/process.ts
server/lib/activitypub/send/send-accept.ts
server/lib/activitypub/send/send-announce.ts
server/lib/activitypub/send/send-create.ts
server/lib/activitypub/send/send-delete.ts
server/lib/activitypub/send/send-dislike.ts
server/lib/activitypub/send/send-flag.ts
server/lib/activitypub/send/send-follow.ts
server/lib/activitypub/send/send-like.ts
server/lib/activitypub/send/send-reject.ts
server/lib/activitypub/send/send-undo.ts
server/lib/activitypub/send/send-update.ts
server/lib/activitypub/send/send-view.ts
server/lib/activitypub/send/utils.ts
server/lib/activitypub/share.ts
server/lib/activitypub/url.ts
server/lib/activitypub/video-comments.ts
server/lib/activitypub/video-rates.ts
server/lib/activitypub/videos.ts
server/lib/avatar.ts
server/lib/blocklist.ts
server/lib/client-html.ts
server/lib/emailer.ts
server/lib/hls.ts
server/lib/job-queue/handlers/activitypub-follow.ts
server/lib/job-queue/handlers/activitypub-http-fetcher.ts
server/lib/job-queue/handlers/utils/activitypub-http-utils.ts
server/lib/job-queue/handlers/video-file-import.ts
server/lib/job-queue/handlers/video-import.ts
server/lib/job-queue/handlers/video-transcoding.ts
server/lib/moderation.ts
server/lib/notifier.ts
server/lib/oauth-model.ts
server/lib/peertube-socket.ts
server/lib/plugins/plugin-manager.ts
server/lib/redundancy.ts
server/lib/schedulers/update-videos-scheduler.ts
server/lib/schedulers/videos-redundancy-scheduler.ts
server/lib/thumbnail.ts
server/lib/user.ts
server/lib/video-blacklist.ts
server/lib/video-channel.ts
server/lib/video-comment.ts
server/lib/video-paths.ts
server/lib/video-playlist.ts
server/lib/video-transcoding.ts
server/middlewares/validators/follows.ts
server/middlewares/validators/users.ts
server/middlewares/validators/videos/video-channels.ts
server/middlewares/validators/videos/video-comments.ts
server/middlewares/validators/videos/video-playlists.ts
server/middlewares/validators/videos/videos.ts
server/models/account/account-blocklist.ts
server/models/account/account-video-rate.ts
server/models/account/account.ts
server/models/account/user-notification-setting.ts
server/models/account/user-notification.ts
server/models/account/user-video-history.ts
server/models/account/user.ts
server/models/activitypub/actor-follow.ts
server/models/activitypub/actor.ts
server/models/avatar/avatar.ts
server/models/oauth/oauth-token.ts
server/models/redundancy/video-redundancy.ts
server/models/server/plugin.ts
server/models/server/server-blocklist.ts
server/models/server/server.ts
server/models/video/schedule-video-update.ts
server/models/video/tag.ts
server/models/video/thumbnail.ts
server/models/video/video-abuse.ts
server/models/video/video-blacklist.ts
server/models/video/video-caption.ts
server/models/video/video-change-ownership.ts
server/models/video/video-channel.ts
server/models/video/video-comment.ts
server/models/video/video-file.ts
server/models/video/video-format-utils.ts
server/models/video/video-import.ts
server/models/video/video-playlist-element.ts
server/models/video/video-playlist.ts
server/models/video/video-query-builder.ts
server/models/video/video-share.ts
server/models/video/video-streaming-playlist.ts
server/models/video/video.ts
server/tools/tsconfig.json
server/types/activitypub-processor.model.ts [new file with mode: 0644]
server/types/models/account/account-blocklist.ts [new file with mode: 0644]
server/types/models/account/account.ts [new file with mode: 0644]
server/types/models/account/actor-follow.ts [new file with mode: 0644]
server/types/models/account/actor.ts [new file with mode: 0644]
server/types/models/account/avatar.ts [new file with mode: 0644]
server/types/models/account/index.ts [new file with mode: 0644]
server/types/models/index.ts [new file with mode: 0644]
server/types/models/oauth/index.ts [new file with mode: 0644]
server/types/models/oauth/oauth-client.ts [new file with mode: 0644]
server/types/models/oauth/oauth-token.ts [new file with mode: 0644]
server/types/models/server/index.ts [new file with mode: 0644]
server/types/models/server/plugin.ts [new file with mode: 0644]
server/types/models/server/server-blocklist.ts [new file with mode: 0644]
server/types/models/server/server.ts [new file with mode: 0644]
server/types/models/user/index.ts [new file with mode: 0644]
server/types/models/user/user-notification-setting.ts [new file with mode: 0644]
server/types/models/user/user-notification.ts [new file with mode: 0644]
server/types/models/user/user-video-history.ts [new file with mode: 0644]
server/types/models/user/user.ts [new file with mode: 0644]
server/types/models/video/index.ts [new file with mode: 0644]
server/types/models/video/schedule-video-update.ts [new file with mode: 0644]
server/types/models/video/tag.ts [new file with mode: 0644]
server/types/models/video/thumbnail.ts [new file with mode: 0644]
server/types/models/video/video-abuse.ts [new file with mode: 0644]
server/types/models/video/video-blacklist.ts [new file with mode: 0644]
server/types/models/video/video-caption.ts [new file with mode: 0644]
server/types/models/video/video-change-ownership.ts [new file with mode: 0644]
server/types/models/video/video-channels.ts [new file with mode: 0644]
server/types/models/video/video-comment.ts [new file with mode: 0644]
server/types/models/video/video-file.ts [new file with mode: 0644]
server/types/models/video/video-import.ts [new file with mode: 0644]
server/types/models/video/video-playlist-element.ts [new file with mode: 0644]
server/types/models/video/video-playlist.ts [new file with mode: 0644]
server/types/models/video/video-rate.ts [new file with mode: 0644]
server/types/models/video/video-redundancy.ts [new file with mode: 0644]
server/types/models/video/video-share.ts [new file with mode: 0644]
server/types/models/video/video-streaming-playlist.ts [new file with mode: 0644]
server/types/models/video/video.ts [new file with mode: 0644]
server/types/sequelize.ts [new file with mode: 0644]
server/types/utils.ts [new file with mode: 0644]
server/typings/activitypub-processor.model.ts [deleted file]
server/typings/express.d.ts [new file with mode: 0644]
server/typings/express.ts [deleted file]
server/typings/models/account/account-blocklist.ts [deleted file]
server/typings/models/account/account.ts [deleted file]
server/typings/models/account/actor-follow.ts [deleted file]
server/typings/models/account/actor.ts [deleted file]
server/typings/models/account/avatar.ts [deleted file]
server/typings/models/account/index.ts [deleted file]
server/typings/models/index.ts [deleted file]
server/typings/models/oauth/index.ts [deleted file]
server/typings/models/oauth/oauth-client.ts [deleted file]
server/typings/models/oauth/oauth-token.ts [deleted file]
server/typings/models/server/index.ts [deleted file]
server/typings/models/server/plugin.ts [deleted file]
server/typings/models/server/server-blocklist.ts [deleted file]
server/typings/models/server/server.ts [deleted file]
server/typings/models/user/index.ts [deleted file]
server/typings/models/user/user-notification-setting.ts [deleted file]
server/typings/models/user/user-notification.ts [deleted file]
server/typings/models/user/user-video-history.ts [deleted file]
server/typings/models/user/user.ts [deleted file]
server/typings/models/video/index.ts [deleted file]
server/typings/models/video/schedule-video-update.ts [deleted file]
server/typings/models/video/tag.ts [deleted file]
server/typings/models/video/thumbnail.ts [deleted file]
server/typings/models/video/video-abuse.ts [deleted file]
server/typings/models/video/video-blacklist.ts [deleted file]
server/typings/models/video/video-caption.ts [deleted file]
server/typings/models/video/video-change-ownership.ts [deleted file]
server/typings/models/video/video-channels.ts [deleted file]
server/typings/models/video/video-comment.ts [deleted file]
server/typings/models/video/video-file.ts [deleted file]
server/typings/models/video/video-import.ts [deleted file]
server/typings/models/video/video-playlist-element.ts [deleted file]
server/typings/models/video/video-playlist.ts [deleted file]
server/typings/models/video/video-rate.ts [deleted file]
server/typings/models/video/video-redundancy.ts [deleted file]
server/typings/models/video/video-share.ts [deleted file]
server/typings/models/video/video-streaming-playlist.ts [deleted file]
server/typings/models/video/video.ts [deleted file]
server/typings/plugins/register-server-option.model.ts
server/typings/sequelize.ts [deleted file]
server/typings/utils.ts [deleted file]
shared/extra-utils/server/config.ts
shared/models/plugins/register-server-auth.model.ts
tsconfig.json

index e48641836a3210debfadd7ca33fc60e134390b66..acce53713ac4f891201375f698970b374136b1b3 100644 (file)
@@ -35,7 +35,7 @@ import { buildDislikeActivity } from '../../lib/activitypub/send/send-dislike'
 import { videoPlaylistElementAPGetValidator, videoPlaylistsGetValidator } from '../../middlewares/validators/videos/video-playlists'
 import { VideoPlaylistModel } from '../../models/video/video-playlist'
 import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model'
-import { MAccountId, MActorId, MVideoAPWithoutCaption, MVideoId, MChannelId } from '@server/typings/models'
+import { MAccountId, MActorId, MVideoAPWithoutCaption, MVideoId, MChannelId } from '@server/types/models'
 import { getServerActor } from '@server/models/application/application'
 import { getRateUrl } from '@server/lib/activitypub/video-rates'
 
index c5edf86b757b2c7e573ef65532e76b114865c756..8b42478ee254a159982fb51640458a18881587b3 100644 (file)
@@ -6,7 +6,7 @@ import { processActivities } from '../../lib/activitypub/process/process'
 import { asyncMiddleware, checkSignature, localAccountValidator, localVideoChannelValidator, signatureValidator } from '../../middlewares'
 import { activityPubValidator } from '../../middlewares/validators/activitypub/activity'
 import { queue } from 'async'
-import { MActorDefault, MActorSignature } from '../../typings/models'
+import { MActorDefault, MActorSignature } from '../../types/models'
 
 const inboxRouter = express.Router()
 
index 916a110a80aa24814e1b02921f1cc6125f3b8cbc..22328da7f3207e415fabe4c0504b27cc91dcc156 100644 (file)
@@ -8,7 +8,7 @@ import { buildAudience } from '../../lib/activitypub/audience'
 import { asyncMiddleware, localAccountValidator, localVideoChannelValidator } from '../../middlewares'
 import { VideoModel } from '../../models/video/video'
 import { activityPubResponse } from './utils'
-import { MActorLight } from '@server/typings/models'
+import { MActorLight } from '@server/types/models'
 import { apPaginationValidator } from '../../middlewares/validators/activitypub'
 
 const outboxRouter = express.Router()
index a0da5e30cfbee0e3dff45556d7eb762bfee76437..2d98b5d34155e84e1872245eb338b0f70c704bff 100644 (file)
@@ -28,7 +28,7 @@ import {
 } from '../../middlewares'
 import { VideoModel } from '../../models/video/video'
 import { VideoChannelModel } from '../../models/video/video-channel'
-import { MChannelAccountDefault, MVideoAccountLightBlacklistAllFiles } from '../../typings/models'
+import { MChannelAccountDefault, MVideoAccountLightBlacklistAllFiles } from '../../types/models'
 
 const searchRouter = express.Router()
 
index 06a43d7a313ea7e83877a7d18c23b774d1c7a5ce..c8e9eaeaaf2f1c59e7c7321267b6cf81c924980c 100644 (file)
@@ -47,7 +47,7 @@ import { CONFIG } from '../../../initializers/config'
 import { sequelizeTypescript } from '../../../initializers/database'
 import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model'
 import { UserRegister } from '../../../../shared/models/users/user-register.model'
-import { MUser, MUserAccountDefault } from '@server/typings/models'
+import { MUser, MUserAccountDefault } from '@server/types/models'
 import { Hooks } from '@server/lib/plugins/hooks'
 import { tokensRouter } from '@server/controllers/api/users/token'
 
index d779f1aab5b187065a75a8459de01f40b6f2523a..4d8cfa340a4cd991c82701e8813bbca47d90202f 100644 (file)
@@ -35,7 +35,7 @@ import { VideoPlaylistModel } from '../../models/video/video-playlist'
 import { commonVideoPlaylistFiltersValidator } from '../../middlewares/validators/videos/video-playlists'
 import { CONFIG } from '../../initializers/config'
 import { sequelizeTypescript } from '../../initializers/database'
-import { MChannelAccountDefault } from '@server/typings/models'
+import { MChannelAccountDefault } from '@server/types/models'
 import { getServerActor } from '@server/models/application/application'
 
 const auditLogger = auditLoggerFactory('channels')
index 375d711fdcde9f1e04998a7a2cba547ead17437e..88a2314fb747b04965f9825446906e9caff89dc2 100644 (file)
@@ -40,7 +40,7 @@ import { JobQueue } from '../../lib/job-queue'
 import { CONFIG } from '../../initializers/config'
 import { sequelizeTypescript } from '../../initializers/database'
 import { createPlaylistMiniatureFromExisting } from '../../lib/thumbnail'
-import { MVideoPlaylistFull, MVideoPlaylistThumbnail, MVideoThumbnail } from '@server/typings/models'
+import { MVideoPlaylistFull, MVideoPlaylistThumbnail, MVideoThumbnail } from '@server/types/models'
 import { getServerActor } from '@server/models/application/application'
 
 const reqThumbnailFile = createReqFiles([ 'thumbnailfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { thumbnailfile: CONFIG.STORAGE.TMP_DIR })
index 2af7b386413ec33ee545a8adc30755ebb1c4958c..77843f149d9d51896db763a47184487ecfcab019 100644 (file)
@@ -22,9 +22,9 @@ import { VideoAbuseModel } from '../../../models/video/video-abuse'
 import { auditLoggerFactory, VideoAbuseAuditView } from '../../../helpers/audit-logger'
 import { Notifier } from '../../../lib/notifier'
 import { sendVideoAbuse } from '../../../lib/activitypub/send/send-flag'
-import { MVideoAbuseAccountVideo } from '../../../typings/models/video'
+import { MVideoAbuseAccountVideo } from '../../../types/models/video'
 import { getServerActor } from '@server/models/application/application'
-import { MAccountDefault } from '@server/typings/models'
+import { MAccountDefault } from '@server/types/models'
 
 const auditLogger = auditLoggerFactory('abuse')
 const abuseVideoRouter = express.Router()
index 8c1d12ca86e66dcc73ab7bb7b6cffb55c8f44d9b..c4e2ee72ca03f8c0e3573e66a29b13bd3642f2c5 100644 (file)
@@ -10,7 +10,7 @@ import { federateVideoIfNeeded } from '../../../lib/activitypub/videos'
 import { moveAndProcessCaptionFile } from '../../../helpers/captions-utils'
 import { CONFIG } from '../../../initializers/config'
 import { sequelizeTypescript } from '../../../initializers/database'
-import { MVideoCaptionVideo } from '@server/typings/models'
+import { MVideoCaptionVideo } from '@server/types/models'
 
 const reqVideoCaptionAdd = createReqFiles(
   [ 'captionfile' ],
index ec270148d62c78e89a3c1e0f5d7bc349aeb2f1d7..24a237304ba3fdccd09d3db105b9a4064af6f5d2 100644 (file)
@@ -34,8 +34,8 @@ import {
   MVideoTag,
   MVideoThumbnailAccountDefault,
   MVideoWithBlacklistLight
-} from '@server/typings/models'
-import { MVideoImport, MVideoImportFormattable } from '@server/typings/models/video/video-import'
+} from '@server/types/models'
+import { MVideoImport, MVideoImportFormattable } from '@server/types/models/video/video-import'
 
 const auditLogger = auditLoggerFactory('video-imports')
 const videoImportsRouter = express.Router()
index 3ca5a9192d0e402ded0d12070d9e7c50af054eb8..45c613c75392378e5477933d6308fdd4a646f2f0 100644 (file)
@@ -58,7 +58,7 @@ import { sequelizeTypescript } from '../../../initializers/database'
 import { createVideoMiniatureFromExisting, generateVideoMiniature } from '../../../lib/thumbnail'
 import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type'
 import { Hooks } from '../../../lib/plugins/hooks'
-import { MVideoDetails, MVideoFullLight } from '@server/typings/models'
+import { MVideoDetails, MVideoFullLight } from '@server/types/models'
 import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
 import { getVideoFilePath } from '@server/lib/video-paths'
 import toInt from 'validator/lib/toInt'
index 540a49010198833c2d928f83215039b4d9b3f9b4..d76fee51d4f6e2d727b43bf522a3997ac3526d57 100644 (file)
@@ -18,7 +18,7 @@ import { getFormattedObjects } from '../../../helpers/utils'
 import { changeVideoChannelShare } from '../../../lib/activitypub/share'
 import { sendUpdateVideo } from '../../../lib/activitypub/send'
 import { VideoModel } from '../../../models/video/video'
-import { MVideoFullLight } from '@server/typings/models'
+import { MVideoFullLight } from '@server/types/models'
 
 const ownershipVideoRouter = express.Router()
 
index 271b788f6688885301e972ba94b2937e09c072cc..3f7bbdbae2f79f71d8ae0c447fb23f50d60d4a37 100644 (file)
@@ -22,7 +22,7 @@ import { root } from '../helpers/core-utils'
 import { CONFIG, isEmailEnabled } from '../initializers/config'
 import { getPreview, getVideoCaption } from './lazy-static'
 import { VideoStreamingPlaylistType } from '@shared/models/videos/video-streaming-playlist.type'
-import { MVideoFile, MVideoFullLight } from '@server/typings/models'
+import { MVideoFile, MVideoFullLight } from '@server/types/models'
 import { getTorrentFilePath, getVideoFilePath } from '@server/lib/video-paths'
 import { getThemeOrDefault } from '../lib/plugins/theme-utils'
 import { getEnabledResolutions, getRegisteredPlugins, getRegisteredThemes } from '@server/controllers/api/config'
index ce48fc5438c8fbaa53cf98f62080d95024306505..d28453d793f405a42f6b355ba4cdaccc1cc3514f 100644 (file)
@@ -6,7 +6,7 @@ import { ACTIVITY_PUB, REMOTE_SCHEME } from '../initializers/constants'
 import { signJsonLDObject } from './peertube-crypto'
 import { pageToStartAndCount } from './core-utils'
 import { URL } from 'url'
-import { MActor, MVideoAccountLight } from '../typings/models'
+import { MActor, MVideoAccountLight } from '../types/models'
 import { ContextType } from '@shared/models/activitypub/context'
 
 function getContextData (type: ContextType) {
index 117548a60cd9db06a43317cff9190d8c0c96d4e1..015b4a39ffb3a1d2afe2c9a4ad7ff7952e4916bb 100644 (file)
@@ -1,6 +1,6 @@
 import { ActorModel } from '../models/activitypub/actor'
 import * as Bluebird from 'bluebird'
-import { MActorFull, MActorAccountChannelId } from '../typings/models'
+import { MActorFull, MActorAccountChannelId } from '../types/models'
 
 type ActorFetchByUrlType = 'all' | 'association-ids'
 
index 73b6d166d978915da7de8b0dcffbceb5d49a3f71..0dad23759b1090a34eb00c2c465083e69f51799c 100644 (file)
@@ -2,7 +2,7 @@ import { join } from 'path'
 import { CONFIG } from '../initializers/config'
 import * as srt2vtt from 'srt-to-vtt'
 import { createReadStream, createWriteStream, move, remove } from 'fs-extra'
-import { MVideoCaptionFormattable } from '@server/typings/models'
+import { MVideoCaptionFormattable } from '@server/types/models'
 
 async function moveAndProcessCaptionFile (physicalFile: { filename: string, path: string }, videoCaption: MVideoCaptionFormattable) {
   const videoCaptionsDir = CONFIG.STORAGE.CAPTIONS_DIR
index 2d18493324b9510a631109cd3330403125ca803a..ed5f8cc2fcafc9f8d6c542ae2a355917b9ab73b0 100644 (file)
@@ -1,7 +1,7 @@
 import { Response } from 'express'
 import { VideoChangeOwnershipModel } from '../../models/video/video-change-ownership'
-import { MVideoChangeOwnershipFull } from '@server/typings/models/video/video-change-ownership'
-import { MUserId } from '@server/typings/models'
+import { MVideoChangeOwnershipFull } from '@server/types/models/video/video-change-ownership'
+import { MUserId } from '@server/types/models'
 
 export async function doesChangeVideoOwnershipExist (idArg: number | string, res: Response) {
   const id = parseInt(idArg + '', 10)
index f5aa0badad321601f5e8f10579e2008a1add64fb..bddea7eaa3f12326be09ba401da79fbdc45b2330 100644 (file)
@@ -1,7 +1,7 @@
 import { Response } from 'express'
 import { AccountModel } from '../../models/account/account'
 import * as Bluebird from 'bluebird'
-import { MAccountDefault } from '../../typings/models'
+import { MAccountDefault } from '../../types/models'
 
 function doesAccountIdExist (id: number, res: Response, sendNotFound = true) {
   const promise = AccountModel.load(id)
index 1b2513b60111b306dff9bf00ea64fec24409f47b..f5ce29807d5aca42d7868de068d626bf920b6efa 100644 (file)
@@ -1,6 +1,6 @@
 import { Response } from 'express'
 import { VideoCaptionModel } from '../../models/video/video-caption'
-import { MVideoId } from '@server/typings/models'
+import { MVideoId } from '@server/types/models'
 
 async function doesVideoCaptionExist (video: MVideoId, language: string, res: Response) {
   const videoCaption = await VideoCaptionModel.loadByVideoIdAndLanguage(video.id, language)
index 1595ecd94626af0ac05150dae72e9f1aed721d65..6eecb8ee5e90321879d187c38337ecfeb76687bf 100644 (file)
@@ -1,6 +1,6 @@
 import * as express from 'express'
 import { VideoChannelModel } from '../../models/video/video-channel'
-import { MChannelAccountDefault } from '@server/typings/models'
+import { MChannelAccountDefault } from '@server/types/models'
 
 async function doesLocalVideoChannelNameExist (name: string, res: express.Response) {
   const videoChannel = await VideoChannelModel.loadLocalByNameAndPopulateAccount(name)
index 8e74844835c37e6ff63b0f65582f008edf08f3eb..344104f7c06c621b2da41ab6a052c328ca25dce9 100644 (file)
@@ -1,6 +1,6 @@
 import * as express from 'express'
 import { VideoPlaylistModel } from '../../models/video/video-playlist'
-import { MVideoPlaylist } from '../../typings/models/video/video-playlist'
+import { MVideoPlaylist } from '../../types/models/video/video-playlist'
 
 export type VideoPlaylistFetchType = 'summary' | 'all'
 async function doesVideoPlaylistExist (id: number | string, res: express.Response, fetchType: VideoPlaylistFetchType = 'summary') {
index a0bbcdb21c0ceafa635f2e788b9cf4cf2674227c..77a48a46720a0f2ded170c9277c85357f91a2015 100644 (file)
@@ -11,7 +11,7 @@ import {
   MVideoImmutable,
   MVideoThumbnail,
   MVideoWithRights
-} from '@server/typings/models'
+} from '@server/types/models'
 import { VideoFileModel } from '@server/models/video/video-file'
 
 async function doesVideoExist (id: number | string, res: Response, fetchType: VideoFetchType = 'all') {
index 394e97fd57fafb07aac0fc25e49c6c5a565d85fa..1655cd7b57bd9e4033a0aaf3b9130425c3ea385a 100644 (file)
@@ -6,7 +6,7 @@ import { logger } from './logger'
 import { cloneDeep } from 'lodash'
 import { createSign, createVerify } from 'crypto'
 import * as bcrypt from 'bcrypt'
-import { MActor } from '../typings/models'
+import { MActor } from '../types/models'
 
 const bcryptComparePromise = promisify2<any, string, boolean>(bcrypt.compare)
 const bcryptGenSaltPromise = promisify1<number, string>(bcrypt.genSalt)
index 4bcc6d0b9497e218dc0204aa2a80308cd622ff1f..89c85accb26fb461f138dfd036433c62a9b3699e 100644 (file)
@@ -11,7 +11,7 @@ import {
   MVideoImmutable,
   MVideoThumbnail,
   MVideoWithRights
-} from '@server/typings/models'
+} from '@server/types/models'
 import { Response } from 'express'
 import { DEFAULT_AUDIO_RESOLUTION } from '@server/initializers/constants'
 import { JobQueue } from '@server/lib/job-queue'
index 5443a266b0087de6587659cdb30b493b1b6efa9b..da7e880778a07e03abaebe93369f1e395dcfd466 100644 (file)
@@ -4,7 +4,7 @@ import { ActorModel } from '../models/activitypub/actor'
 import { isTestInstance } from './core-utils'
 import { isActivityPubUrlValid } from './custom-validators/activitypub/misc'
 import { WEBSERVER } from '../initializers/constants'
-import { MActorFull } from '../typings/models'
+import { MActorFull } from '../types/models'
 
 const webfinger = new WebFinger({
   webfist_fallback: false,
index 7cd76d7085378e913f66d3cc8dc5794ec3911be3..089954e3267a34b7f324dc59c5e32137c77aa132 100644 (file)
@@ -6,9 +6,9 @@ import { CONFIG } from '../initializers/config'
 import { dirname, join } from 'path'
 import * as createTorrent from 'create-torrent'
 import { promisify2 } from './core-utils'
-import { MVideo } from '@server/typings/models/video/video'
-import { MVideoFile, MVideoFileRedundanciesOpt } from '@server/typings/models/video/video-file'
-import { isStreamingPlaylist, MStreamingPlaylistVideo } from '@server/typings/models/video/video-streaming-playlist'
+import { MVideo } from '@server/types/models/video/video'
+import { MVideoFile, MVideoFileRedundanciesOpt } from '@server/types/models/video/video-file'
+import { isStreamingPlaylist, MStreamingPlaylistVideo } from '@server/types/models/video/video-streaming-playlist'
 import { WEBSERVER } from '@server/initializers/constants'
 import * as parseTorrent from 'parse-torrent'
 import * as magnetUtil from 'magnet-uri'
index 0e5742071e3fd35b8965568a2aefca8bc8e7d1d3..73406e248997b9c374b55c1ff59d8e597c394b99 100644 (file)
@@ -33,7 +33,7 @@ import {
   MActorFullActor,
   MActorId,
   MChannel
-} from '../../typings/models'
+} from '../../types/models'
 import { extname } from 'path'
 import { getServerActor } from '@server/models/application/application'
 
index 4b30d1f6f136a4dbac126d3229ed95d6c6aac0f9..2986714d309c4290b96d3bd11f6f9fd7040c6028 100644 (file)
@@ -4,7 +4,7 @@ import { ACTIVITY_PUB } from '../../initializers/constants'
 import { ActorModel } from '../../models/activitypub/actor'
 import { VideoModel } from '../../models/video/video'
 import { VideoShareModel } from '../../models/video/video-share'
-import { MActorFollowersUrl, MActorLight, MActorUrl, MCommentOwner, MCommentOwnerVideo, MVideoId } from '../../typings/models'
+import { MActorFollowersUrl, MActorLight, MActorUrl, MCommentOwner, MCommentOwnerVideo, MVideoId } from '../../types/models'
 
 function getRemoteVideoAudience (accountActor: MActorUrl, actorsInvolvedInVideo: MActorFollowersUrl[]): ActivityAudience {
   return {
index 8252e95e92b99eed1b82690f650c8c89d386ba59..2e6dd34e0365aad0f3920c61d38187d0b0c026b1 100644 (file)
@@ -2,7 +2,7 @@ import { CacheFileObject } from '../../../shared/index'
 import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy'
 import { Transaction } from 'sequelize'
 import { VideoStreamingPlaylistType } from '../../../shared/models/videos/video-streaming-playlist.type'
-import { MActorId, MVideoRedundancy, MVideoWithAllFiles } from '@server/typings/models'
+import { MActorId, MVideoRedundancy, MVideoWithAllFiles } from '@server/types/models'
 
 function cacheFileActivityObjectToDBAttributes (cacheFileObject: CacheFileObject, video: MVideoWithAllFiles, byActor: MActorId) {
 
index 3b5ad47c93ba8491ab76789afb7452461450560f..351499bd1a1e46ad7a6e0a869524a5e5bb4ae6a2 100644 (file)
@@ -1,4 +1,4 @@
-import { MActorFollowActors } from '../../typings/models'
+import { MActorFollowActors } from '../../types/models'
 import { CONFIG } from '../../initializers/config'
 import { SERVER_ACTOR_NAME } from '../../initializers/constants'
 import { JobQueue } from '../job-queue'
index c1d932a686e2bde881e7b28bb984078bdf5f41ed..bd442b22392af14092d6d25fee8f83daf48d7c03 100644 (file)
@@ -15,9 +15,9 @@ import { VideoPlaylistElementModel } from '../../models/video/video-playlist-ele
 import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model'
 import { sequelizeTypescript } from '../../initializers/database'
 import { createPlaylistMiniatureFromUrl } from '../thumbnail'
-import { FilteredModelAttributes } from '../../typings/sequelize'
-import { MAccountDefault, MAccountId, MVideoId } from '../../typings/models'
-import { MVideoPlaylist, MVideoPlaylistId, MVideoPlaylistOwner } from '../../typings/models/video/video-playlist'
+import { FilteredModelAttributes } from '../../types/sequelize'
+import { MAccountDefault, MAccountId, MVideoId } from '../../types/models'
+import { MVideoPlaylist, MVideoPlaylistId, MVideoPlaylistOwner } from '../../types/models/video/video-playlist'
 
 function playlistObjectToDBAttributes (playlistObject: PlaylistObject, byAccount: MAccountId, to: string[]) {
   const privacy = to.includes(ACTIVITY_PUB.PUBLIC)
index dcfbb2c84a673ab1ca23c170fd6ed920b8608959..1799829f8b2e5321d6fbbbd4418aad4b64c19ea5 100644 (file)
@@ -1,8 +1,8 @@
 import { ActivityAccept } from '../../../../shared/models/activitypub'
 import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
 import { addFetchOutboxJob } from '../actor'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActorDefault, MActorSignature } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActorDefault, MActorSignature } from '../../../types/models'
 
 async function processAcceptActivity (options: APProcessorOptions<ActivityAccept>) {
   const { byActor: targetActor, inboxActor } = options
index 26427aaa1ede0dcbc5e519de6ffe661a10d4bea9..63082466e6e923a7eb779263b2852a2bc3ccde6d 100644 (file)
@@ -6,8 +6,8 @@ import { forwardVideoRelatedActivity } from '../send/utils'
 import { getOrCreateVideoAndAccountAndChannel } from '../videos'
 import { Notifier } from '../../notifier'
 import { logger } from '../../../helpers/logger'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActorSignature, MVideoAccountLightBlacklistAllFiles } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActorSignature, MVideoAccountLightBlacklistAllFiles } from '../../../types/models'
 
 async function processAnnounceActivity (options: APProcessorOptions<ActivityAnnounce>) {
   const { activity, byActor: actorAnnouncer } = options
index 5e737f49ea1c253840f5283edcc34761699e6c7f..74f1032e2935c14c55ab597dd1be8eeab4bfe907 100644 (file)
@@ -5,8 +5,8 @@ import { VideoCommentObject } from '../../../../shared/models/activitypub/object
 import { retryTransactionWrapper } from '../../../helpers/database-utils'
 import { logger } from '../../../helpers/logger'
 import { sequelizeTypescript } from '../../../initializers/database'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActorSignature, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActorSignature, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../../types/models'
 import { Notifier } from '../../notifier'
 import { createOrUpdateCacheFile } from '../cache-file'
 import { createOrUpdateVideoPlaylist } from '../playlist'
index 7c8dc83e8395009c197d99ad5911b2653ef8f67e..b9fc5e792bfa4838c410f936bbfdba9a85313ded 100644 (file)
@@ -8,8 +8,8 @@ import { VideoCommentModel } from '../../../models/video/video-comment'
 import { markCommentAsDeleted } from '../../video-comment'
 import { forwardVideoRelatedActivity } from '../send/utils'
 import { VideoPlaylistModel } from '../../../models/video/video-playlist'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MAccountActor, MActor, MActorSignature, MChannelActor, MChannelActorAccountActor } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MAccountActor, MActor, MActorSignature, MChannelActor, MChannelActorAccountActor } from '../../../types/models'
 
 async function processDeleteActivity (options: APProcessorOptions<ActivityDelete>) {
   const { activity, byActor } = options
index fcdd0b86e92496d1e7e32f52cb9deb0ae7effdd2..0cd2045015d0050e55d35c33676303a30bf6ce6a 100644 (file)
@@ -6,8 +6,8 @@ import { AccountVideoRateModel } from '../../../models/account/account-video-rat
 import { getOrCreateVideoAndAccountAndChannel } from '../videos'
 import { forwardVideoRelatedActivity } from '../send/utils'
 import { getVideoDislikeActivityPubUrl } from '../url'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActorSignature } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActorSignature } from '../../../types/models'
 
 async function processDislikeActivity (options: APProcessorOptions<ActivityCreate | ActivityDislike>) {
   const { activity, byActor } = options
index 7337f337c6e487dabf569d8041820955a1771167..8d1c9c869e9bb2272e8983ac97fa1aaf0d5daee2 100644 (file)
@@ -7,8 +7,8 @@ import { VideoAbuseModel } from '../../../models/video/video-abuse'
 import { getOrCreateVideoAndAccountAndChannel } from '../videos'
 import { Notifier } from '../../notifier'
 import { getAPId } from '../../../helpers/activitypub'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActorSignature, MVideoAbuseAccountVideo } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActorSignature, MVideoAbuseAccountVideo } from '../../../types/models'
 import { AccountModel } from '@server/models/account/account'
 
 async function processFlagActivity (options: APProcessorOptions<ActivityCreate | ActivityFlag>) {
index 950d421ddf5d718ff1d59b5f9a5f9d1155b5243a..7eb7e828d00b91d87b6d45571ad3e94746768b5e 100644 (file)
@@ -8,8 +8,8 @@ import { sendAccept, sendReject } from '../send'
 import { Notifier } from '../../notifier'
 import { getAPId } from '../../../helpers/activitypub'
 import { CONFIG } from '../../../initializers/config'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActorFollowActors, MActorSignature } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActorFollowActors, MActorSignature } from '../../../types/models'
 import { autoFollowBackIfNeeded } from '../follow'
 import { getServerActor } from '@server/models/application/application'
 
index fba3c76a4a24a1a67c81a76e5eab2bfaa32a23bf..b800a561830bbabef14c650486f1cfc85ccfce1e 100644 (file)
@@ -6,8 +6,8 @@ import { forwardVideoRelatedActivity } from '../send/utils'
 import { getOrCreateVideoAndAccountAndChannel } from '../videos'
 import { getVideoLikeActivityPubUrl } from '../url'
 import { getAPId } from '../../../helpers/activitypub'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActorSignature } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActorSignature } from '../../../types/models'
 
 async function processLikeActivity (options: APProcessorOptions<ActivityLike>) {
   const { activity, byActor } = options
index 9804436a2468c97fe1ee5268126d23efbd3d26e8..03b669fd99cc715bc5cdc8a694cf2cb9f23a3409 100644 (file)
@@ -1,8 +1,8 @@
 import { ActivityReject } from '../../../../shared/models/activitypub/activity'
 import { sequelizeTypescript } from '../../../initializers/database'
 import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActor } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActor } from '../../../types/models'
 
 async function processRejectActivity (options: APProcessorOptions<ActivityReject>) {
   const { byActor: targetActor, inboxActor } = options
index 9ef6a8a973a5638ad571e5c1070351eb735d6cfe..caf672cd6acca066642854c1ab8ac9322dc8918b 100644 (file)
@@ -10,8 +10,8 @@ import { forwardVideoRelatedActivity } from '../send/utils'
 import { getOrCreateVideoAndAccountAndChannel } from '../videos'
 import { VideoShareModel } from '../../../models/video/video-share'
 import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActorSignature } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActorSignature } from '../../../types/models'
 
 async function processUndoActivity (options: APProcessorOptions<ActivityUndo>) {
   const { activity, byActor } = options
index 98ab0f83def9e597de1ecfe6291ccacb468ddd36..1bdf23d6ffbd3ff5b5fa85f06d37519b95a34407 100644 (file)
@@ -14,8 +14,8 @@ 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 '../../../typings/activitypub-processor.model'
-import { MActorSignature, MAccountIdActor } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActorSignature, MAccountIdActor } from '../../../types/models'
 import { isRedundancyAccepted } from '@server/lib/redundancy'
 
 async function processUpdateActivity (options: APProcessorOptions<ActivityUpdate>) {
index b3b6c933dd9e5b1400d1e8049dd0014d5403298f..cc26180af12994dab23f75d8973fcd8ee9e1ce1d 100644 (file)
@@ -2,8 +2,8 @@ import { getOrCreateVideoAndAccountAndChannel } from '../videos'
 import { forwardVideoRelatedActivity } from '../send/utils'
 import { Redis } from '../../redis'
 import { ActivityCreate, ActivityView, ViewObject } from '../../../../shared/models/activitypub'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActorSignature } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActorSignature } from '../../../types/models'
 
 async function processViewActivity (options: APProcessorOptions<ActivityCreate | ActivityView>) {
   const { activity, byActor } = options
index c602bf2181edf6f2fc45df13bbc32b443a63b44a..e60dd2a5b7bcd0d1c9cf4709dd6fa68786f34aa4 100644 (file)
@@ -14,8 +14,8 @@ import { getOrCreateActorAndServerAndModel } from '../actor'
 import { processDislikeActivity } from './process-dislike'
 import { processFlagActivity } from './process-flag'
 import { processViewActivity } from './process-view'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActorDefault, MActorSignature } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActorDefault, MActorSignature } from '../../../types/models'
 
 const processActivity: { [ P in ActivityType ]: (options: APProcessorOptions<Activity>) => Promise<any> } = {
   Create: processCreateActivity,
index c4c6b849b9e3340dc15060e23795958c47ac9654..50e192bdd55f2ce4bb95bc8d194e06a90d4a938e 100644 (file)
@@ -3,7 +3,7 @@ import { getActorFollowAcceptActivityPubUrl, getActorFollowActivityPubUrl } from
 import { unicastTo } from './utils'
 import { buildFollowActivity } from './send-follow'
 import { logger } from '../../../helpers/logger'
-import { MActor, MActorFollowActors } from '../../../typings/models'
+import { MActor, MActorFollowActors } from '../../../types/models'
 
 function sendAccept (actorFollow: MActorFollowActors) {
   const follower = actorFollow.ActorFollower
index d03b358f1a4ff3b5df2ce279863fa345e792b0bf..471dcfa77a10da326d4e37fdd6339025d31238b2 100644 (file)
@@ -3,8 +3,8 @@ import { ActivityAnnounce, ActivityAudience } from '../../../../shared/models/ac
 import { broadcastToFollowers } from './utils'
 import { audiencify, getActorsInvolvedInVideo, getAudience, getAudienceFromFollowersOf } from '../audience'
 import { logger } from '../../../helpers/logger'
-import { MActorLight, MVideo } from '../../../typings/models'
-import { MVideoShare } from '../../../typings/models/video'
+import { MActorLight, MVideo } from '../../../types/models'
+import { MVideoShare } from '../../../types/models/video'
 
 async function buildAnnounceWithVideoAudience (
   byActor: MActorLight,
index e521cabbcfdcf192f3e74693b6fcbf9c9e08a667..9fb2182249dd09127d3a67795b70a03bf0cf5299 100644 (file)
@@ -14,7 +14,7 @@ import {
   MVideoPlaylistFull,
   MVideoRedundancyFileVideo,
   MVideoRedundancyStreamingPlaylistVideo
-} from '../../../typings/models'
+} from '../../../types/models'
 import { getServerActor } from '@server/models/application/application'
 import { ContextType } from '@shared/models/activitypub/context'
 
index 2afd2c05dec453229675328813be766d9c9d6813..e0acced183a59ef3879379f17a5b1e87b9e0047e 100644 (file)
@@ -5,8 +5,8 @@ import { logger } from '../../../helpers/logger'
 import { ActorModel } from '../../../models/activitypub/actor'
 import { VideoCommentModel } from '../../../models/video/video-comment'
 import { VideoShareModel } from '../../../models/video/video-share'
-import { MActorUrl } from '../../../typings/models'
-import { MCommentOwnerVideo, MVideoAccountLight, MVideoPlaylistFullSummary } from '../../../typings/models/video'
+import { MActorUrl } from '../../../types/models'
+import { MCommentOwnerVideo, MVideoAccountLight, MVideoPlaylistFullSummary } from '../../../types/models/video'
 import { audiencify, getActorsInvolvedInVideo, getVideoCommentAudience } from '../audience'
 import { getDeleteActivityPubUrl } from '../url'
 import { broadcastToActors, broadcastToFollowers, sendVideoRelatedActivity, unicastTo } from './utils'
index 600469c71c331826a53b91112c5b728e236e0055..1bb7dc9374df19d13d3aee631254a1cbbfca1bc7 100644 (file)
@@ -4,7 +4,7 @@ import { logger } from '../../../helpers/logger'
 import { ActivityAudience, ActivityDislike } from '../../../../shared/models/activitypub'
 import { sendVideoRelatedActivity } from './utils'
 import { audiencify, getAudience } from '../audience'
-import { MActor, MActorAudience, MVideoAccountLight, MVideoUrl } from '../../../typings/models'
+import { MActor, MActorAudience, MVideoAccountLight, MVideoUrl } from '../../../types/models'
 
 function sendDislike (byActor: MActor, video: MVideoAccountLight, t: Transaction) {
   logger.info('Creating job to dislike %s.', video.url)
index e4e523631be0995beea84c3e7e331c8b5bd03810..3a1fe08122e95a5547eafffdc36b81bd290b9f19 100644 (file)
@@ -4,8 +4,8 @@ import { logger } from '../../../helpers/logger'
 import { ActivityAudience, ActivityFlag } from '../../../../shared/models/activitypub'
 import { audiencify, getAudience } from '../audience'
 import { Transaction } from 'sequelize'
-import { MActor, MVideoFullLight } from '../../../typings/models'
-import { MVideoAbuseVideo } from '../../../typings/models/video'
+import { MActor, MVideoFullLight } from '../../../types/models'
+import { MVideoAbuseVideo } from '../../../types/models/video'
 
 function sendVideoAbuse (byActor: MActor, videoAbuse: MVideoAbuseVideo, video: MVideoFullLight, t: Transaction) {
   if (!video.VideoChannel.Account.Actor.serverId) return // Local user
index ce400d8fffa4196412e75238a9f2bef5e964aa0c..08f1d83f98b9a592097086a40aecd2768a3ccda7 100644 (file)
@@ -3,7 +3,7 @@ import { getActorFollowActivityPubUrl } from '../url'
 import { unicastTo } from './utils'
 import { logger } from '../../../helpers/logger'
 import { Transaction } from 'sequelize'
-import { MActor, MActorFollowActors } from '../../../typings/models'
+import { MActor, MActorFollowActors } from '../../../types/models'
 
 function sendFollow (actorFollow: MActorFollowActors, t: Transaction) {
   const me = actorFollow.ActorFollower
index 5db25232519cc8dbbea10dee9fafbf4ab1fb0cbf..29fcfc4049c9e6b783040d5dbffefc26c9716fff 100644 (file)
@@ -4,7 +4,7 @@ import { getVideoLikeActivityPubUrl } from '../url'
 import { sendVideoRelatedActivity } from './utils'
 import { audiencify, getAudience } from '../audience'
 import { logger } from '../../../helpers/logger'
-import { MActor, MActorAudience, MVideoAccountLight, MVideoUrl } from '../../../typings/models'
+import { MActor, MActorAudience, MVideoAccountLight, MVideoUrl } from '../../../types/models'
 
 function sendLike (byActor: MActor, video: MVideoAccountLight, t: Transaction) {
   logger.info('Creating job to like %s.', video.url)
index 643c468a9d169a3be6d261f74cb0969f7baaa125..befbcb8daabd771c508560d5dea1f5569e127530 100644 (file)
@@ -3,7 +3,7 @@ import { getActorFollowActivityPubUrl, getActorFollowRejectActivityPubUrl } from
 import { unicastTo } from './utils'
 import { buildFollowActivity } from './send-follow'
 import { logger } from '../../../helpers/logger'
-import { MActor } from '../../../typings/models'
+import { MActor } from '../../../types/models'
 
 function sendReject (follower: MActor, following: MActor) {
   if (!follower.serverId) { // This should never happen
index 33f1d4921b28cfdc733b375b6f4b1c20414b932d..6ed3433008b5bf7fd9ac077d4b05d90fd51fc4ad 100644 (file)
@@ -26,7 +26,7 @@ import {
   MVideoAccountLight,
   MVideoRedundancyVideo,
   MVideoShare
-} from '../../../typings/models'
+} from '../../../types/models'
 
 function sendUndoFollow (actorFollow: MActorFollowActors, t: Transaction) {
   const me = actorFollow.ActorFollower
index 7a4cf3f569e2da11ab61c66044ef21b36ad1095a..305edf429d7f6146db535d53bc6e68651909489c 100644 (file)
@@ -18,7 +18,7 @@ import {
   MVideoAPWithoutCaption,
   MVideoPlaylistFull,
   MVideoRedundancyVideo
-} from '../../../typings/models'
+} from '../../../types/models'
 import { getServerActor } from '@server/models/application/application'
 
 async function sendUpdateVideo (videoArg: MVideoAPWithoutCaption, t: Transaction, overrodeByActor?: MActor) {
index 1f864ea5237d4b55c2a5a06a8185d8f3313be634..3358188a27e27695ec09285200295702f9c0cbbc 100644 (file)
@@ -5,7 +5,7 @@ import { getVideoLikeActivityPubUrl } from '../url'
 import { sendVideoRelatedActivity } from './utils'
 import { audiencify, getAudience } from '../audience'
 import { logger } from '../../../helpers/logger'
-import { MActorAudience, MVideoImmutable, MVideoUrl } from '@server/typings/models'
+import { MActorAudience, MVideoImmutable, MVideoUrl } from '@server/types/models'
 
 async function sendView (byActor: ActorModel, video: MVideoImmutable, t: Transaction) {
   logger.info('Creating job to send view of %s.', video.url)
index 44a8926e52b546dd7d4d59ddf59c684a55d1eacb..85a9f009d9af7c2d217b1d81ae4a8ed6bb7c5f66 100644 (file)
@@ -6,7 +6,7 @@ import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
 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 '../../../typings/models'
+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'
 
index d2cbc59a86554ae5c1b0d60a60f8a95ad56a12e8..5e426f5dba499f5917b20128f466b0399eb503fa 100644 (file)
@@ -8,7 +8,7 @@ import { getOrCreateActorAndServerAndModel } from './actor'
 import { logger } from '../../helpers/logger'
 import { CRAWL_REQUEST_CONCURRENCY } from '../../initializers/constants'
 import { checkUrlsSameHost, getAPId } from '../../helpers/activitypub'
-import { MChannelActorLight, MVideo, MVideoAccountLight, MVideoId } from '../../typings/models/video'
+import { MChannelActorLight, MVideo, MVideoAccountLight, MVideoId } from '../../types/models/video'
 import { getServerActor } from '@server/models/application/application'
 
 async function shareVideoByServerAndChannel (video: MVideoAccountLight, t: Transaction) {
index 6290af34ba91c5ecb399c07b6b521b05cefc6a98..7f98751a1263814abc42a7af7e9649f04b92252b 100644 (file)
@@ -9,10 +9,10 @@ import {
   MVideoId,
   MVideoUrl,
   MVideoUUID
-} from '../../typings/models'
-import { MVideoPlaylist, MVideoPlaylistUUID } from '../../typings/models/video/video-playlist'
-import { MVideoFileVideoUUID } from '../../typings/models/video/video-file'
-import { MStreamingPlaylist } from '../../typings/models/video/video-streaming-playlist'
+} from '../../types/models'
+import { MVideoPlaylist, MVideoPlaylistUUID } from '../../types/models/video/video-playlist'
+import { MVideoFileVideoUUID } from '../../types/models/video/video-file'
+import { MStreamingPlaylist } from '../../types/models/video/video-streaming-playlist'
 
 function getVideoActivityPubUrl (video: MVideoUUID) {
   return WEBSERVER.URL + '/videos/watch/' + video.uuid
index 3aee6799e2c48cea82dc7179913ea7837ece3af9..dcae2a255719d91c968b9390d4be4a1f3cf3a811 100644 (file)
@@ -7,7 +7,7 @@ import { getOrCreateActorAndServerAndModel } from './actor'
 import { getOrCreateVideoAndAccountAndChannel } from './videos'
 import * as Bluebird from 'bluebird'
 import { checkUrlsSameHost } from '../../helpers/activitypub'
-import { MCommentOwner, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../typings/models/video'
+import { MCommentOwner, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../types/models/video'
 
 type ResolveThreadParams = {
   url: string
index 202368c8f0b80afa2499b6bea6c74cad6a40b655..e09e5d9ec8663a17d4e4bfd5fdae492dfffec135 100644 (file)
@@ -10,7 +10,7 @@ import { doRequest } from '../../helpers/requests'
 import { checkUrlsSameHost, getAPId } from '../../helpers/activitypub'
 import { getVideoDislikeActivityPubUrl, getVideoLikeActivityPubUrl } from './url'
 import { sendDislike } from './send/send-dislike'
-import { MAccountActor, MActorUrl, MVideo, MVideoAccountLight, MVideoId } from '../../typings/models'
+import { MAccountActor, MActorUrl, MVideo, MVideoAccountLight, MVideoId } from '../../types/models'
 
 async function createRates (ratesUrl: string[], video: MVideo, rate: VideoRateType) {
   let rateCounts = 0
index 6d20e0e654437c5ffa7f186978ea332b0fdcee89..6c5f7f3065bdda6b2b9593413307952000686bea 100644 (file)
@@ -52,7 +52,7 @@ import { sequelizeTypescript } from '../../initializers/database'
 import { createPlaceholderThumbnail, createVideoMiniatureFromUrl } from '../thumbnail'
 import { ThumbnailType } from '../../../shared/models/videos/thumbnail.type'
 import { join } from 'path'
-import { FilteredModelAttributes } from '../../typings/sequelize'
+import { FilteredModelAttributes } from '../../types/sequelize'
 import { autoBlacklistVideoIfNeeded } from '../video-blacklist'
 import { ActorFollowScoreCache } from '../files-cache'
 import {
@@ -71,8 +71,8 @@ import {
   MVideoId,
   MVideoImmutable,
   MVideoThumbnail
-} from '../../typings/models'
-import { MThumbnail } from '../../typings/models/video/thumbnail'
+} from '../../types/models'
+import { MThumbnail } from '../../types/models/video/thumbnail'
 import { maxBy, minBy } from 'lodash'
 
 async function federateVideoIfNeeded (videoArg: MVideoAPWithoutCaption, isNewVideo: boolean, transaction?: sequelize.Transaction) {
index 282d834a2ba79fab1e841387df996e5de41392ef..be6657b6ffbe1c780c0d2f9411a5f36f7fa02307 100644 (file)
@@ -11,7 +11,7 @@ import { sequelizeTypescript } from '../initializers/database'
 import * as LRUCache from 'lru-cache'
 import { queue } from 'async'
 import { downloadImage } from '../helpers/requests'
-import { MAccountDefault, MChannelDefault } from '../typings/models'
+import { MAccountDefault, MChannelDefault } from '../types/models'
 
 async function updateActorAvatarFile (
   avatarPhysicalFile: Express.Multer.File,
index d282d091b80ff143524985d27b16681f8e2fb9e2..d6b684015cb6e3f0fcf3563ae7c28b3ffb5be408 100644 (file)
@@ -1,6 +1,6 @@
 import { sequelizeTypescript } from '@server/initializers/database'
 import { getServerActor } from '@server/models/application/application'
-import { MAccountBlocklist, MAccountId, MAccountServer, MServerBlocklist } from '@server/typings/models'
+import { MAccountBlocklist, MAccountId, MAccountServer, MServerBlocklist } from '@server/types/models'
 import { AccountBlocklistModel } from '../models/account/account-blocklist'
 import { ServerBlocklistModel } from '../models/server/server-blocklist'
 
index 4a4b0d12f9799b1d21455a0cafb16e925e625504..3e6da2898c1add008c1631ea4b7fdcd8c3c51749 100644 (file)
@@ -13,7 +13,7 @@ import { VideoChannelModel } from '../models/video/video-channel'
 import * as Bluebird from 'bluebird'
 import { CONFIG } from '../initializers/config'
 import { logger } from '../helpers/logger'
-import { MAccountActor, MChannelActor, MVideo } from '../typings/models'
+import { MAccountActor, MChannelActor, MVideo } from '../types/models'
 
 export class ClientHtml {
 
index 04aade83a2a882dc480243cd0219facfe6838627..c08732b4833de362798a3afeedb9a7dbeebea050 100644 (file)
@@ -12,9 +12,9 @@ import {
   MVideoAccountLight,
   MVideoBlacklistLightVideo,
   MVideoBlacklistVideo
-} from '../typings/models/video'
-import { MActorFollowActors, MActorFollowFull, MUser } from '../typings/models'
-import { MVideoImport, MVideoImportVideo } from '@server/typings/models/video/video-import'
+} from '../types/models/video'
+import { MActorFollowActors, MActorFollowFull, MUser } from '../types/models'
+import { MVideoImport, MVideoImportVideo } from '@server/types/models/video/video-import'
 import { EmailPayload } from '@shared/models'
 import { join } from 'path'
 import { VideoAbuse } from '../../shared/models/videos'
index 443a600887c07d41b533ee733dd72b0c9d51c5dd..60bb3ab7ee88ea4b638cd7bdadaea11d6d22084d 100644 (file)
@@ -11,7 +11,7 @@ import { flatten, uniq } from 'lodash'
 import { VideoFileModel } from '../models/video/video-file'
 import { CONFIG } from '../initializers/config'
 import { sequelizeTypescript } from '../initializers/database'
-import { MVideoWithFile } from '@server/typings/models'
+import { MVideoWithFile } from '@server/types/models'
 import { getVideoFilename, getVideoFilePath } from './video-paths'
 
 async function updateStreamingPlaylistsInfohashesIfNeeded () {
index 7034c10d09b3f11a1bea501fb1f0eddc5d50e2b3..7a4f85f8b5fd32e153223bf2d5588ce0522bc308 100644 (file)
@@ -10,7 +10,7 @@ import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
 import { ActorModel } from '../../../models/activitypub/actor'
 import { Notifier } from '../../notifier'
 import { sequelizeTypescript } from '../../../initializers/database'
-import { MActor, MActorFollowActors, MActorFull } from '../../../typings/models'
+import { MActor, MActorFollowActors, MActorFull } from '../../../types/models'
 import { ActivitypubFollowPayload } from '@shared/models'
 
 async function processActivityPubFollow (job: Bull.Job) {
index 524aadc27af33365d26d4225323bbcdbd573ce9b..a7c1a556c2b48dd72779dd78dfe9af03574b4857 100644 (file)
@@ -12,7 +12,7 @@ import { AccountModel } from '../../../models/account/account'
 import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
 import { VideoShareModel } from '../../../models/video/video-share'
 import { VideoCommentModel } from '../../../models/video/video-comment'
-import { MAccountDefault, MVideoFullLight } from '../../../typings/models'
+import { MAccountDefault, MVideoFullLight } from '../../../types/models'
 import { ActivitypubHttpFetcherPayload, FetchType } from '@shared/models'
 
 async function processActivityPubHttpFetcher (job: Bull.Job) {
index bcb49a73189ec20bc106c889afee99d0699d04d6..c030d31ef78cd063aecbb4daac6825c4f15a8900 100644 (file)
@@ -1,7 +1,7 @@
 import { buildSignedActivity } from '../../../../helpers/activitypub'
 import { ActorModel } from '../../../../models/activitypub/actor'
 import { ACTIVITY_PUB, HTTP_SIGNATURE } from '../../../../initializers/constants'
-import { MActor } from '../../../../typings/models'
+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'
index ae11f1de3c88dd20350a86c881d58cf1e7c9f7e0..f9bc3137c4dff5b7cd9dffe8c8c437b34048e121 100644 (file)
@@ -6,7 +6,7 @@ import { getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg
 import { copy, stat } from 'fs-extra'
 import { VideoFileModel } from '../../../models/video/video-file'
 import { extname } from 'path'
-import { MVideoFile, MVideoWithFile } from '@server/typings/models'
+import { MVideoFile, MVideoWithFile } from '@server/types/models'
 import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
 import { getVideoFilePath } from '@server/lib/video-paths'
 import { VideoFileImportPayload } from '@shared/models'
index a197ef629c4cb455c458aa576a2e9b7bdea3d0a2..9b5f2bb2ba32daeb5c74673ba9e1692fad05d776 100644 (file)
@@ -5,7 +5,7 @@ import { addOptimizeOrMergeAudioJob } from '@server/helpers/video'
 import { isPostImportVideoAccepted } from '@server/lib/moderation'
 import { Hooks } from '@server/lib/plugins/hooks'
 import { getVideoFilePath } from '@server/lib/video-paths'
-import { MVideoImportDefault, MVideoImportDefaultFiles, MVideoImportVideo } from '@server/typings/models/video/video-import'
+import { MVideoImportDefault, MVideoImportDefaultFiles, MVideoImportVideo } from '@server/types/models/video/video-import'
 import {
   VideoImportPayload,
   VideoImportTorrentPayload,
@@ -27,7 +27,7 @@ import { sequelizeTypescript } from '../../../initializers/database'
 import { VideoModel } from '../../../models/video/video'
 import { VideoFileModel } from '../../../models/video/video-file'
 import { VideoImportModel } from '../../../models/video/video-import'
-import { MThumbnail } from '../../../typings/models/video/thumbnail'
+import { MThumbnail } from '../../../types/models/video/thumbnail'
 import { federateVideoIfNeeded } from '../../activitypub/videos'
 import { Notifier } from '../../notifier'
 import { generateVideoMiniature } from '../../thumbnail'
index 46d52e1cf043a6424e0b57e119b15f8a01349420..ce1c419e7aaab17c64b863b11ca8ea4fc198ec07 100644 (file)
@@ -15,7 +15,7 @@ import { computeResolutionsToTranscode } from '../../../helpers/ffmpeg-utils'
 import { generateHlsPlaylist, mergeAudioVideofile, optimizeOriginalVideofile, transcodeNewResolution } from '../../video-transcoding'
 import { Notifier } from '../../notifier'
 import { CONFIG } from '../../../initializers/config'
-import { MVideoFullLight, MVideoUUID, MVideoWithFile } from '@server/typings/models'
+import { MVideoFullLight, MVideoUUID, MVideoWithFile } from '@server/types/models'
 
 async function processVideoTranscoding (job: Bull.Job) {
   const payload = job.data as VideoTranscodingPayload
index 4afebb32af66cd803ccbb6d4c8fc064dd919522d..60d1b40537f3a88f53efe8e1922f059dced1f06f 100644 (file)
@@ -9,7 +9,7 @@ import { ActorModel } from '../models/activitypub/actor'
 import { VideoCommentObject } from '../../shared/models/activitypub/objects/video-comment-object'
 import { VideoFileModel } from '@server/models/video/video-file'
 import { PathLike } from 'fs-extra'
-import { MUser } from '@server/typings/models'
+import { MUser } from '@server/types/models'
 
 export type AcceptResult = {
   accepted: boolean
index 89f91e0311c6db307f7ff4a1c294c207dfae431f..943a087d2e8315bb575b29803aa5b03403c3a813 100644 (file)
@@ -7,8 +7,8 @@ import {
   MUserNotifSettingAccount,
   MUserWithNotificationSetting,
   UserNotificationModelForApi
-} from '@server/typings/models/user'
-import { MVideoImportVideo } from '@server/typings/models/video/video-import'
+} from '@server/types/models/user'
+import { MVideoImportVideo } from '@server/types/models/video/video-import'
 import { UserNotificationSettingValue, UserNotificationType, UserRight } from '../../shared/models/users'
 import { VideoAbuse, VideoPrivacy, VideoState } from '../../shared/models/videos'
 import { logger } from '../helpers/logger'
@@ -16,7 +16,7 @@ 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 { MAccountServer, MActorFollowFull } from '../typings/models'
+import { MAccountServer, MActorFollowFull } from '../types/models'
 import {
   MCommentOwnerVideo,
   MVideoAbuseVideo,
@@ -24,7 +24,7 @@ import {
   MVideoBlacklistLightVideo,
   MVideoBlacklistVideo,
   MVideoFullLight
-} from '../typings/models/video'
+} from '../types/models/video'
 import { isBlockedByServerOrAccount } from './blocklist'
 import { Emailer } from './emailer'
 import { PeerTubeSocket } from './peertube-socket'
index db546efb16c10deaa043ab8de977e2a66d861c59..3273c6c2d485bacc345db5da47afe1f6ea5be024 100644 (file)
@@ -8,8 +8,8 @@ import { LRU_CACHE } from '../initializers/constants'
 import { Transaction } from 'sequelize'
 import { CONFIG } from '../initializers/config'
 import * as LRUCache from 'lru-cache'
-import { MOAuthTokenUser } from '@server/typings/models/oauth/oauth-token'
-import { MUser } from '@server/typings/models/user/user'
+import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
+import { MUser } from '@server/types/models/user/user'
 import { UserAdminFlag } from '@shared/models/users/user-flag.model'
 import { createUserAccountAndChannelAndPlaylist } from './user'
 import { UserRole } from '@shared/models/users/user-role'
index 26ced351f3333cf1dfe756dc333ad95653c9ff88..2e4b15b380e16f5f772e6e3c8629569a6f32d6b1 100644 (file)
@@ -2,7 +2,7 @@ import * as SocketIO from 'socket.io'
 import { authenticateSocket } from '../middlewares'
 import { logger } from '../helpers/logger'
 import { Server } from 'http'
-import { UserNotificationModelForApi } from '@server/typings/models/user'
+import { UserNotificationModelForApi } from '@server/types/models/user'
 
 class PeerTubeSocket {
 
index 950acf7ad75a3cca34c120cecfd5a0369caf0dcd..7fda5d9a4beadf93796d8f6131807b1438f572de 100644 (file)
@@ -21,7 +21,7 @@ import { ClientHtml } from '../client-html'
 import { PluginTranslation } from '../../../shared/models/plugins/plugin-translation.model'
 import { RegisterHelpersStore } from './register-helpers-store'
 import { RegisterServerHookOptions } from '@shared/models/plugins/register-server-hook.model'
-import { MOAuthTokenUser, MUser } from '@server/typings/models'
+import { MOAuthTokenUser, MUser } from '@server/types/models'
 import { RegisterServerAuthPassOptions, RegisterServerAuthExternalOptions } from '@shared/models/plugins/register-server-auth.model'
 
 export interface RegisteredPlugin {
index 361b401a50db342618160af53880dd87fe4f695b..da620b607aa98db1d31d4e598d5490205a5db3f6 100644 (file)
@@ -1,7 +1,7 @@
 import { VideoRedundancyModel } from '../models/redundancy/video-redundancy'
 import { sendUndoCacheFile } from './activitypub/send'
 import { Transaction } from 'sequelize'
-import { MActorSignature, MVideoRedundancyVideo } from '@server/typings/models'
+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'
index d32c1c06897573cdc0e83b1c867634da72503d40..3e75babcbc65bc35c4cf822383db34b6c4732acd 100644 (file)
@@ -6,7 +6,7 @@ import { federateVideoIfNeeded } from '../activitypub/videos'
 import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'
 import { Notifier } from '../notifier'
 import { sequelizeTypescript } from '../../initializers/database'
-import { MVideoFullLight } from '@server/typings/models'
+import { MVideoFullLight } from '@server/types/models'
 
 export class UpdateVideosScheduler extends AbstractScheduler {
 
index 8da9d52b50b5ad85af628ba912a8594c3a47a656..54d9a9894c93994d0d4e351b350f3e457d6dc71e 100644 (file)
@@ -22,7 +22,7 @@ import {
   MVideoRedundancyStreamingPlaylistVideo,
   MVideoRedundancyVideo,
   MVideoWithAllFiles
-} from '@server/typings/models'
+} from '@server/types/models'
 import { getVideoFilename } from '../video-paths'
 import { VideoModel } from '@server/models/video/video'
 import { getServerActor } from '@server/models/application/application'
index 8dbd417711bb8cfdd1a297f94db31b54c9c7893b..78d2f69e39bcf45b69f500a125b918ac9ca3f247 100644 (file)
@@ -6,9 +6,9 @@ import { ThumbnailType } from '../../shared/models/videos/thumbnail.type'
 import { processImage } from '../helpers/image-utils'
 import { join } from 'path'
 import { downloadImage } from '../helpers/requests'
-import { MVideoPlaylistThumbnail } from '../typings/models/video/video-playlist'
-import { MVideoFile, MVideoThumbnail } from '../typings/models'
-import { MThumbnail } from '../typings/models/video/thumbnail'
+import { MVideoPlaylistThumbnail } from '../types/models/video/video-playlist'
+import { MVideoFile, MVideoThumbnail } from '../types/models'
+import { MThumbnail } from '../types/models/video/thumbnail'
 import { getVideoFilePath } from './video-paths'
 
 type ImageSize = { height: number, width: number }
index 8b447583e12c4cabc8a51af69ac2d9ddcbaa491d..43eef8ab17571b933a15cad8aa2b04de51a98d71 100644 (file)
@@ -12,8 +12,8 @@ import { sequelizeTypescript } from '../initializers/database'
 import { Transaction } from 'sequelize/types'
 import { Redis } from './redis'
 import { Emailer } from './emailer'
-import { MAccountDefault, MActorDefault, MChannelActor } from '../typings/models'
-import { MUser, MUserDefault, MUserId } from '../typings/models/user'
+import { MAccountDefault, MActorDefault, MChannelActor } from '../types/models'
+import { MUser, MUserDefault, MUserId } from '../types/models/user'
 import { getAccountActivityPubUrl } from './activitypub/url'
 
 type ChannelNames = { name: string, displayName: string }
index 1ee92d22c61ea6faa39f3c7598f861f513feb234..bdbcffda668c242262d1d33915dfb7de331de312 100644 (file)
@@ -7,7 +7,7 @@ import {
   MVideoBlacklistVideo,
   MVideoFullLight,
   MVideoWithBlacklistLight
-} from '@server/typings/models'
+} from '@server/types/models'
 import { UserRight, VideoBlacklistCreate, VideoBlacklistType } from '../../shared/models'
 import { UserAdminFlag } from '../../shared/models/users/user-flag.model'
 import { logger } from '../helpers/logger'
index 102c1088d790cd7709893273a5eab8e447ea1e71..8928dda1289a540aa8d332974a9253859defb4e5 100644 (file)
@@ -4,7 +4,7 @@ import { VideoChannelCreate } from '../../shared/models'
 import { VideoChannelModel } from '../models/video/video-channel'
 import { buildActorInstance } from './activitypub/actor'
 import { VideoModel } from '../models/video/video'
-import { MAccountId, MChannelDefault, MChannelId } from '../typings/models'
+import { MAccountId, MChannelDefault, MChannelId } from '../types/models'
 import { getVideoChannelActivityPubUrl } from './activitypub/url'
 import { federateVideoIfNeeded } from './activitypub/videos'
 
index 97aa639fbdc278475cd6c738cc7b5df2b9f5c85e..c92a7c43a1107aa31cd53dc5c328dee2df435f6c 100644 (file)
@@ -5,7 +5,7 @@ import { sequelizeTypescript } from '@server/initializers/database'
 import { ResultList } from '../../shared/models'
 import { VideoCommentThreadTree } from '../../shared/models/videos/video-comment.model'
 import { VideoCommentModel } from '../models/video/video-comment'
-import { MAccountDefault, MComment, MCommentOwnerVideoReply, MVideoFullLight, MCommentOwnerVideo } from '../typings/models'
+import { MAccountDefault, MComment, MCommentOwnerVideoReply, MVideoFullLight, MCommentOwnerVideo } from '../types/models'
 import { sendCreateVideoComment, sendDeleteVideoComment } from './activitypub/send'
 import { getVideoCommentActivityPubUrl } from './activitypub/url'
 import { Hooks } from './plugins/hooks'
index 05aaca8afd64ddc104df02be39fcca27dd08cf2a..a35661f02823c88ad847eef944a9769ae3aa0979 100644 (file)
@@ -1,4 +1,4 @@
-import { isStreamingPlaylist, MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoUUID } from '@server/typings/models'
+import { isStreamingPlaylist, MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoUUID } from '@server/types/models'
 import { join } from 'path'
 import { CONFIG } from '@server/initializers/config'
 import { HLS_REDUNDANCY_DIRECTORY, HLS_STREAMING_PLAYLIST_DIRECTORY } from '@server/initializers/constants'
index 75fbd68966c5070693ad92c777c43d9d55c84ed6..6eeb70c8e7f964bd44a949efc557602b092ab7de 100644 (file)
@@ -3,8 +3,8 @@ import { VideoPlaylistModel } from '../models/video/video-playlist'
 import { VideoPlaylistPrivacy } from '../../shared/models/videos/playlist/video-playlist-privacy.model'
 import { getVideoPlaylistActivityPubUrl } from './activitypub/url'
 import { VideoPlaylistType } from '../../shared/models/videos/playlist/video-playlist-type.model'
-import { MAccount } from '../typings/models'
-import { MVideoPlaylistOwner } from '../typings/models/video/video-playlist'
+import { MAccount } from '../types/models'
+import { MVideoPlaylistOwner } from '../types/models/video/video-playlist'
 
 async function createWatchLaterPlaylist (account: MAccount, t: Sequelize.Transaction) {
   const videoPlaylist: MVideoPlaylistOwner = new VideoPlaylistModel({
index dcda82e0a169ad549813062cd68eada603662181..628f22f5ea9b8052c414e335900b87cdcf119e7d 100644 (file)
@@ -17,7 +17,7 @@ import { updateMasterHLSPlaylist, updateSha256Segments } from './hls'
 import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist'
 import { VideoStreamingPlaylistType } from '../../shared/models/videos/video-streaming-playlist.type'
 import { CONFIG } from '../initializers/config'
-import { MStreamingPlaylistFilesVideo, MVideoFile, MVideoWithAllFiles, MVideoWithFile } from '@server/typings/models'
+import { MStreamingPlaylistFilesVideo, MVideoFile, MVideoWithAllFiles, MVideoWithFile } from '@server/types/models'
 import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
 import { generateVideoStreamingPlaylistName, getVideoFilename, getVideoFilePath } from './video-paths'
 
index 7808135f73c18298205129ef65dc59ef35e310a5..2c1ddf2df5ede6e53e848c38579154979471c7fa 100644 (file)
@@ -9,7 +9,7 @@ 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/typings/models'
+import { MActorFollowActorsDefault } from '@server/types/models'
 import { isFollowStateValid } from '@server/helpers/custom-validators/follows'
 import { getServerActor } from '@server/models/application/application'
 
index 3bdbcdf6a349cdcad74ced6392be1aebf6b2ddf5..4a9ed6830b750b3e24bfe6a6df3a56d0776e955c 100644 (file)
@@ -35,7 +35,7 @@ import { isThemeNameValid } from '../../helpers/custom-validators/plugins'
 import { isThemeRegistered } from '../../lib/plugins/theme-utils'
 import { doesVideoExist } from '../../helpers/middlewares'
 import { UserRole } from '../../../shared/models/users'
-import { MUserDefault } from '@server/typings/models'
+import { MUserDefault } from '@server/types/models'
 import { Hooks } from '@server/lib/plugins/hooks'
 
 const usersAddValidator = [
index 6604ae6a880bb0bef9e627826560eb3337f5a600..2e4e755e78f847e10413d077cd18de00f3a6dfe3 100644 (file)
@@ -1,7 +1,7 @@
 import * as express from 'express'
 import { body, param, query } from 'express-validator'
 import { VIDEO_CHANNELS } from '@server/initializers/constants'
-import { MChannelAccountDefault, MUser } from '@server/typings/models'
+import { MChannelAccountDefault, MUser } from '@server/types/models'
 import { UserRight } from '../../../../shared'
 import { isActorPreferredUsernameValid } from '../../../helpers/custom-validators/activitypub/actor'
 import { isBooleanValid, toBooleanOrNull } from '../../../helpers/custom-validators/misc'
index 4846a5e9e391f20b636a693ed44baa0a05779664..ef019fcf915f126f622c4c3df08d7dec00fe21c5 100644 (file)
@@ -1,6 +1,6 @@
 import * as express from 'express'
 import { body, param } from 'express-validator'
-import { MUserAccountUrl } from '@server/typings/models'
+import { MUserAccountUrl } from '@server/types/models'
 import { UserRight } from '../../../../shared'
 import { isIdOrUUIDValid, isIdValid } from '../../../helpers/custom-validators/misc'
 import { isValidVideoCommentText } from '../../../helpers/custom-validators/video-comments'
@@ -9,7 +9,7 @@ import { doesVideoExist } from '../../../helpers/middlewares'
 import { AcceptResult, isLocalVideoCommentReplyAccepted, isLocalVideoThreadAccepted } from '../../../lib/moderation'
 import { Hooks } from '../../../lib/plugins/hooks'
 import { VideoCommentModel } from '../../../models/video/video-comment'
-import { MCommentOwnerVideoReply, MVideo, MVideoFullLight, MVideoId } from '../../../typings/models/video'
+import { MCommentOwnerVideoReply, MVideo, MVideoFullLight, MVideoId } from '../../../types/models/video'
 import { areValidationErrors } from '../utils'
 
 const listVideoCommentThreadsValidator = [
index 6b15c5464a8ad70a7090743106f5c94c7ff06fa6..07fd8533c7e813c41395bb922c0aa1468c0376ee 100644 (file)
@@ -27,8 +27,8 @@ import { authenticatePromiseIfNeeded } from '../../oauth'
 import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model'
 import { VideoPlaylistType } from '../../../../shared/models/videos/playlist/video-playlist-type.model'
 import { doesVideoChannelIdExist, doesVideoExist, doesVideoPlaylistExist, VideoPlaylistFetchType } from '../../../helpers/middlewares'
-import { MVideoPlaylist } from '../../../typings/models/video/video-playlist'
-import { MUserAccountId } from '@server/typings/models'
+import { MVideoPlaylist } from '../../../types/models/video/video-playlist'
+import { MUserAccountId } from '@server/types/models'
 
 const videoPlaylistsAddValidator = getCommonPlaylistEditAttributes().concat([
   body('displayName')
index 867c05fc13f8152dca39732973f07adb3e9882ab..40a34d3b8951842556024c4264eeb020dd4738be 100644 (file)
@@ -47,7 +47,7 @@ import {
   doesVideoExist,
   doesVideoFileOfVideoExist
 } from '../../../helpers/middlewares'
-import { MVideoFullLight } from '@server/typings/models'
+import { MVideoFullLight } from '@server/types/models'
 import { getVideoWithAttributes } from '../../../helpers/video'
 import { getServerActor } from '@server/models/application/application'
 
index 2c6b756d20d3c613a1707ec7e529a06ff1861f1a..cf8872fd5f9153976fb7beca3fd79557d26ce121 100644 (file)
@@ -4,7 +4,7 @@ import { getSort, searchAttribute } from '../utils'
 import { AccountBlock } from '../../../shared/models/blocklist'
 import { Op } from 'sequelize'
 import * as Bluebird from 'bluebird'
-import { MAccountBlocklist, MAccountBlocklistAccounts, MAccountBlocklistFormattable } from '@server/typings/models'
+import { MAccountBlocklist, MAccountBlocklistAccounts, MAccountBlocklistFormattable } from '@server/types/models'
 import { ActorModel } from '../activitypub/actor'
 import { ServerModel } from '../server/server'
 
index 8aeb486d1fef684e65033d4028c1b500b649ad19..5064987dc448672ed8a2fcad2b8e2912cbb8bf4b 100644 (file)
@@ -16,7 +16,7 @@ import {
   MAccountVideoRateAccountUrl,
   MAccountVideoRateAccountVideo,
   MAccountVideoRateFormattable
-} from '@server/typings/models/video/video-rate'
+} from '@server/types/models/video/video-rate'
 
 /*
   Account rates per video.
index ad649837a9825a53405d58dba01e37d4590e0558..4395d179ae471845bb08d66be5794e0de50551d9 100644 (file)
@@ -32,7 +32,7 @@ import { FindOptions, IncludeOptions, Op, Transaction, WhereOptions } from 'sequ
 import { AccountBlocklistModel } from './account-blocklist'
 import { ServerBlocklistModel } from '../server/server-blocklist'
 import { ActorFollowModel } from '../activitypub/actor-follow'
-import { MAccountActor, MAccountAP, MAccountDefault, MAccountFormattable, MAccountSummaryFormattable, MAccount } from '../../typings/models'
+import { MAccountActor, MAccountAP, MAccountDefault, MAccountFormattable, MAccountSummaryFormattable, MAccount } from '../../types/models'
 import * as Bluebird from 'bluebird'
 import { ModelCache } from '@server/models/model-cache'
 import { VideoModel } from '../video/video'
index dc69a17fda585fa61e0aa329d30a2b326be02046..b69b4726575ebf9447e43468e3531653a328551c 100644 (file)
@@ -17,7 +17,7 @@ import { UserModel } from './user'
 import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications'
 import { UserNotificationSetting, UserNotificationSettingValue } from '../../../shared/models/users/user-notification-setting.model'
 import { clearCacheByUserId } from '../../lib/oauth-model'
-import { MNotificationSettingFormattable } from '@server/typings/models'
+import { MNotificationSettingFormattable } from '@server/types/models'
 
 @Table({
   tableName: 'userNotificationSetting',
index 5a725187a2918f1cb5ed36df1e223379e4d686e3..30985bb0f19cb318f485578353bc250c8eb15a8b 100644 (file)
@@ -16,7 +16,7 @@ import { ActorModel } from '../activitypub/actor'
 import { ActorFollowModel } from '../activitypub/actor-follow'
 import { AvatarModel } from '../avatar/avatar'
 import { ServerModel } from '../server/server'
-import { UserNotificationIncludes, UserNotificationModelForApi } from '@server/typings/models/user'
+import { UserNotificationIncludes, UserNotificationModelForApi } from '@server/types/models/user'
 
 enum ScopeNames {
   WITH_ALL = 'WITH_ALL'
index 522eebeaf92206ca897c6b106aa138177ea6cc74..76b469fbfa77a1c079e5df40e6e6b51c3dd82643 100644 (file)
@@ -2,7 +2,7 @@ import { AllowNull, BelongsTo, Column, CreatedAt, ForeignKey, IsInt, Model, Tabl
 import { VideoModel } from '../video/video'
 import { UserModel } from './user'
 import { DestroyOptions, Op, Transaction } from 'sequelize'
-import { MUserAccountId, MUserId } from '@server/typings/models'
+import { MUserAccountId, MUserId } from '@server/types/models'
 
 @Table({
   tableName: 'userVideoHistory',
index fbd3080c6a82c5803c716f970bb4ea3d083537b4..3bde1e7445ce7c4f5852887bbaf5d55a1c232368 100644 (file)
@@ -68,7 +68,7 @@ import {
   MUserNotifSettingChannelDefault,
   MUserWithNotificationSetting,
   MVideoFullLight
-} from '@server/typings/models'
+} from '@server/types/models'
 
 enum ScopeNames {
   FOR_ME_API = 'FOR_ME_API',
index 85a371026676cea9bfbc9bafaaf72faa407183f3..3e85cc329e9569b2a0226602056782c7d4d11778 100644 (file)
@@ -33,7 +33,7 @@ import {
   MActorFollowFollowingHost,
   MActorFollowFormattable,
   MActorFollowSubscriptions
-} from '@server/typings/models'
+} from '@server/types/models'
 import { ActivityPubActorType } from '@shared/models'
 import { VideoModel } from '@server/models/video/video'
 import { getServerActor } from '@server/models/application/application'
index 34bc917061749571b3a89d3e989e5bf02b206822..b6dacc534441bd53784707306a9a25cc7bfcbaa4 100644 (file)
@@ -45,7 +45,7 @@ import {
   MActorServer,
   MActorSummaryFormattable, MActorUrl,
   MActorWithInboxes
-} from '../../typings/models'
+} from '../../types/models'
 import * as Bluebird from 'bluebird'
 import { Op, Transaction, literal } from 'sequelize'
 import { ModelCache } from '@server/models/model-cache'
index 950e4b181464626a68b8058e8b4f28a9d7db94ee..d874dec990df841f2d624e0ad7f0ccb383622bea 100644 (file)
@@ -7,7 +7,7 @@ import { remove } from 'fs-extra'
 import { CONFIG } from '../../initializers/config'
 import { throwIfNotValid } from '../utils'
 import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
-import { MAvatarFormattable } from '@server/typings/models'
+import { MAvatarFormattable } from '@server/types/models'
 
 @Table({
   tableName: 'avatar',
index 38953e8ad0aefd1b5a48d6dbeec5291f8e9e5d6e..7f2313dad169588ca1f8a875acf438e7c3f729b9 100644 (file)
@@ -19,7 +19,7 @@ import { AccountModel } from '../account/account'
 import { ActorModel } from '../activitypub/actor'
 import { clearCacheByToken } from '../../lib/oauth-model'
 import * as Bluebird from 'bluebird'
-import { MOAuthTokenUser } from '@server/typings/models/oauth/oauth-token'
+import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
 
 export type OAuthTokenInfo = {
   refreshToken: string
index 6021408bfeedc30300cd781baeb1dc56dfc39612..1c8b2cf782ea123a25bbf382e5f00bdee2da02c4 100644 (file)
@@ -29,7 +29,7 @@ import * as Bluebird from 'bluebird'
 import { col, FindOptions, fn, literal, Op, Transaction, WhereOptions } from 'sequelize'
 import { VideoStreamingPlaylistModel } from '../video/video-streaming-playlist'
 import { CONFIG } from '../../initializers/config'
-import { MVideoForRedundancyAPI, MVideoRedundancy, MVideoRedundancyAP, MVideoRedundancyVideo } from '@server/typings/models'
+import { MVideoForRedundancyAPI, MVideoRedundancy, MVideoRedundancyAP, MVideoRedundancyVideo } from '@server/types/models'
 import { VideoRedundanciesTarget } from '@shared/models/redundancy/video-redundancies-filters.model'
 import {
   FileRedundancyInformation,
index 53b6227d71708eac64c6866636cd977b2bc4d8ee..95fb386b557b54ad54cdbbf4f9ae13ccc83ee4cf 100644 (file)
@@ -1,7 +1,7 @@
 import * as Bluebird from 'bluebird'
 import { FindAndCountOptions, json, QueryTypes } from 'sequelize'
 import { AllowNull, Column, CreatedAt, DataType, DefaultScope, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'
-import { MPlugin, MPluginFormattable } from '@server/typings/models'
+import { MPlugin, MPluginFormattable } from '@server/types/models'
 import { PeerTubePlugin } from '../../../shared/models/plugins/peertube-plugin.model'
 import { PluginType } from '../../../shared/models/plugins/plugin.type'
 import { RegisterServerSettingOptions } from '../../../shared/models/plugins/register-server-setting.model'
index ad8e3d1e88e30694cac7185fba19fc525a20cd2c..30f0525e54a4d941f21b47a29f74187b0767a513 100644 (file)
@@ -4,7 +4,7 @@ import { ServerModel } from './server'
 import { ServerBlock } from '../../../shared/models/blocklist'
 import { getSort, searchAttribute } from '../utils'
 import * as Bluebird from 'bluebird'
-import { MServerBlocklist, MServerBlocklistAccountServer, MServerBlocklistFormattable } from '@server/typings/models'
+import { MServerBlocklist, MServerBlocklistAccountServer, MServerBlocklistFormattable } from '@server/types/models'
 import { Op } from 'sequelize'
 
 enum ScopeNames {
index 5131257ec3d65bd6a8cb13b6c1729b284153345a..7712007971b7bd2108749642788a94687cb3556d 100644 (file)
@@ -4,7 +4,7 @@ import { ActorModel } from '../activitypub/actor'
 import { throwIfNotValid } from '../utils'
 import { ServerBlocklistModel } from './server-blocklist'
 import * as Bluebird from 'bluebird'
-import { MServer, MServerFormattable } from '@server/typings/models/server'
+import { MServer, MServerFormattable } from '@server/types/models/server'
 
 @Table({
   tableName: 'server',
index 00b7f55247dd034738ca5defa3589c8f66c9fc2c..1ce6bbfe522b383daa4da65dc8126a142adf76a7 100644 (file)
@@ -2,7 +2,7 @@ import { AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, Model, Ta
 import { ScopeNames as VideoScopeNames, VideoModel } from './video'
 import { VideoPrivacy } from '../../../shared/models/videos'
 import { Op, Transaction } from 'sequelize'
-import { MScheduleVideoUpdateFormattable, MScheduleVideoUpdateVideoAll } from '@server/typings/models'
+import { MScheduleVideoUpdateFormattable, MScheduleVideoUpdateVideoAll } from '@server/types/models'
 
 @Table({
   tableName: 'scheduleVideoUpdate',
index ed8df8b48aa84367003161035dda9256eac13c76..adbc4fb7d6c22b2d2015399cafbdef4589575ec4 100644 (file)
@@ -6,7 +6,7 @@ import { throwIfNotValid } from '../utils'
 import { VideoModel } from './video'
 import { VideoTagModel } from './video-tag'
 import { VideoPrivacy, VideoState } from '../../../shared/models/videos'
-import { MTag } from '@server/typings/models'
+import { MTag } from '@server/types/models'
 
 @Table({
   tableName: 'tag',
index e396784d29124f7f43af55c855c561b5d9506ce2..20c1e5858a13e7d5478499ebaef8e42567429d0a 100644 (file)
@@ -19,7 +19,7 @@ import { CONFIG } from '../../initializers/config'
 import { VideoModel } from './video'
 import { VideoPlaylistModel } from './video-playlist'
 import { ThumbnailType } from '../../../shared/models/videos/thumbnail.type'
-import { MVideoAccountLight } from '@server/typings/models'
+import { MVideoAccountLight } from '@server/types/models'
 import { buildRemoteVideoBaseUrl } from '@server/helpers/activitypub'
 
 @Table({
index 40f0ce12b5f5b3370d6c90555070bf2be8e2d6cb..b2f11133726847a8d7acaa15e969b271b1745f2a 100644 (file)
@@ -24,7 +24,7 @@ import {
   isVideoAbuseStateValid
 } from '../../helpers/custom-validators/video-abuses'
 import { CONSTRAINTS_FIELDS, VIDEO_ABUSE_STATES } from '../../initializers/constants'
-import { MUserAccountId, MVideoAbuse, MVideoAbuseFormattable, MVideoAbuseVideo } from '../../typings/models'
+import { MUserAccountId, MVideoAbuse, MVideoAbuseFormattable, MVideoAbuseVideo } from '../../types/models'
 import { AccountModel } from '../account/account'
 import { buildBlockedAccountSQL, getSort, searchAttribute, throwIfNotValid } from '../utils'
 import { ThumbnailModel } from './thumbnail'
index 8cbfe362e87e87646df9ce4ef312b2c06fa61c63..36d2a30fa8585b5fb01f2b1e2a85b218f050b2cb 100644 (file)
@@ -8,7 +8,7 @@ import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
 import { FindOptions } from 'sequelize'
 import { ThumbnailModel } from './thumbnail'
 import * as Bluebird from 'bluebird'
-import { MVideoBlacklist, MVideoBlacklistFormattable } from '@server/typings/models'
+import { MVideoBlacklist, MVideoBlacklistFormattable } from '@server/types/models'
 
 @Table({
   tableName: 'videoBlacklist',
index 59d3e105085697fd7e228f450c11706a86a1a911..b68a6e99f01a1c9a1f03b6df6f3abe8808d44c74 100644 (file)
@@ -23,7 +23,7 @@ import { logger } from '../../helpers/logger'
 import { remove } from 'fs-extra'
 import { CONFIG } from '../../initializers/config'
 import * as Bluebird from 'bluebird'
-import { MVideoAccountLight, MVideoCaptionFormattable, MVideoCaptionVideo } from '@server/typings/models'
+import { MVideoAccountLight, MVideoCaptionFormattable, MVideoCaptionVideo } from '@server/types/models'
 import { buildRemoteVideoBaseUrl } from '@server/helpers/activitypub'
 
 export enum ScopeNames {
index 3259b6c0208d6b7b63d8739d3668c04257a99d8d..aecb03c14713aed661c8d3456fd08a119da1fadd 100644 (file)
@@ -3,7 +3,7 @@ import { AccountModel } from '../account/account'
 import { ScopeNames as VideoScopeNames, VideoModel } from './video'
 import { VideoChangeOwnership, VideoChangeOwnershipStatus } from '../../../shared/models/videos'
 import { getSort } from '../utils'
-import { MVideoChangeOwnershipFormattable, MVideoChangeOwnershipFull } from '@server/typings/models/video/video-change-ownership'
+import { MVideoChangeOwnershipFormattable, MVideoChangeOwnershipFull } from '@server/types/models/video/video-change-ownership'
 import * as Bluebird from 'bluebird'
 
 enum ScopeNames {
index a4231b6b3756322bcc68f21aee5c409af4383a01..9cee64229a54603ec79aebd88e575ae7ad26fe11 100644 (file)
@@ -41,7 +41,7 @@ import {
   MChannelAP,
   MChannelFormattable,
   MChannelSummaryFormattable
-} from '../../typings/models/video'
+} from '../../types/models/video'
 
 export enum ScopeNames {
   FOR_API = 'FOR_API',
index cf2a80d531516ab2f2d287a9c7da3b4718ad5a71..091cc2a88b77eca3e881925944ecaf32026a51a3 100644 (file)
@@ -3,7 +3,7 @@ import { uniq } from 'lodash'
 import { FindOptions, Op, Order, ScopeOptions, Sequelize, Transaction } from 'sequelize'
 import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Is, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript'
 import { getServerActor } from '@server/models/application/application'
-import { MAccount, MAccountId, MUserAccountId } from '@server/typings/models'
+import { MAccount, MAccountId, MUserAccountId } from '@server/types/models'
 import { VideoPrivacy } from '@shared/models'
 import { ActivityTagObject, ActivityTombstoneObject } from '../../../shared/models/activitypub/objects/common-objects'
 import { VideoCommentObject } from '../../../shared/models/activitypub/objects/video-comment-object'
@@ -23,7 +23,7 @@ import {
   MCommentOwnerVideoFeed,
   MCommentOwnerVideoReply,
   MVideoImmutable
-} from '../../typings/models/video'
+} from '../../types/models/video'
 import { AccountModel } from '../account/account'
 import { ActorModel, unusedActorAttributesForAPI } from '../activitypub/actor'
 import { buildBlockedAccountSQL, buildLocalAccountIdsIn, getCommentSort, throwIfNotValid } from '../utils'
index 201f0c0f1410d25201a632f05f47e58a0a048c04..f9502238396397337f6b52d23e148337dd9e166e 100644 (file)
@@ -27,8 +27,8 @@ import { VideoRedundancyModel } from '../redundancy/video-redundancy'
 import { VideoStreamingPlaylistModel } from './video-streaming-playlist'
 import { FindOptions, Op, QueryTypes, Transaction } from 'sequelize'
 import { MIMETYPES, MEMOIZE_LENGTH, MEMOIZE_TTL } from '../../initializers/constants'
-import { MVideoFile, MVideoFileStreamingPlaylistVideo, MVideoFileVideo } from '../../typings/models/video/video-file'
-import { MStreamingPlaylistVideo, MVideo } from '@server/typings/models'
+import { MVideoFile, MVideoFileStreamingPlaylistVideo, MVideoFileVideo } from '../../types/models/video/video-file'
+import { MStreamingPlaylistVideo, MVideo } from '@server/types/models'
 import * as memoizee from 'memoizee'
 import validator from 'validator'
 
index 89b0f50500b3cd0a39da31386d27b3b9870d0279..9b6509dfd6540b6df68078adcf01cf38b5ea7da4 100644 (file)
@@ -19,8 +19,8 @@ import {
   MVideoFile,
   MVideoFormattable,
   MVideoFormattableDetails
-} from '../../typings/models'
-import { MVideoFileRedundanciesOpt } from '../../typings/models/video/video-file'
+} from '../../types/models'
+import { MVideoFileRedundanciesOpt } from '../../types/models/video/video-file'
 import { VideoFile } from '@shared/models/videos/video-file.model'
 import { generateMagnetUri } from '@server/helpers/webtorrent'
 import { extractVideo } from '@server/helpers/video'
index fbe0ee0a740844ae5094b538951f4645ed32be69..ea1e085af73d6ac2556254581a32a32f0d74c98c 100644 (file)
@@ -21,7 +21,7 @@ import { VideoImport, VideoImportState } from '../../../shared'
 import { isVideoMagnetUriValid } from '../../helpers/custom-validators/videos'
 import { UserModel } from '../account/user'
 import * as Bluebird from 'bluebird'
-import { MVideoImportDefault, MVideoImportFormattable } from '@server/typings/models/video/video-import'
+import { MVideoImportDefault, MVideoImportFormattable } from '@server/types/models/video/video-import'
 
 @DefaultScope(() => ({
   include: [
index 9ea73e82ee9e5192bbd23020144991ba30c130f9..ba92e129ac5b8c8efe88b33be5ac4a7749784f20 100644 (file)
@@ -31,8 +31,8 @@ import {
   MVideoPlaylistElementFormattable,
   MVideoPlaylistElementVideoUrlPlaylistPrivacy,
   MVideoPlaylistVideoThumbnail
-} from '@server/typings/models/video/video-playlist-element'
-import { MUserAccountId } from '@server/typings/models'
+} from '@server/types/models/video/video-playlist-element'
+import { MUserAccountId } from '@server/types/models'
 
 @Table({
   tableName: 'videoPlaylistElement',
index d66518c9f2d7568c4a6c465d676cde572843fd16..51fe04fc487a1627c3c0459cb3ab1974f231ae47 100644 (file)
@@ -51,9 +51,9 @@ import {
   MVideoPlaylistFull,
   MVideoPlaylistFullSummary,
   MVideoPlaylistIdWithElements
-} from '../../typings/models/video/video-playlist'
-import { MThumbnail } from '../../typings/models/video/thumbnail'
-import { MAccountId, MChannelId } from '@server/typings/models'
+} from '../../types/models/video/video-playlist'
+import { MThumbnail } from '../../types/models/video/thumbnail'
+import { MAccountId, MChannelId } from '@server/types/models'
 
 enum ScopeNames {
   AVAILABLE_FOR_LIST = 'AVAILABLE_FOR_LIST',
index 6211c9e565acee0c1b2500da83fe5c0f1f6f267e..984b0e6af2db32a25727f827a7fa01b906cb2b7c 100644 (file)
@@ -1,7 +1,7 @@
 import { VideoFilter, VideoPrivacy, VideoState } from '@shared/models'
 import { buildDirectionAndField, createSafeIn } from '@server/models/utils'
 import { Model } from 'sequelize-typescript'
-import { MUserAccountId, MUserId } from '@server/typings/models'
+import { MUserAccountId, MUserId } from '@server/types/models'
 import validator from 'validator'
 import { exists } from '@server/helpers/custom-validators/misc'
 
index 4bbef75e6a547a7c125fe4249555921bfc7f56e1..f9ee94589303e4c7cfa2dccc7e43f88ff39a978e 100644 (file)
@@ -6,8 +6,8 @@ import { ActorModel } from '../activitypub/actor'
 import { buildLocalActorIdsIn, throwIfNotValid } from '../utils'
 import { VideoModel } from './video'
 import { literal, Op, Transaction } from 'sequelize'
-import { MVideoShareActor, MVideoShareFull } from '../../typings/models/video'
-import { MActorDefault } from '../../typings/models'
+import { MVideoShareActor, MVideoShareFull } from '../../types/models/video'
+import { MActorDefault } from '../../types/models'
 
 enum ScopeNames {
   FULL = 'FULL',
index 24959621803f8b270039d406f390687658834ef6..021b9b06326adaa6a221f5c29329c678defad853 100644 (file)
@@ -17,7 +17,7 @@ import { join } from 'path'
 import { sha1 } from '../../helpers/core-utils'
 import { isArrayOf } from '../../helpers/custom-validators/misc'
 import { Op, QueryTypes } from 'sequelize'
-import { MStreamingPlaylist, MStreamingPlaylistVideo, MVideoFile } from '@server/typings/models'
+import { MStreamingPlaylist, MStreamingPlaylistVideo, MVideoFile } from '@server/types/models'
 import { VideoFileModel } from '@server/models/video/video-file'
 import { getTorrentFileName, getTorrentFilePath, getVideoFilename } from '@server/lib/video-paths'
 import * as memoizee from 'memoizee'
index b4efb76ee65cefacee27574d051ec0406222ea9f..e2718300e4f1d86b1cd95e231ab0954a7aa6b6bf 100644 (file)
@@ -117,9 +117,9 @@ import {
   MVideoWithAllFiles,
   MVideoWithFile,
   MVideoWithRights
-} from '../../typings/models'
-import { MVideoFile, MVideoFileStreamingPlaylistVideo } from '../../typings/models/video/video-file'
-import { MThumbnail } from '../../typings/models/video/thumbnail'
+} from '../../types/models'
+import { MVideoFile, MVideoFileStreamingPlaylistVideo } from '../../types/models/video/video-file'
+import { MThumbnail } from '../../types/models/video/thumbnail'
 import { VideoFile } from '@shared/models/videos/video-file.model'
 import { getHLSDirectory, getTorrentFileName, getTorrentFilePath, getVideoFilename, getVideoFilePath } from '@server/lib/video-paths'
 import { ModelCache } from '@server/models/model-cache'
index f8a1c705c6c0290dc8aa1bae46b47f9b9d1a6753..156a8ed2238460bc41bc6b324d922d8767605834 100644 (file)
@@ -1,4 +1,5 @@
 {
   "extends": "../../tsconfig.json",
+  "include": [ ".", "../typings" ],
   "exclude": [ ] // Overwrite exclude property
 }
diff --git a/server/types/activitypub-processor.model.ts b/server/types/activitypub-processor.model.ts
new file mode 100644 (file)
index 0000000..7ed3a65
--- /dev/null
@@ -0,0 +1,9 @@
+import { Activity } from '../../shared/models/activitypub'
+import { MActorDefault, MActorSignature } from './models'
+
+export type APProcessorOptions<T extends Activity> = {
+  activity: T
+  byActor: MActorSignature
+  inboxActor?: MActorDefault
+  fromFetch?: boolean
+}
diff --git a/server/types/models/account/account-blocklist.ts b/server/types/models/account/account-blocklist.ts
new file mode 100644 (file)
index 0000000..0d8bf11
--- /dev/null
@@ -0,0 +1,27 @@
+import { AccountBlocklistModel } from '../../../models/account/account-blocklist'
+import { PickWith } from '../../utils'
+import { MAccountDefault, MAccountFormattable } from './account'
+
+type Use<K extends keyof AccountBlocklistModel, M> = PickWith<AccountBlocklistModel, K, M>
+
+// ############################################################################
+
+export type MAccountBlocklist = Omit<AccountBlocklistModel, 'ByAccount' | 'BlockedAccount'>
+
+// ############################################################################
+
+export type MAccountBlocklistId = Pick<AccountBlocklistModel, 'id'>
+
+export type MAccountBlocklistAccounts =
+  MAccountBlocklist &
+  Use<'ByAccount', MAccountDefault> &
+  Use<'BlockedAccount', MAccountDefault>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MAccountBlocklistFormattable =
+  Pick<MAccountBlocklist, 'createdAt'> &
+  Use<'ByAccount', MAccountFormattable> &
+  Use<'BlockedAccount', MAccountFormattable>
diff --git a/server/types/models/account/account.ts b/server/types/models/account/account.ts
new file mode 100644 (file)
index 0000000..7b826ee
--- /dev/null
@@ -0,0 +1,109 @@
+import { AccountModel } from '../../../models/account/account'
+import {
+  MActor,
+  MActorAP,
+  MActorAPI,
+  MActorAudience,
+  MActorDefault,
+  MActorDefaultLight,
+  MActorFormattable,
+  MActorId,
+  MActorServer,
+  MActorSummary,
+  MActorSummaryFormattable,
+  MActorUrl
+} from './actor'
+import { FunctionProperties, PickWith } from '../../utils'
+import { MAccountBlocklistId } from './account-blocklist'
+import { MChannelDefault } from '../video/video-channels'
+
+type Use<K extends keyof AccountModel, M> = PickWith<AccountModel, K, M>
+
+// ############################################################################
+
+export type MAccount =
+  Omit<AccountModel, 'Actor' | 'User' | 'Application' | 'VideoChannels' | 'VideoPlaylists' |
+  'VideoComments' | 'BlockedAccounts'>
+
+// ############################################################################
+
+// Only some attributes
+export type MAccountId = Pick<MAccount, 'id'>
+export type MAccountUserId = Pick<MAccount, 'userId'>
+
+// Only some Actor attributes
+export type MAccountUrl = Use<'Actor', MActorUrl>
+export type MAccountAudience = Use<'Actor', MActorAudience>
+
+export type MAccountIdActor =
+  MAccountId &
+  Use<'Actor', MActor>
+
+export type MAccountIdActorId =
+  MAccountId &
+  Use<'Actor', MActorId>
+
+// ############################################################################
+
+// Default scope
+export type MAccountDefault =
+  MAccount &
+  Use<'Actor', MActorDefault>
+
+// Default with default association scopes
+export type MAccountDefaultChannelDefault =
+  MAccount &
+  Use<'Actor', MActorDefault> &
+  Use<'VideoChannels', MChannelDefault[]>
+
+// We don't need some actors attributes
+export type MAccountLight =
+  MAccount &
+  Use<'Actor', MActorDefaultLight>
+
+// ############################################################################
+
+// Full actor
+export type MAccountActor =
+  MAccount &
+  Use<'Actor', MActor>
+
+// Full actor with server
+export type MAccountServer =
+  MAccount &
+  Use<'Actor', MActorServer>
+
+// ############################################################################
+
+// For API
+
+export type MAccountSummary =
+  FunctionProperties<MAccount> &
+  Pick<MAccount, 'id' | 'name'> &
+  Use<'Actor', MActorSummary>
+
+export type MAccountSummaryBlocks =
+  MAccountSummary &
+  Use<'BlockedAccounts', MAccountBlocklistId[]>
+
+export type MAccountAPI =
+  MAccount &
+  Use<'Actor', MActorAPI>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MAccountSummaryFormattable =
+  FunctionProperties<MAccount> &
+  Pick<MAccount, 'id' | 'name'> &
+  Use<'Actor', MActorSummaryFormattable>
+
+export type MAccountFormattable =
+  FunctionProperties<MAccount> &
+  Pick<MAccount, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'userId'> &
+  Use<'Actor', MActorFormattable>
+
+export type MAccountAP =
+  Pick<MAccount, 'name' | 'description'> &
+  Use<'Actor', MActorAP>
diff --git a/server/types/models/account/actor-follow.ts b/server/types/models/account/actor-follow.ts
new file mode 100644 (file)
index 0000000..5d0c03c
--- /dev/null
@@ -0,0 +1,70 @@
+import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
+import {
+  MActor,
+  MActorChannelAccountActor,
+  MActorDefault,
+  MActorDefaultAccountChannel,
+  MActorFormattable,
+  MActorHost,
+  MActorUsername
+} from './actor'
+import { PickWith } from '../../utils'
+import { ActorModel } from '@server/models/activitypub/actor'
+import { MChannelDefault } from '../video/video-channels'
+
+type Use<K extends keyof ActorFollowModel, M> = PickWith<ActorFollowModel, K, M>
+
+// ############################################################################
+
+export type MActorFollow = Omit<ActorFollowModel, 'ActorFollower' | 'ActorFollowing'>
+
+// ############################################################################
+
+export type MActorFollowFollowingHost =
+  MActorFollow &
+  Use<'ActorFollowing', MActorUsername & MActorHost>
+
+// ############################################################################
+
+// With actors or actors default
+
+export type MActorFollowActors =
+  MActorFollow &
+  Use<'ActorFollower', MActor> &
+  Use<'ActorFollowing', MActor>
+
+export type MActorFollowActorsDefault =
+  MActorFollow &
+  Use<'ActorFollower', MActorDefault> &
+  Use<'ActorFollowing', MActorDefault>
+
+export type MActorFollowFull =
+  MActorFollow &
+  Use<'ActorFollower', MActorDefaultAccountChannel> &
+  Use<'ActorFollowing', MActorDefaultAccountChannel>
+
+// ############################################################################
+
+// For subscriptions
+
+type SubscriptionFollowing =
+  MActorDefault &
+  PickWith<ActorModel, 'VideoChannel', MChannelDefault>
+
+export type MActorFollowActorsDefaultSubscription =
+  MActorFollow &
+  Use<'ActorFollower', MActorDefault> &
+  Use<'ActorFollowing', SubscriptionFollowing>
+
+export type MActorFollowSubscriptions =
+  MActorFollow &
+  Use<'ActorFollowing', MActorChannelAccountActor>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MActorFollowFormattable =
+  Pick<MActorFollow, 'id' | 'score' | 'state' | 'createdAt' | 'updatedAt'> &
+  Use<'ActorFollower', MActorFormattable> &
+  Use<'ActorFollowing', MActorFormattable>
diff --git a/server/types/models/account/actor.ts b/server/types/models/account/actor.ts
new file mode 100644 (file)
index 0000000..1160e84
--- /dev/null
@@ -0,0 +1,139 @@
+import { ActorModel } from '../../../models/activitypub/actor'
+import { FunctionProperties, PickWith, PickWithOpt } from '../../utils'
+import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account'
+import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server'
+import { MAvatar, MAvatarFormattable } from './avatar'
+import { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video'
+
+type Use<K extends keyof ActorModel, M> = PickWith<ActorModel, K, M>
+
+// ############################################################################
+
+export type MActor = Omit<ActorModel, 'Account' | 'VideoChannel' | 'ActorFollowing' | 'Avatar' | 'ActorFollowers' | 'Server'>
+
+// ############################################################################
+
+export type MActorUrl = Pick<MActor, 'url'>
+export type MActorId = Pick<MActor, 'id'>
+export type MActorUsername = Pick<MActor, 'preferredUsername'>
+
+export type MActorFollowersUrl = Pick<MActor, 'followersUrl'>
+export type MActorAudience = MActorUrl & MActorFollowersUrl
+export type MActorWithInboxes = Pick<ActorModel, 'sharedInboxUrl' | 'inboxUrl' | 'getSharedInbox'>
+export type MActorSignature = MActorAccountChannelId
+
+export type MActorLight = Omit<MActor, 'privateKey' | 'privateKey'>
+
+// ############################################################################
+
+// Some association attributes
+
+export type MActorHost = Use<'Server', MServerHost>
+export type MActorRedundancyAllowedOpt = PickWithOpt<ActorModel, 'Server', MServerRedundancyAllowed>
+
+export type MActorDefaultLight =
+  MActorLight &
+  Use<'Server', MServerHost> &
+  Use<'Avatar', MAvatar>
+
+export type MActorAccountId =
+  MActor &
+  Use<'Account', MAccountId>
+export type MActorAccountIdActor =
+  MActor &
+  Use<'Account', MAccountIdActor>
+
+export type MActorChannelId =
+  MActor &
+  Use<'VideoChannel', MChannelId>
+export type MActorChannelIdActor =
+  MActor &
+  Use<'VideoChannel', MChannelIdActor>
+
+export type MActorAccountChannelId = MActorAccountId & MActorChannelId
+export type MActorAccountChannelIdActor = MActorAccountIdActor & MActorChannelIdActor
+
+// ############################################################################
+
+// Include raw account/channel/server
+
+export type MActorAccount =
+  MActor &
+  Use<'Account', MAccount>
+
+export type MActorChannel =
+  MActor &
+  Use<'VideoChannel', MChannel>
+
+export type MActorDefaultAccountChannel = MActorDefault & MActorAccount & MActorChannel
+
+export type MActorServer =
+  MActor &
+  Use<'Server', MServer>
+
+// ############################################################################
+
+// Complex actor associations
+
+export type MActorDefault =
+  MActor &
+  Use<'Server', MServer> &
+  Use<'Avatar', MAvatar>
+
+// Actor with channel that is associated to an account and its actor
+// Actor -> VideoChannel -> Account -> Actor
+export type MActorChannelAccountActor =
+  MActor &
+  Use<'VideoChannel', MChannelAccountActor>
+
+export type MActorFull =
+  MActor &
+  Use<'Server', MServer> &
+  Use<'Avatar', MAvatar> &
+  Use<'Account', MAccount> &
+  Use<'VideoChannel', MChannelAccountActor>
+
+// Same than ActorFull, but the account and the channel have their actor
+export type MActorFullActor =
+  MActor &
+  Use<'Server', MServer> &
+  Use<'Avatar', MAvatar> &
+  Use<'Account', MAccountDefault> &
+  Use<'VideoChannel', MChannelAccountDefault>
+
+// ############################################################################
+
+// API
+
+export type MActorSummary =
+  FunctionProperties<MActor> &
+  Pick<MActor, 'id' | 'preferredUsername' | 'url' | 'serverId' | 'avatarId'> &
+  Use<'Server', MServerHost> &
+  Use<'Avatar', MAvatar>
+
+export type MActorSummaryBlocks =
+  MActorSummary &
+  Use<'Server', MServerHostBlocks>
+
+export type MActorAPI =
+  Omit<MActorDefault, 'publicKey' | 'privateKey' | 'inboxUrl' | 'outboxUrl' | 'sharedInboxUrl' |
+  'followersUrl' | 'followingUrl' | 'url' | 'createdAt' | 'updatedAt'>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MActorSummaryFormattable =
+  FunctionProperties<MActor> &
+  Pick<MActor, 'url' | 'preferredUsername'> &
+  Use<'Server', MServerHost> &
+  Use<'Avatar', MAvatarFormattable>
+
+export type MActorFormattable =
+  MActorSummaryFormattable &
+  Pick<MActor, 'id' | 'followingCount' | 'followersCount' | 'createdAt' | 'updatedAt'> &
+  Use<'Server', MServerHost & Partial<Pick<MServer, 'redundancyAllowed'>>>
+
+export type MActorAP =
+  MActor &
+  Use<'Avatar', MAvatar>
diff --git a/server/types/models/account/avatar.ts b/server/types/models/account/avatar.ts
new file mode 100644 (file)
index 0000000..6eba59e
--- /dev/null
@@ -0,0 +1,12 @@
+import { AvatarModel } from '../../../models/avatar/avatar'
+import { FunctionProperties } from '@server/types/utils'
+
+export type MAvatar = AvatarModel
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MAvatarFormattable =
+  FunctionProperties<MAvatar> &
+  Pick<MAvatar, 'filename' | 'createdAt' | 'updatedAt'>
diff --git a/server/types/models/account/index.ts b/server/types/models/account/index.ts
new file mode 100644 (file)
index 0000000..513c09c
--- /dev/null
@@ -0,0 +1,5 @@
+export * from './account'
+export * from './account-blocklist'
+export * from './actor'
+export * from './actor-follow'
+export * from './avatar'
diff --git a/server/types/models/index.ts b/server/types/models/index.ts
new file mode 100644 (file)
index 0000000..78b4948
--- /dev/null
@@ -0,0 +1,5 @@
+export * from './account'
+export * from './oauth'
+export * from './server'
+export * from './user'
+export * from './video'
diff --git a/server/types/models/oauth/index.ts b/server/types/models/oauth/index.ts
new file mode 100644 (file)
index 0000000..36b7ea8
--- /dev/null
@@ -0,0 +1,2 @@
+export * from './oauth-client'
+export * from './oauth-token'
diff --git a/server/types/models/oauth/oauth-client.ts b/server/types/models/oauth/oauth-client.ts
new file mode 100644 (file)
index 0000000..904a078
--- /dev/null
@@ -0,0 +1,3 @@
+import { OAuthClientModel } from '@server/models/oauth/oauth-client'
+
+export type MOAuthClient = Omit<OAuthClientModel, 'OAuthTokens'>
diff --git a/server/types/models/oauth/oauth-token.ts b/server/types/models/oauth/oauth-token.ts
new file mode 100644 (file)
index 0000000..396cf64
--- /dev/null
@@ -0,0 +1,14 @@
+import { OAuthTokenModel } from '@server/models/oauth/oauth-token'
+import { PickWith } from '@server/types/utils'
+import { MUserAccountUrl } from '../user/user'
+
+type Use<K extends keyof OAuthTokenModel, M> = PickWith<OAuthTokenModel, K, M>
+
+// ############################################################################
+
+export type MOAuthToken = Omit<OAuthTokenModel, 'User' | 'OAuthClients'>
+
+export type MOAuthTokenUser =
+  MOAuthToken &
+  Use<'User', MUserAccountUrl> &
+  { user?: MUserAccountUrl }
diff --git a/server/types/models/server/index.ts b/server/types/models/server/index.ts
new file mode 100644 (file)
index 0000000..c853795
--- /dev/null
@@ -0,0 +1,3 @@
+export * from './plugin'
+export * from './server'
+export * from './server-blocklist'
diff --git a/server/types/models/server/plugin.ts b/server/types/models/server/plugin.ts
new file mode 100644 (file)
index 0000000..83eb837
--- /dev/null
@@ -0,0 +1,11 @@
+import { PluginModel } from '@server/models/server/plugin'
+
+export type MPlugin = PluginModel
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MPluginFormattable =
+  Pick<MPlugin, 'name' | 'type' | 'version' | 'latestVersion' | 'enabled' | 'uninstalled'
+  | 'peertubeEngine' | 'description' | 'homepage' | 'settings' | 'createdAt' | 'updatedAt'>
diff --git a/server/types/models/server/server-blocklist.ts b/server/types/models/server/server-blocklist.ts
new file mode 100644 (file)
index 0000000..cfbf3b7
--- /dev/null
@@ -0,0 +1,26 @@
+import { ServerBlocklistModel } from '@server/models/server/server-blocklist'
+import { PickWith } from '@server/types/utils'
+import { MAccountDefault, MAccountFormattable } from '../account/account'
+import { MServer, MServerFormattable } from './server'
+
+type Use<K extends keyof ServerBlocklistModel, M> = PickWith<ServerBlocklistModel, K, M>
+
+// ############################################################################
+
+export type MServerBlocklist = Omit<ServerBlocklistModel, 'ByAccount' | 'BlockedServer'>
+
+// ############################################################################
+
+export type MServerBlocklistAccountServer =
+  MServerBlocklist &
+  Use<'ByAccount', MAccountDefault> &
+  Use<'BlockedServer', MServer>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MServerBlocklistFormattable =
+  Pick<MServerBlocklist, 'createdAt'> &
+  Use<'ByAccount', MAccountFormattable> &
+  Use<'BlockedServer', MServerFormattable>
diff --git a/server/types/models/server/server.ts b/server/types/models/server/server.ts
new file mode 100644 (file)
index 0000000..b35e55a
--- /dev/null
@@ -0,0 +1,26 @@
+import { ServerModel } from '../../../models/server/server'
+import { FunctionProperties, PickWith } from '../../utils'
+import { MAccountBlocklistId } from '../account'
+
+type Use<K extends keyof ServerModel, M> = PickWith<ServerModel, K, M>
+
+// ############################################################################
+
+export type MServer = Omit<ServerModel, 'Actors' | 'BlockedByAccounts'>
+
+// ############################################################################
+
+export type MServerHost = Pick<MServer, 'host'>
+export type MServerRedundancyAllowed = Pick<MServer, 'redundancyAllowed'>
+
+export type MServerHostBlocks =
+  MServerHost &
+  Use<'BlockedByAccounts', MAccountBlocklistId[]>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MServerFormattable =
+  FunctionProperties<MServer> &
+  Pick<MServer, 'host'>
diff --git a/server/types/models/user/index.ts b/server/types/models/user/index.ts
new file mode 100644 (file)
index 0000000..6657b21
--- /dev/null
@@ -0,0 +1,4 @@
+export * from './user'
+export * from './user-notification'
+export * from './user-notification-setting'
+export * from './user-video-history'
diff --git a/server/types/models/user/user-notification-setting.ts b/server/types/models/user/user-notification-setting.ts
new file mode 100644 (file)
index 0000000..c674add
--- /dev/null
@@ -0,0 +1,9 @@
+import { UserNotificationSettingModel } from '@server/models/account/user-notification-setting'
+
+export type MNotificationSetting = Omit<UserNotificationSettingModel, 'User'>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MNotificationSettingFormattable = MNotificationSetting
diff --git a/server/types/models/user/user-notification.ts b/server/types/models/user/user-notification.ts
new file mode 100644 (file)
index 0000000..2080360
--- /dev/null
@@ -0,0 +1,92 @@
+import { UserNotificationModel } from '../../../models/account/user-notification'
+import { PickWith, PickWithOpt } from '../../utils'
+import { VideoModel } from '../../../models/video/video'
+import { ActorModel } from '../../../models/activitypub/actor'
+import { ServerModel } from '../../../models/server/server'
+import { AvatarModel } from '../../../models/avatar/avatar'
+import { VideoChannelModel } from '../../../models/video/video-channel'
+import { AccountModel } from '../../../models/account/account'
+import { VideoCommentModel } from '../../../models/video/video-comment'
+import { VideoAbuseModel } from '../../../models/video/video-abuse'
+import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
+import { VideoImportModel } from '../../../models/video/video-import'
+import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
+
+type Use<K extends keyof UserNotificationModel, M> = PickWith<UserNotificationModel, K, M>
+
+// ############################################################################
+
+export module UserNotificationIncludes {
+
+  export type VideoInclude = Pick<VideoModel, 'id' | 'uuid' | 'name'>
+  export type VideoIncludeChannel =
+    VideoInclude &
+    PickWith<VideoModel, 'VideoChannel', VideoChannelIncludeActor>
+
+  export type ActorInclude =
+    Pick<ActorModel, 'preferredUsername' | 'getHost'> &
+    PickWith<ActorModel, 'Avatar', Pick<AvatarModel, 'filename' | 'getStaticPath'>> &
+    PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>>
+
+  export type VideoChannelInclude = Pick<VideoChannelModel, 'id' | 'name' | 'getDisplayName'>
+  export type VideoChannelIncludeActor =
+    VideoChannelInclude &
+    PickWith<VideoChannelModel, 'Actor', ActorInclude>
+
+  export type AccountInclude = Pick<AccountModel, 'id' | 'name' | 'getDisplayName'>
+  export type AccountIncludeActor =
+    AccountInclude &
+    PickWith<AccountModel, 'Actor', ActorInclude>
+
+  export type VideoCommentInclude =
+    Pick<VideoCommentModel, 'id' | 'originCommentId' | 'getThreadId'> &
+    PickWith<VideoCommentModel, 'Account', AccountIncludeActor> &
+    PickWith<VideoCommentModel, 'Video', VideoInclude>
+
+  export type VideoAbuseInclude =
+    Pick<VideoAbuseModel, 'id'> &
+    PickWith<VideoAbuseModel, 'Video', VideoInclude>
+
+  export type VideoBlacklistInclude =
+    Pick<VideoBlacklistModel, 'id'> &
+    PickWith<VideoAbuseModel, 'Video', VideoInclude>
+
+  export type VideoImportInclude =
+    Pick<VideoImportModel, 'id' | 'magnetUri' | 'targetUrl' | 'torrentName'> &
+    PickWith<VideoImportModel, 'Video', VideoInclude>
+
+  export type ActorFollower =
+    Pick<ActorModel, 'preferredUsername' | 'getHost'> &
+    PickWith<ActorModel, 'Account', AccountInclude> &
+    PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>> &
+    PickWithOpt<ActorModel, 'Avatar', Pick<AvatarModel, 'filename' | 'getStaticPath'>>
+
+  export type ActorFollowing =
+    Pick<ActorModel, 'preferredUsername' | 'type' | 'getHost'> &
+    PickWith<ActorModel, 'VideoChannel', VideoChannelInclude> &
+    PickWith<ActorModel, 'Account', AccountInclude> &
+    PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>>
+
+  export type ActorFollowInclude =
+    Pick<ActorFollowModel, 'id' | 'state'> &
+    PickWith<ActorFollowModel, 'ActorFollower', ActorFollower> &
+    PickWith<ActorFollowModel, 'ActorFollowing', ActorFollowing>
+}
+
+// ############################################################################
+
+export type MUserNotification =
+  Omit<UserNotificationModel, 'User' | 'Video' | 'Comment' | 'VideoAbuse' | 'VideoBlacklist' |
+  'VideoImport' | 'Account' | 'ActorFollow'>
+
+// ############################################################################
+
+export type UserNotificationModelForApi =
+  MUserNotification &
+  Use<'Video', UserNotificationIncludes.VideoIncludeChannel> &
+  Use<'Comment', UserNotificationIncludes.VideoCommentInclude> &
+  Use<'VideoAbuse', UserNotificationIncludes.VideoAbuseInclude> &
+  Use<'VideoBlacklist', UserNotificationIncludes.VideoBlacklistInclude> &
+  Use<'VideoImport', UserNotificationIncludes.VideoImportInclude> &
+  Use<'ActorFollow', UserNotificationIncludes.ActorFollowInclude> &
+  Use<'Account', UserNotificationIncludes.AccountIncludeActor>
diff --git a/server/types/models/user/user-video-history.ts b/server/types/models/user/user-video-history.ts
new file mode 100644 (file)
index 0000000..62673ab
--- /dev/null
@@ -0,0 +1,5 @@
+import { UserVideoHistoryModel } from '../../../models/account/user-video-history'
+
+export type MUserVideoHistory = Omit<UserVideoHistoryModel, 'Video' | 'User'>
+
+export type MUserVideoHistoryTime = Pick<MUserVideoHistory, 'currentTime'>
diff --git a/server/types/models/user/user.ts b/server/types/models/user/user.ts
new file mode 100644 (file)
index 0000000..7938ea2
--- /dev/null
@@ -0,0 +1,89 @@
+import { UserModel } from '../../../models/account/user'
+import { PickWith, PickWithOpt } from '../../utils'
+import {
+  MAccount,
+  MAccountDefault,
+  MAccountDefaultChannelDefault,
+  MAccountFormattable,
+  MAccountId,
+  MAccountIdActorId,
+  MAccountUrl
+} from '../account'
+import { MNotificationSetting, MNotificationSettingFormattable } from './user-notification-setting'
+import { AccountModel } from '@server/models/account/account'
+import { MChannelFormattable } from '../video/video-channels'
+import { MVideoPlaylist } from '@server/types/models'
+
+type Use<K extends keyof UserModel, M> = PickWith<UserModel, K, M>
+
+// ############################################################################
+
+export type MUser = Omit<UserModel, 'Account' | 'NotificationSetting' | 'VideoImports' | 'OAuthTokens'>
+
+// ############################################################################
+
+export type MUserQuotaUsed = MUser & { videoQuotaUsed?: number, videoQuotaUsedDaily?: number }
+export type MUserId = Pick<UserModel, 'id'>
+
+// ############################################################################
+
+// With account
+
+export type MUserAccountId =
+  MUser &
+  Use<'Account', MAccountId>
+
+export type MUserAccountUrl =
+  MUser &
+  Use<'Account', MAccountUrl & MAccountIdActorId>
+
+export type MUserAccount =
+  MUser &
+  Use<'Account', MAccount>
+
+export type MUserAccountDefault =
+  MUser &
+  Use<'Account', MAccountDefault>
+
+// With channel
+
+export type MUserNotifSettingChannelDefault =
+  MUser &
+  Use<'NotificationSetting', MNotificationSetting> &
+  Use<'Account', MAccountDefaultChannelDefault>
+
+// With notification settings
+
+export type MUserWithNotificationSetting =
+  MUser &
+  Use<'NotificationSetting', MNotificationSetting>
+
+export type MUserNotifSettingAccount =
+  MUser &
+  Use<'NotificationSetting', MNotificationSetting> &
+  Use<'Account', MAccount>
+
+// Default scope
+
+export type MUserDefault =
+  MUser &
+  Use<'NotificationSetting', MNotificationSetting> &
+  Use<'Account', MAccountDefault>
+
+// ############################################################################
+
+// Format for API or AP object
+
+type MAccountWithChannels = MAccountFormattable & PickWithOpt<AccountModel, 'VideoChannels', MChannelFormattable[]>
+type MAccountWithChannelsAndSpecialPlaylists =
+  MAccountWithChannels &
+  PickWithOpt<AccountModel, 'VideoPlaylists', MVideoPlaylist[]>
+
+export type MUserFormattable =
+  MUserQuotaUsed &
+  Use<'Account', MAccountWithChannels> &
+  PickWithOpt<UserModel, 'NotificationSetting', MNotificationSettingFormattable>
+
+export type MMyUserFormattable =
+  MUserFormattable &
+  Use<'Account', MAccountWithChannelsAndSpecialPlaylists>
diff --git a/server/types/models/video/index.ts b/server/types/models/video/index.ts
new file mode 100644 (file)
index 0000000..bd69c8a
--- /dev/null
@@ -0,0 +1,18 @@
+export * from './schedule-video-update'
+export * from './tag'
+export * from './thumbnail'
+export * from './video'
+export * from './video-abuse'
+export * from './video-blacklist'
+export * from './video-caption'
+export * from './video-change-ownership'
+export * from './video-channels'
+export * from './video-comment'
+export * from './video-file'
+export * from './video-import'
+export * from './video-playlist'
+export * from './video-playlist-element'
+export * from './video-rate'
+export * from './video-redundancy'
+export * from './video-share'
+export * from './video-streaming-playlist'
diff --git a/server/types/models/video/schedule-video-update.ts b/server/types/models/video/schedule-video-update.ts
new file mode 100644 (file)
index 0000000..6336fda
--- /dev/null
@@ -0,0 +1,19 @@
+import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update'
+import { PickWith } from '@server/types/utils'
+import { MVideoAPWithoutCaption, MVideoWithBlacklistLight } from './video'
+
+type Use<K extends keyof ScheduleVideoUpdateModel, M> = PickWith<ScheduleVideoUpdateModel, K, M>
+
+// ############################################################################
+
+export type MScheduleVideoUpdate = Omit<ScheduleVideoUpdateModel, 'Video'>
+
+// ############################################################################
+
+export type MScheduleVideoUpdateVideoAll =
+  MScheduleVideoUpdate &
+  Use<'Video', MVideoAPWithoutCaption & MVideoWithBlacklistLight>
+
+// Format for API or AP object
+
+export type MScheduleVideoUpdateFormattable = Pick<MScheduleVideoUpdate, 'updateAt' | 'privacy'>
diff --git a/server/types/models/video/tag.ts b/server/types/models/video/tag.ts
new file mode 100644 (file)
index 0000000..64a6887
--- /dev/null
@@ -0,0 +1,3 @@
+import { TagModel } from '../../../models/video/tag'
+
+export type MTag = Omit<TagModel, 'Videos'>
diff --git a/server/types/models/video/thumbnail.ts b/server/types/models/video/thumbnail.ts
new file mode 100644 (file)
index 0000000..c03ba55
--- /dev/null
@@ -0,0 +1,3 @@
+import { ThumbnailModel } from '../../../models/video/thumbnail'
+
+export type MThumbnail = Omit<ThumbnailModel, 'Video' | 'VideoPlaylist'>
diff --git a/server/types/models/video/video-abuse.ts b/server/types/models/video/video-abuse.ts
new file mode 100644 (file)
index 0000000..d60f05e
--- /dev/null
@@ -0,0 +1,35 @@
+import { VideoAbuseModel } from '../../../models/video/video-abuse'
+import { PickWith } from '../../utils'
+import { MVideoAccountLightBlacklistAllFiles, MVideo } from './video'
+import { MAccountDefault, MAccountFormattable } from '../account'
+
+type Use<K extends keyof VideoAbuseModel, M> = PickWith<VideoAbuseModel, K, M>
+
+// ############################################################################
+
+export type MVideoAbuse = Omit<VideoAbuseModel, 'Account' | 'Video' | 'toActivityPubObject'>
+
+// ############################################################################
+
+export type MVideoAbuseId = Pick<VideoAbuseModel, 'id'>
+
+export type MVideoAbuseVideo =
+  MVideoAbuse &
+  Pick<VideoAbuseModel, 'toActivityPubObject'> &
+  Use<'Video', MVideo>
+
+export type MVideoAbuseAccountVideo =
+  MVideoAbuse &
+  Pick<VideoAbuseModel, 'toActivityPubObject'> &
+  Use<'Video', MVideoAccountLightBlacklistAllFiles> &
+  Use<'Account', MAccountDefault>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MVideoAbuseFormattable =
+  MVideoAbuse &
+  Use<'Account', MAccountFormattable> &
+  Use<'Video', Pick<MVideoAccountLightBlacklistAllFiles,
+  'id' | 'uuid' | 'name' | 'nsfw' | 'getMiniatureStaticPath' | 'isBlacklisted' | 'VideoChannel'>>
diff --git a/server/types/models/video/video-blacklist.ts b/server/types/models/video/video-blacklist.ts
new file mode 100644 (file)
index 0000000..08e5928
--- /dev/null
@@ -0,0 +1,30 @@
+import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
+import { PickWith } from '@server/types/utils'
+import { MVideo, MVideoFormattable } from './video'
+
+type Use<K extends keyof VideoBlacklistModel, M> = PickWith<VideoBlacklistModel, K, M>
+
+// ############################################################################
+
+export type MVideoBlacklist = Omit<VideoBlacklistModel, 'Video'>
+
+export type MVideoBlacklistLight = Pick<MVideoBlacklist, 'id' | 'reason' | 'unfederated'>
+export type MVideoBlacklistUnfederated = Pick<MVideoBlacklist, 'unfederated'>
+
+// ############################################################################
+
+export type MVideoBlacklistLightVideo =
+  MVideoBlacklistLight &
+  Use<'Video', MVideo>
+
+export type MVideoBlacklistVideo =
+  MVideoBlacklist &
+  Use<'Video', MVideo>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MVideoBlacklistFormattable =
+  MVideoBlacklist &
+  Use<'Video', MVideoFormattable>
diff --git a/server/types/models/video/video-caption.ts b/server/types/models/video/video-caption.ts
new file mode 100644 (file)
index 0000000..9bb0670
--- /dev/null
@@ -0,0 +1,27 @@
+import { VideoCaptionModel } from '../../../models/video/video-caption'
+import { FunctionProperties, PickWith } from '@server/types/utils'
+import { MVideo, MVideoUUID } from './video'
+
+type Use<K extends keyof VideoCaptionModel, M> = PickWith<VideoCaptionModel, K, M>
+
+// ############################################################################
+
+export type MVideoCaption = Omit<VideoCaptionModel, 'Video'>
+
+// ############################################################################
+
+export type MVideoCaptionLanguage = Pick<MVideoCaption, 'language'>
+export type MVideoCaptionLanguageUrl = Pick<MVideoCaption, 'language' | 'fileUrl' | 'getFileUrl'>
+
+export type MVideoCaptionVideo =
+  MVideoCaption &
+  Use<'Video', Pick<MVideo, 'id' | 'remote' | 'uuid'>>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MVideoCaptionFormattable =
+  FunctionProperties<MVideoCaption> &
+  Pick<MVideoCaption, 'language'> &
+  Use<'Video', MVideoUUID>
diff --git a/server/types/models/video/video-change-ownership.ts b/server/types/models/video/video-change-ownership.ts
new file mode 100644 (file)
index 0000000..7421e08
--- /dev/null
@@ -0,0 +1,26 @@
+import { VideoChangeOwnershipModel } from '@server/models/video/video-change-ownership'
+import { PickWith } from '@server/types/utils'
+import { MAccountDefault, MAccountFormattable } from '../account/account'
+import { MVideo, MVideoWithAllFiles } from './video'
+
+type Use<K extends keyof VideoChangeOwnershipModel, M> = PickWith<VideoChangeOwnershipModel, K, M>
+
+// ############################################################################
+
+export type MVideoChangeOwnership = Omit<VideoChangeOwnershipModel, 'Initiator' | 'NextOwner' | 'Video'>
+
+export type MVideoChangeOwnershipFull =
+  MVideoChangeOwnership &
+  Use<'Initiator', MAccountDefault> &
+  Use<'NextOwner', MAccountDefault> &
+  Use<'Video', MVideoWithAllFiles>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MVideoChangeOwnershipFormattable =
+  Pick<MVideoChangeOwnership, 'id' | 'status' | 'createdAt'> &
+  Use<'Initiator', MAccountFormattable> &
+  Use<'NextOwner', MAccountFormattable> &
+  Use<'Video', Pick<MVideo, 'id' | 'uuid' | 'url' | 'name'>>
diff --git a/server/types/models/video/video-channels.ts b/server/types/models/video/video-channels.ts
new file mode 100644 (file)
index 0000000..50f7c2d
--- /dev/null
@@ -0,0 +1,145 @@
+import { FunctionProperties, PickWith, PickWithOpt } from '../../utils'
+import { VideoChannelModel } from '../../../models/video/video-channel'
+import {
+  MAccountActor,
+  MAccountAPI,
+  MAccountDefault,
+  MAccountFormattable,
+  MAccountLight,
+  MAccountSummaryBlocks,
+  MAccountSummaryFormattable,
+  MAccountUrl,
+  MAccountUserId,
+  MActor,
+  MActorAccountChannelId,
+  MActorAP,
+  MActorAPI,
+  MActorDefault,
+  MActorDefaultLight,
+  MActorFormattable,
+  MActorLight,
+  MActorSummary,
+  MActorSummaryFormattable, MActorUrl
+} from '../account'
+import { MVideo } from './video'
+
+type Use<K extends keyof VideoChannelModel, M> = PickWith<VideoChannelModel, K, M>
+
+// ############################################################################
+
+export type MChannel = Omit<VideoChannelModel, 'Actor' | 'Account' | 'Videos' | 'VideoPlaylists'>
+
+// ############################################################################
+
+export type MChannelId = Pick<MChannel, 'id'>
+
+// ############################################################################
+
+export type MChannelIdActor =
+  MChannelId &
+  Use<'Actor', MActorAccountChannelId>
+
+export type MChannelUserId =
+  Pick<MChannel, 'accountId'> &
+  Use<'Account', MAccountUserId>
+
+export type MChannelActor =
+  MChannel &
+  Use<'Actor', MActor>
+
+export type MChannelUrl = Use<'Actor', MActorUrl>
+
+// Default scope
+export type MChannelDefault =
+  MChannel &
+  Use<'Actor', MActorDefault>
+
+// ############################################################################
+
+// Not all association attributes
+
+export type MChannelLight =
+  MChannel &
+  Use<'Actor', MActorDefaultLight>
+
+export type MChannelActorLight =
+  MChannel &
+  Use<'Actor', MActorLight>
+
+export type MChannelAccountLight =
+  MChannel &
+  Use<'Actor', MActorDefaultLight> &
+  Use<'Account', MAccountLight>
+
+// ############################################################################
+
+// Account associations
+
+export type MChannelAccountActor =
+  MChannel &
+  Use<'Account', MAccountActor>
+
+export type MChannelAccountDefault =
+  MChannel &
+  Use<'Actor', MActorDefault> &
+  Use<'Account', MAccountDefault>
+
+export type MChannelActorAccountActor =
+  MChannel &
+  Use<'Account', MAccountActor> &
+  Use<'Actor', MActor>
+
+// ############################################################################
+
+// Videos  associations
+export type MChannelVideos =
+  MChannel &
+  Use<'Videos', MVideo[]>
+
+export type MChannelActorAccountDefaultVideos =
+  MChannel &
+  Use<'Actor', MActorDefault> &
+  Use<'Account', MAccountDefault> &
+  Use<'Videos', MVideo[]>
+
+// ############################################################################
+
+// For API
+
+export type MChannelSummary =
+  FunctionProperties<MChannel> &
+  Pick<MChannel, 'id' | 'name' | 'description' | 'actorId'> &
+  Use<'Actor', MActorSummary>
+
+export type MChannelSummaryAccount =
+  MChannelSummary &
+  Use<'Account', MAccountSummaryBlocks>
+
+export type MChannelAPI =
+  MChannel &
+  Use<'Actor', MActorAPI> &
+  Use<'Account', MAccountAPI>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MChannelSummaryFormattable =
+  FunctionProperties<MChannel> &
+  Pick<MChannel, 'id' | 'name'> &
+  Use<'Actor', MActorSummaryFormattable>
+
+export type MChannelAccountSummaryFormattable =
+  MChannelSummaryFormattable &
+  Use<'Account', MAccountSummaryFormattable>
+
+export type MChannelFormattable =
+  FunctionProperties<MChannel> &
+  Pick<MChannel, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'support'> &
+  Use<'Actor', MActorFormattable> &
+  PickWithOpt<VideoChannelModel, 'Account', MAccountFormattable>
+
+export type MChannelAP =
+  Pick<MChannel, 'name' | 'description' | 'support'> &
+  Use<'Actor', MActorAP> &
+  Use<'Account', MAccountUrl>
diff --git a/server/types/models/video/video-comment.ts b/server/types/models/video/video-comment.ts
new file mode 100644 (file)
index 0000000..d6e0b66
--- /dev/null
@@ -0,0 +1,66 @@
+import { VideoCommentModel } from '../../../models/video/video-comment'
+import { PickWith, PickWithOpt } from '../../utils'
+import { MAccountDefault, MAccountFormattable, MAccountUrl } from '../account'
+import { MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUrl } from './video'
+
+type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M>
+
+// ############################################################################
+
+export type MComment = Omit<VideoCommentModel, 'OriginVideoComment' | 'InReplyToVideoComment' | 'Video' | 'Account'>
+export type MCommentTotalReplies = MComment & { totalReplies?: number }
+export type MCommentId = Pick<MComment, 'id'>
+export type MCommentUrl = Pick<MComment, 'url'>
+
+// ############################################################################
+
+export type MCommentOwner =
+  MComment &
+  Use<'Account', MAccountDefault>
+
+export type MCommentVideo =
+  MComment &
+  Use<'Video', MVideoAccountLight>
+
+export type MCommentReply =
+  MComment &
+  Use<'InReplyToVideoComment', MComment>
+
+export type MCommentOwnerVideo =
+  MComment &
+  Use<'Account', MAccountDefault> &
+  Use<'Video', MVideoAccountLight>
+
+export type MCommentOwnerVideoReply =
+  MComment &
+  Use<'Account', MAccountDefault> &
+  Use<'Video', MVideoAccountLight> &
+  Use<'InReplyToVideoComment', MComment>
+
+export type MCommentOwnerReplyVideoLight =
+  MComment &
+  Use<'Account', MAccountDefault> &
+  Use<'InReplyToVideoComment', MComment> &
+  Use<'Video', MVideoIdUrl>
+
+export type MCommentOwnerVideoFeed =
+  MCommentOwner &
+  Use<'Video', MVideoFeed>
+
+// ############################################################################
+
+export type MCommentAPI = MComment & { totalReplies: number }
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MCommentFormattable =
+  MCommentTotalReplies &
+  Use<'Account', MAccountFormattable>
+
+export type MCommentAP =
+  MComment &
+  Use<'Account', MAccountUrl> &
+  PickWithOpt<VideoCommentModel, 'Video', MVideoUrl> &
+  PickWithOpt<VideoCommentModel, 'InReplyToVideoComment', MCommentUrl>
diff --git a/server/types/models/video/video-file.ts b/server/types/models/video/video-file.ts
new file mode 100644 (file)
index 0000000..3fcaca7
--- /dev/null
@@ -0,0 +1,43 @@
+import { VideoFileModel } from '../../../models/video/video-file'
+import { PickWith, PickWithOpt } from '../../utils'
+import { MVideo, MVideoUUID } from './video'
+import { MVideoRedundancy, MVideoRedundancyFileUrl } from './video-redundancy'
+import { MStreamingPlaylistVideo, MStreamingPlaylist } from './video-streaming-playlist'
+
+type Use<K extends keyof VideoFileModel, M> = PickWith<VideoFileModel, K, M>
+
+// ############################################################################
+
+export type MVideoFile = Omit<VideoFileModel, 'Video' | 'RedundancyVideos' | 'VideoStreamingPlaylist'>
+
+export type MVideoFileVideo =
+  MVideoFile &
+  Use<'Video', MVideo>
+
+export type MVideoFileStreamingPlaylist =
+  MVideoFile &
+  Use<'VideoStreamingPlaylist', MStreamingPlaylist>
+
+export type MVideoFileStreamingPlaylistVideo =
+  MVideoFile &
+  Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
+
+export type MVideoFileVideoUUID =
+  MVideoFile &
+  Use<'Video', MVideoUUID>
+
+export type MVideoFileRedundanciesAll =
+  MVideoFile &
+  PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancy[]>
+
+export type MVideoFileRedundanciesOpt =
+  MVideoFile &
+  PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]>
+
+export function isStreamingPlaylistFile (file: any): file is MVideoFileStreamingPlaylist {
+  return !!file.videoStreamingPlaylistId
+}
+
+export function isWebtorrentFile (file: any): file is MVideoFileVideo {
+  return !!file.videoId
+}
diff --git a/server/types/models/video/video-import.ts b/server/types/models/video/video-import.ts
new file mode 100644 (file)
index 0000000..f138587
--- /dev/null
@@ -0,0 +1,36 @@
+import { VideoImportModel } from '@server/models/video/video-import'
+import { PickWith, PickWithOpt } from '@server/types/utils'
+import { MVideo, MVideoAccountLight, MVideoFormattable, MVideoTag, MVideoThumbnail, MVideoWithFile } from './video'
+import { MUser } from '../user/user'
+
+type Use<K extends keyof VideoImportModel, M> = PickWith<VideoImportModel, K, M>
+
+// ############################################################################
+
+export type MVideoImport = Omit<VideoImportModel, 'User' | 'Video'>
+
+export type MVideoImportVideo =
+  MVideoImport &
+  Use<'Video', MVideo>
+
+// ############################################################################
+
+type VideoAssociation = MVideoTag & MVideoAccountLight & MVideoThumbnail
+
+export type MVideoImportDefault =
+  MVideoImport &
+  Use<'User', MUser> &
+  Use<'Video', VideoAssociation>
+
+export type MVideoImportDefaultFiles =
+  MVideoImport &
+  Use<'User', MUser> &
+  Use<'Video', VideoAssociation & MVideoWithFile>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MVideoImportFormattable =
+  MVideoImport &
+  PickWithOpt<VideoImportModel, 'Video', MVideoFormattable & MVideoTag>
diff --git a/server/types/models/video/video-playlist-element.ts b/server/types/models/video/video-playlist-element.ts
new file mode 100644 (file)
index 0000000..c50992d
--- /dev/null
@@ -0,0 +1,39 @@
+import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element'
+import { PickWith } from '@server/types/utils'
+import { MVideoFormattable, MVideoThumbnail, MVideoUrl } from './video'
+import { MVideoPlaylistPrivacy } from './video-playlist'
+
+type Use<K extends keyof VideoPlaylistElementModel, M> = PickWith<VideoPlaylistElementModel, K, M>
+
+// ############################################################################
+
+export type MVideoPlaylistElement = Omit<VideoPlaylistElementModel, 'VideoPlaylist' | 'Video'>
+
+// ############################################################################
+
+export type MVideoPlaylistElementId = Pick<MVideoPlaylistElement, 'id'>
+
+export type MVideoPlaylistElementLight = Pick<MVideoPlaylistElement, 'id' | 'videoId' | 'startTimestamp' | 'stopTimestamp'>
+
+// ############################################################################
+
+export type MVideoPlaylistVideoThumbnail =
+  MVideoPlaylistElement &
+  Use<'Video', MVideoThumbnail>
+
+export type MVideoPlaylistElementVideoUrlPlaylistPrivacy =
+  MVideoPlaylistElement &
+  Use<'Video', MVideoUrl> &
+  Use<'VideoPlaylist', MVideoPlaylistPrivacy>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MVideoPlaylistElementFormattable =
+  MVideoPlaylistElement &
+  Use<'Video', MVideoFormattable>
+
+export type MVideoPlaylistElementAP =
+  MVideoPlaylistElement &
+  Use<'Video', MVideoUrl>
diff --git a/server/types/models/video/video-playlist.ts b/server/types/models/video/video-playlist.ts
new file mode 100644 (file)
index 0000000..b504d16
--- /dev/null
@@ -0,0 +1,104 @@
+import { VideoPlaylistModel } from '../../../models/video/video-playlist'
+import { PickWith } from '../../utils'
+import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account'
+import { MThumbnail } from './thumbnail'
+import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable, MChannelUrl } from './video-channels'
+import { MVideoPlaylistElementLight } from '@server/types/models/video/video-playlist-element'
+
+type Use<K extends keyof VideoPlaylistModel, M> = PickWith<VideoPlaylistModel, K, M>
+
+// ############################################################################
+
+export type MVideoPlaylist = Omit<VideoPlaylistModel, 'OwnerAccount' | 'VideoChannel' | 'VideoPlaylistElements' | 'Thumbnail'>
+
+// ############################################################################
+
+export type MVideoPlaylistId = Pick<MVideoPlaylist, 'id'>
+export type MVideoPlaylistPrivacy = Pick<MVideoPlaylist, 'privacy'>
+export type MVideoPlaylistUUID = Pick<MVideoPlaylist, 'uuid'>
+export type MVideoPlaylistVideosLength = MVideoPlaylist & { videosLength?: number }
+
+// ############################################################################
+
+// With elements
+
+export type MVideoPlaylistWithElements =
+  MVideoPlaylist &
+  Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
+
+export type MVideoPlaylistIdWithElements =
+  MVideoPlaylistId &
+  Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
+
+// ############################################################################
+
+// With account
+
+export type MVideoPlaylistOwner =
+  MVideoPlaylist &
+  Use<'OwnerAccount', MAccount>
+
+export type MVideoPlaylistOwnerDefault =
+  MVideoPlaylist &
+  Use<'OwnerAccount', MAccountDefault>
+
+// ############################################################################
+
+// With thumbnail
+
+export type MVideoPlaylistThumbnail =
+  MVideoPlaylist &
+  Use<'Thumbnail', MThumbnail>
+
+export type MVideoPlaylistAccountThumbnail =
+  MVideoPlaylist &
+  Use<'OwnerAccount', MAccountDefault> &
+  Use<'Thumbnail', MThumbnail>
+
+// ############################################################################
+
+// With channel
+
+export type MVideoPlaylistAccountChannelDefault =
+  MVideoPlaylist &
+  Use<'OwnerAccount', MAccountDefault> &
+  Use<'VideoChannel', MChannelDefault>
+
+// ############################################################################
+
+// With all associations
+
+export type MVideoPlaylistFull =
+  MVideoPlaylist &
+  Use<'OwnerAccount', MAccountDefault> &
+  Use<'VideoChannel', MChannelDefault> &
+  Use<'Thumbnail', MThumbnail>
+
+// ############################################################################
+
+// For API
+
+export type MVideoPlaylistAccountChannelSummary =
+  MVideoPlaylist &
+  Use<'OwnerAccount', MAccountSummary> &
+  Use<'VideoChannel', MChannelSummary>
+
+export type MVideoPlaylistFullSummary =
+  MVideoPlaylist &
+  Use<'Thumbnail', MThumbnail> &
+  Use<'OwnerAccount', MAccountSummary> &
+  Use<'VideoChannel', MChannelSummary>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MVideoPlaylistFormattable =
+  MVideoPlaylistVideosLength &
+  Use<'OwnerAccount', MAccountSummaryFormattable> &
+  Use<'VideoChannel', MChannelSummaryFormattable>
+
+export type MVideoPlaylistAP =
+  MVideoPlaylist &
+  Use<'Thumbnail', MThumbnail> &
+  Use<'VideoChannel', MChannelUrl>
diff --git a/server/types/models/video/video-rate.ts b/server/types/models/video/video-rate.ts
new file mode 100644 (file)
index 0000000..a7682ef
--- /dev/null
@@ -0,0 +1,27 @@
+import { AccountVideoRateModel } from '@server/models/account/account-video-rate'
+import { PickWith } from '@server/types/utils'
+import { MAccountAudience, MAccountUrl } from '../account/account'
+import { MVideo, MVideoFormattable } from './video'
+
+type Use<K extends keyof AccountVideoRateModel, M> = PickWith<AccountVideoRateModel, K, M>
+
+// ############################################################################
+
+export type MAccountVideoRate = Omit<AccountVideoRateModel, 'Video' | 'Account'>
+
+export type MAccountVideoRateAccountUrl =
+  MAccountVideoRate &
+  Use<'Account', MAccountUrl>
+
+export type MAccountVideoRateAccountVideo =
+  MAccountVideoRate &
+  Use<'Account', MAccountAudience> &
+  Use<'Video', MVideo>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MAccountVideoRateFormattable =
+  Pick<MAccountVideoRate, 'type'> &
+  Use<'Video', MVideoFormattable>
diff --git a/server/types/models/video/video-redundancy.ts b/server/types/models/video/video-redundancy.ts
new file mode 100644 (file)
index 0000000..7c7d520
--- /dev/null
@@ -0,0 +1,43 @@
+import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy'
+import { PickWith, PickWithOpt } from '@server/types/utils'
+import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'
+import { VideoFileModel } from '@server/models/video/video-file'
+import { MVideoFile, MVideoFileVideo } from './video-file'
+import { MStreamingPlaylistVideo } from './video-streaming-playlist'
+import { MVideoUrl } from './video'
+
+type Use<K extends keyof VideoRedundancyModel, M> = PickWith<VideoRedundancyModel, K, M>
+
+// ############################################################################
+
+export type MVideoRedundancy = Omit<VideoRedundancyModel, 'VideoFile' | 'VideoStreamingPlaylist' | 'Actor'>
+
+export type MVideoRedundancyFileUrl = Pick<MVideoRedundancy, 'fileUrl'>
+
+// ############################################################################
+
+export type MVideoRedundancyFile =
+  MVideoRedundancy &
+  Use<'VideoFile', MVideoFile>
+
+export type MVideoRedundancyFileVideo =
+  MVideoRedundancy &
+  Use<'VideoFile', MVideoFileVideo>
+
+export type MVideoRedundancyStreamingPlaylistVideo =
+  MVideoRedundancy &
+  Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
+
+export type MVideoRedundancyVideo =
+  MVideoRedundancy &
+  Use<'VideoFile', MVideoFileVideo> &
+  Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MVideoRedundancyAP =
+  MVideoRedundancy &
+  PickWithOpt<VideoRedundancyModel, 'VideoFile', MVideoFile & PickWith<VideoFileModel, 'Video', MVideoUrl>> &
+  PickWithOpt<VideoRedundancyModel, 'VideoStreamingPlaylist', PickWith<VideoStreamingPlaylistModel, 'Video', MVideoUrl>>
diff --git a/server/types/models/video/video-share.ts b/server/types/models/video/video-share.ts
new file mode 100644 (file)
index 0000000..50ca75d
--- /dev/null
@@ -0,0 +1,19 @@
+import { VideoShareModel } from '../../../models/video/video-share'
+import { PickWith } from '../../utils'
+import { MActorDefault } from '../account'
+import { MVideo } from './video'
+
+type Use<K extends keyof VideoShareModel, M> = PickWith<VideoShareModel, K, M>
+
+// ############################################################################
+
+export type MVideoShare = Omit<VideoShareModel, 'Actor' | 'Video'>
+
+export type MVideoShareActor =
+  MVideoShare &
+  Use<'Actor', MActorDefault>
+
+export type MVideoShareFull =
+  MVideoShare &
+  Use<'Actor', MActorDefault> &
+  Use<'Video', MVideo>
diff --git a/server/types/models/video/video-streaming-playlist.ts b/server/types/models/video/video-streaming-playlist.ts
new file mode 100644 (file)
index 0000000..3f54aa5
--- /dev/null
@@ -0,0 +1,43 @@
+import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist'
+import { PickWith, PickWithOpt } from '../../utils'
+import { MVideoRedundancyFileUrl, MVideoRedundancy } from './video-redundancy'
+import { MVideo } from './video'
+import { MVideoFile } from './video-file'
+
+type Use<K extends keyof VideoStreamingPlaylistModel, M> = PickWith<VideoStreamingPlaylistModel, K, M>
+
+// ############################################################################
+
+export type MStreamingPlaylist = Omit<VideoStreamingPlaylistModel, 'Video' | 'RedundancyVideos' | 'VideoFiles'>
+
+export type MStreamingPlaylistFiles =
+  MStreamingPlaylist &
+  Use<'VideoFiles', MVideoFile[]>
+
+export type MStreamingPlaylistVideo =
+  MStreamingPlaylist &
+  Use<'Video', MVideo>
+
+export type MStreamingPlaylistFilesVideo =
+  MStreamingPlaylist &
+  Use<'VideoFiles', MVideoFile[]> &
+  Use<'Video', MVideo>
+
+export type MStreamingPlaylistRedundanciesAll =
+  MStreamingPlaylist &
+  Use<'VideoFiles', MVideoFile[]> &
+  Use<'RedundancyVideos', MVideoRedundancy[]>
+
+export type MStreamingPlaylistRedundancies =
+  MStreamingPlaylist &
+  Use<'VideoFiles', MVideoFile[]> &
+  Use<'RedundancyVideos', MVideoRedundancyFileUrl[]>
+
+export type MStreamingPlaylistRedundanciesOpt =
+  MStreamingPlaylist &
+  Use<'VideoFiles', MVideoFile[]> &
+  PickWithOpt<VideoStreamingPlaylistModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]>
+
+export function isStreamingPlaylist (value: MVideo | MStreamingPlaylistVideo): value is MStreamingPlaylistVideo {
+  return !!(value as MStreamingPlaylist).playlistUrl
+}
diff --git a/server/types/models/video/video.ts b/server/types/models/video/video.ts
new file mode 100644 (file)
index 0000000..022a956
--- /dev/null
@@ -0,0 +1,211 @@
+import { VideoModel } from '../../../models/video/video'
+import { PickWith, PickWithOpt } from '../../utils'
+import {
+  MChannelAccountDefault,
+  MChannelAccountLight,
+  MChannelAccountSummaryFormattable,
+  MChannelActor,
+  MChannelFormattable,
+  MChannelUserId
+} from './video-channels'
+import { MTag } from './tag'
+import { MVideoCaptionLanguage, MVideoCaptionLanguageUrl } from './video-caption'
+import {
+  MStreamingPlaylistFiles,
+  MStreamingPlaylistRedundancies,
+  MStreamingPlaylistRedundanciesAll,
+  MStreamingPlaylistRedundanciesOpt
+} from './video-streaming-playlist'
+import { MVideoFile, MVideoFileRedundanciesAll, MVideoFileRedundanciesOpt } from './video-file'
+import { MThumbnail } from './thumbnail'
+import { MVideoBlacklist, MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist'
+import { MScheduleVideoUpdate } from './schedule-video-update'
+import { MUserVideoHistoryTime } from '../user/user-video-history'
+
+type Use<K extends keyof VideoModel, M> = PickWith<VideoModel, K, M>
+
+// ############################################################################
+
+export type MVideo =
+  Omit<VideoModel, 'VideoChannel' | 'Tags' | 'Thumbnails' | 'VideoPlaylistElements' | 'VideoAbuses' |
+  'VideoFiles' | 'VideoStreamingPlaylists' | 'VideoShares' | 'AccountVideoRates' | 'VideoComments' | 'VideoViews' | 'UserVideoHistories' |
+  'ScheduleVideoUpdate' | 'VideoBlacklist' | 'VideoImport' | 'VideoCaptions'>
+
+// ############################################################################
+
+export type MVideoId = Pick<MVideo, 'id'>
+export type MVideoUrl = Pick<MVideo, 'url'>
+export type MVideoUUID = Pick<MVideo, 'uuid'>
+
+export type MVideoImmutable = Pick<MVideo, 'id' | 'url' | 'uuid' | 'remote' | 'isOwned'>
+export type MVideoIdUrl = MVideoId & MVideoUrl
+export type MVideoFeed = Pick<MVideo, 'name' | 'uuid'>
+
+// ############################################################################
+
+// Video raw associations: schedules, video files, tags, thumbnails, captions, streaming playlists
+
+// "With" to not confuse with the VideoFile model
+export type MVideoWithFile =
+  MVideo &
+  Use<'VideoFiles', MVideoFile[]> &
+  Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>
+
+export type MVideoThumbnail =
+  MVideo &
+  Use<'Thumbnails', MThumbnail[]>
+
+export type MVideoIdThumbnail =
+  MVideoId &
+  Use<'Thumbnails', MThumbnail[]>
+
+export type MVideoWithFileThumbnail =
+  MVideo &
+  Use<'VideoFiles', MVideoFile[]> &
+  Use<'Thumbnails', MThumbnail[]>
+
+export type MVideoThumbnailBlacklist =
+  MVideo &
+  Use<'Thumbnails', MThumbnail[]> &
+  Use<'VideoBlacklist', MVideoBlacklistLight>
+
+export type MVideoTag =
+  MVideo &
+  Use<'Tags', MTag[]>
+
+export type MVideoWithSchedule =
+  MVideo &
+  PickWithOpt<VideoModel, 'ScheduleVideoUpdate', MScheduleVideoUpdate>
+
+export type MVideoWithCaptions =
+  MVideo &
+  Use<'VideoCaptions', MVideoCaptionLanguage[]>
+
+export type MVideoWithStreamingPlaylist =
+  MVideo &
+  Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>
+
+// ############################################################################
+
+// Associations with not all their attributes
+
+export type MVideoUserHistory =
+  MVideo &
+  Use<'UserVideoHistories', MUserVideoHistoryTime[]>
+
+export type MVideoWithBlacklistLight =
+  MVideo &
+  Use<'VideoBlacklist', MVideoBlacklistLight>
+
+export type MVideoAccountLight =
+  MVideo &
+  Use<'VideoChannel', MChannelAccountLight>
+
+export type MVideoWithRights =
+  MVideo &
+  Use<'VideoBlacklist', MVideoBlacklistLight> &
+  Use<'Thumbnails', MThumbnail[]> &
+  Use<'VideoChannel', MChannelUserId>
+
+// ############################################################################
+
+// All files with some additional associations
+
+export type MVideoWithAllFiles =
+  MVideo &
+  Use<'VideoFiles', MVideoFile[]> &
+  Use<'Thumbnails', MThumbnail[]> &
+  Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>
+
+export type MVideoAccountLightBlacklistAllFiles =
+  MVideo &
+  Use<'VideoFiles', MVideoFile[]> &
+  Use<'Thumbnails', MThumbnail[]> &
+  Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> &
+  Use<'VideoChannel', MChannelAccountLight> &
+  Use<'VideoBlacklist', MVideoBlacklistLight>
+
+// ############################################################################
+
+// With account
+
+export type MVideoAccountDefault =
+  MVideo &
+  Use<'VideoChannel', MChannelAccountDefault>
+
+export type MVideoThumbnailAccountDefault =
+  MVideo &
+  Use<'Thumbnails', MThumbnail[]> &
+  Use<'VideoChannel', MChannelAccountDefault>
+
+export type MVideoWithChannelActor =
+  MVideo &
+  Use<'VideoChannel', MChannelActor>
+
+export type MVideoFullLight =
+  MVideo &
+  Use<'Thumbnails', MThumbnail[]> &
+  Use<'VideoBlacklist', MVideoBlacklistLight> &
+  Use<'Tags', MTag[]> &
+  Use<'VideoChannel', MChannelAccountLight> &
+  Use<'UserVideoHistories', MUserVideoHistoryTime[]> &
+  Use<'VideoFiles', MVideoFile[]> &
+  Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
+  Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>
+
+// ############################################################################
+
+// API
+
+export type MVideoAP =
+  MVideo &
+  Use<'Tags', MTag[]> &
+  Use<'VideoChannel', MChannelAccountLight> &
+  Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> &
+  Use<'VideoCaptions', MVideoCaptionLanguageUrl[]> &
+  Use<'VideoBlacklist', MVideoBlacklistUnfederated> &
+  Use<'VideoFiles', MVideoFileRedundanciesOpt[]> &
+  Use<'Thumbnails', MThumbnail[]>
+
+export type MVideoAPWithoutCaption = Omit<MVideoAP, 'VideoCaptions'>
+
+export type MVideoDetails =
+  MVideo &
+  Use<'VideoBlacklist', MVideoBlacklistLight> &
+  Use<'Tags', MTag[]> &
+  Use<'VideoChannel', MChannelAccountLight> &
+  Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
+  Use<'Thumbnails', MThumbnail[]> &
+  Use<'UserVideoHistories', MUserVideoHistoryTime[]> &
+  Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundancies[]> &
+  Use<'VideoFiles', MVideoFileRedundanciesOpt[]>
+
+export type MVideoForUser =
+  MVideo &
+  Use<'VideoChannel', MChannelAccountDefault> &
+  Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
+  Use<'VideoBlacklist', MVideoBlacklistLight> &
+  Use<'Thumbnails', MThumbnail[]>
+
+export type MVideoForRedundancyAPI =
+  MVideo &
+  Use<'VideoFiles', MVideoFileRedundanciesAll[]> &
+  Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesAll[]>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MVideoFormattable =
+  MVideo &
+  PickWithOpt<VideoModel, 'UserVideoHistories', MUserVideoHistoryTime[]> &
+  Use<'VideoChannel', MChannelAccountSummaryFormattable> &
+  PickWithOpt<VideoModel, 'ScheduleVideoUpdate', Pick<MScheduleVideoUpdate, 'updateAt' | 'privacy'>> &
+  PickWithOpt<VideoModel, 'VideoBlacklist', Pick<MVideoBlacklist, 'reason'>>
+
+export type MVideoFormattableDetails =
+  MVideoFormattable &
+  Use<'VideoChannel', MChannelFormattable> &
+  Use<'Tags', MTag[]> &
+  Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesOpt[]> &
+  Use<'VideoFiles', MVideoFileRedundanciesOpt[]>
diff --git a/server/types/sequelize.ts b/server/types/sequelize.ts
new file mode 100644 (file)
index 0000000..9cd8361
--- /dev/null
@@ -0,0 +1,18 @@
+import { Model } from 'sequelize-typescript'
+
+// Thanks to sequelize-typescript: https://github.com/RobinBuschmann/sequelize-typescript
+
+export type Diff<T extends string | symbol | number, U extends string | symbol | number> =
+  ({ [P in T]: P } & { [P in U]: never } & { [ x: string ]: never })[T]
+
+export type Omit<T, K extends keyof T> = { [P in Diff<keyof T, K>]: T[P] }
+
+export type RecursivePartial<T> = { [P in keyof T]?: RecursivePartial<T[P]> }
+
+export type FilteredModelAttributes<T extends Model<T>> = RecursivePartial<Omit<T, keyof Model<any>>> & {
+  id?: number | any
+  createdAt?: Date | any
+  updatedAt?: Date | any
+  deletedAt?: Date | any
+  version?: number | any
+}
diff --git a/server/types/utils.ts b/server/types/utils.ts
new file mode 100644 (file)
index 0000000..55500d8
--- /dev/null
@@ -0,0 +1,24 @@
+/* eslint-disable @typescript-eslint/array-type */
+
+export type FunctionPropertyNames<T> = {
+  [K in keyof T]: T[K] extends Function ? K : never
+}[keyof T]
+
+export type FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>>
+
+export type PickWith<T, KT extends keyof T, V> = {
+  [P in KT]: T[P] extends V ? V : never
+}
+
+export type PickWithOpt<T, KT extends keyof T, V> = {
+  [P in KT]?: T[P] extends V ? V : never
+}
+
+// https://github.com/krzkaczor/ts-essentials Rocks!
+export type DeepPartial<T> = {
+  [P in keyof T]?: T[P] extends Array<infer U>
+    ? Array<DeepPartial<U>>
+    : T[P] extends ReadonlyArray<infer U>
+      ? ReadonlyArray<DeepPartial<U>>
+      : DeepPartial<T[P]>
+}
diff --git a/server/typings/activitypub-processor.model.ts b/server/typings/activitypub-processor.model.ts
deleted file mode 100644 (file)
index 7ed3a65..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-import { Activity } from '../../shared/models/activitypub'
-import { MActorDefault, MActorSignature } from './models'
-
-export type APProcessorOptions<T extends Activity> = {
-  activity: T
-  byActor: MActorSignature
-  inboxActor?: MActorDefault
-  fromFetch?: boolean
-}
diff --git a/server/typings/express.d.ts b/server/typings/express.d.ts
new file mode 100644 (file)
index 0000000..451bf91
--- /dev/null
@@ -0,0 +1,128 @@
+import { RegisteredPlugin } from '../lib/plugins/plugin-manager'
+import {
+  MAccountDefault,
+  MActorAccountChannelId,
+  MActorFollowActorsDefault,
+  MActorFollowActorsDefaultSubscription,
+  MActorFull,
+  MChannelAccountDefault,
+  MComment,
+  MCommentOwnerVideoReply,
+  MUserDefault,
+  MVideoAbuse,
+  MVideoBlacklist,
+  MVideoCaptionVideo,
+  MVideoFullLight,
+  MVideoIdThumbnail,
+  MVideoRedundancyVideo,
+  MVideoShareActor,
+  MVideoThumbnail,
+  MVideoWithRights
+} from '../types/models'
+import { MVideoPlaylistFull, MVideoPlaylistFullSummary } from '../types/models/video/video-playlist'
+import { MVideoImportDefault } from '@server/types/models/video/video-import'
+import { MAccountBlocklist, MActorUrl, MStreamingPlaylist, MVideoFile, MVideoImmutable } from '@server/types/models'
+import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/types/models/video/video-playlist-element'
+import { MAccountVideoRateAccountVideo } from '@server/types/models/video/video-rate'
+import { MVideoChangeOwnershipFull } from '../types/models/video/video-change-ownership'
+import { MPlugin, MServer } from '@server/types/models/server'
+import { MServerBlocklist } from '../types/models/server/server-blocklist'
+import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
+import { UserRole } from '@shared/models'
+import { RegisterServerAuthExternalOptions } from '@shared/models/plugins/register-server-auth.model'
+
+declare module 'express' {
+  export interface Request {
+    query: any
+  }
+
+  interface Response {
+
+    locals: {
+      bypassLogin?: {
+        bypass: boolean
+        pluginName: string
+        authName?: string
+        user: {
+          username: string
+          email: string
+          displayName: string
+          role: UserRole
+        }
+      }
+
+      refreshTokenAuthName?: string
+
+      explicitLogout: boolean
+
+      videoAll?: MVideoFullLight
+      onlyImmutableVideo?: MVideoImmutable
+      onlyVideo?: MVideoThumbnail
+      onlyVideoWithRights?: MVideoWithRights
+      videoId?: MVideoIdThumbnail
+
+      videoShare?: MVideoShareActor
+
+      videoFile?: MVideoFile
+
+      videoImport?: MVideoImportDefault
+
+      videoBlacklist?: MVideoBlacklist
+
+      videoCaption?: MVideoCaptionVideo
+
+      videoAbuse?: MVideoAbuse
+
+      videoStreamingPlaylist?: MStreamingPlaylist
+
+      videoChannel?: MChannelAccountDefault
+
+      videoPlaylistFull?: MVideoPlaylistFull
+      videoPlaylistSummary?: MVideoPlaylistFullSummary
+
+      videoPlaylistElement?: MVideoPlaylistElement
+      videoPlaylistElementAP?: MVideoPlaylistElementVideoUrlPlaylistPrivacy
+
+      accountVideoRate?: MAccountVideoRateAccountVideo
+
+      videoCommentFull?: MCommentOwnerVideoReply
+      videoCommentThread?: MComment
+
+      follow?: MActorFollowActorsDefault
+      subscription?: MActorFollowActorsDefaultSubscription
+
+      nextOwner?: MAccountDefault
+      videoChangeOwnership?: MVideoChangeOwnershipFull
+
+      account?: MAccountDefault
+
+      actorUrl?: MActorUrl
+      actorFull?: MActorFull
+
+      user?: MUserDefault
+
+      server?: MServer
+
+      videoRedundancy?: MVideoRedundancyVideo
+
+      accountBlock?: MAccountBlocklist
+      serverBlock?: MServerBlocklist
+
+      oauth?: {
+        token: MOAuthTokenUser
+      }
+
+      signature?: {
+        actor: MActorAccountChannelId
+      }
+
+      authenticated?: boolean
+
+      registeredPlugin?: RegisteredPlugin
+
+      externalAuth?: RegisterServerAuthExternalOptions
+
+      plugin?: MPlugin
+    }
+  }
+}
diff --git a/server/typings/express.ts b/server/typings/express.ts
deleted file mode 100644 (file)
index 15d445c..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-import { RegisteredPlugin } from '../lib/plugins/plugin-manager'
-import {
-  MAccountDefault,
-  MActorAccountChannelId,
-  MActorFollowActorsDefault,
-  MActorFollowActorsDefaultSubscription,
-  MActorFull,
-  MChannelAccountDefault,
-  MComment,
-  MCommentOwnerVideoReply,
-  MUserDefault,
-  MVideoAbuse,
-  MVideoBlacklist,
-  MVideoCaptionVideo,
-  MVideoFullLight,
-  MVideoIdThumbnail,
-  MVideoRedundancyVideo,
-  MVideoShareActor,
-  MVideoThumbnail,
-  MVideoWithRights
-} from './models'
-import { MVideoPlaylistFull, MVideoPlaylistFullSummary } from './models/video/video-playlist'
-import { MVideoImportDefault } from '@server/typings/models/video/video-import'
-import { MAccountBlocklist, MActorUrl, MStreamingPlaylist, MVideoFile, MVideoImmutable } from '@server/typings/models'
-import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/typings/models/video/video-playlist-element'
-import { MAccountVideoRateAccountVideo } from '@server/typings/models/video/video-rate'
-import { MVideoChangeOwnershipFull } from './models/video/video-change-ownership'
-import { MPlugin, MServer } from '@server/typings/models/server'
-import { MServerBlocklist } from './models/server/server-blocklist'
-import { MOAuthTokenUser } from '@server/typings/models/oauth/oauth-token'
-import { UserRole } from '@shared/models'
-import { RegisterServerAuthExternalOptions } from '@shared/models/plugins/register-server-auth.model'
-
-declare module 'express' {
-  interface Request {
-    query: any
-  }
-
-  interface Response {
-
-    locals: {
-      bypassLogin?: {
-        bypass: boolean
-        pluginName: string
-        authName?: string
-        user: {
-          username: string
-          email: string
-          displayName: string
-          role: UserRole
-        }
-      }
-
-      refreshTokenAuthName?: string
-
-      explicitLogout: boolean
-
-      videoAll?: MVideoFullLight
-      onlyImmutableVideo?: MVideoImmutable
-      onlyVideo?: MVideoThumbnail
-      onlyVideoWithRights?: MVideoWithRights
-      videoId?: MVideoIdThumbnail
-
-      videoShare?: MVideoShareActor
-
-      videoFile?: MVideoFile
-
-      videoImport?: MVideoImportDefault
-
-      videoBlacklist?: MVideoBlacklist
-
-      videoCaption?: MVideoCaptionVideo
-
-      videoAbuse?: MVideoAbuse
-
-      videoStreamingPlaylist?: MStreamingPlaylist
-
-      videoChannel?: MChannelAccountDefault
-
-      videoPlaylistFull?: MVideoPlaylistFull
-      videoPlaylistSummary?: MVideoPlaylistFullSummary
-
-      videoPlaylistElement?: MVideoPlaylistElement
-      videoPlaylistElementAP?: MVideoPlaylistElementVideoUrlPlaylistPrivacy
-
-      accountVideoRate?: MAccountVideoRateAccountVideo
-
-      videoCommentFull?: MCommentOwnerVideoReply
-      videoCommentThread?: MComment
-
-      follow?: MActorFollowActorsDefault
-      subscription?: MActorFollowActorsDefaultSubscription
-
-      nextOwner?: MAccountDefault
-      videoChangeOwnership?: MVideoChangeOwnershipFull
-
-      account?: MAccountDefault
-
-      actorUrl?: MActorUrl
-      actorFull?: MActorFull
-
-      user?: MUserDefault
-
-      server?: MServer
-
-      videoRedundancy?: MVideoRedundancyVideo
-
-      accountBlock?: MAccountBlocklist
-      serverBlock?: MServerBlocklist
-
-      oauth?: {
-        token: MOAuthTokenUser
-      }
-
-      signature?: {
-        actor: MActorAccountChannelId
-      }
-
-      authenticated?: boolean
-
-      registeredPlugin?: RegisteredPlugin
-
-      externalAuth?: RegisterServerAuthExternalOptions
-
-      plugin?: MPlugin
-    }
-  }
-}
diff --git a/server/typings/models/account/account-blocklist.ts b/server/typings/models/account/account-blocklist.ts
deleted file mode 100644 (file)
index 0d8bf11..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-import { AccountBlocklistModel } from '../../../models/account/account-blocklist'
-import { PickWith } from '../../utils'
-import { MAccountDefault, MAccountFormattable } from './account'
-
-type Use<K extends keyof AccountBlocklistModel, M> = PickWith<AccountBlocklistModel, K, M>
-
-// ############################################################################
-
-export type MAccountBlocklist = Omit<AccountBlocklistModel, 'ByAccount' | 'BlockedAccount'>
-
-// ############################################################################
-
-export type MAccountBlocklistId = Pick<AccountBlocklistModel, 'id'>
-
-export type MAccountBlocklistAccounts =
-  MAccountBlocklist &
-  Use<'ByAccount', MAccountDefault> &
-  Use<'BlockedAccount', MAccountDefault>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MAccountBlocklistFormattable =
-  Pick<MAccountBlocklist, 'createdAt'> &
-  Use<'ByAccount', MAccountFormattable> &
-  Use<'BlockedAccount', MAccountFormattable>
diff --git a/server/typings/models/account/account.ts b/server/typings/models/account/account.ts
deleted file mode 100644 (file)
index 7b826ee..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-import { AccountModel } from '../../../models/account/account'
-import {
-  MActor,
-  MActorAP,
-  MActorAPI,
-  MActorAudience,
-  MActorDefault,
-  MActorDefaultLight,
-  MActorFormattable,
-  MActorId,
-  MActorServer,
-  MActorSummary,
-  MActorSummaryFormattable,
-  MActorUrl
-} from './actor'
-import { FunctionProperties, PickWith } from '../../utils'
-import { MAccountBlocklistId } from './account-blocklist'
-import { MChannelDefault } from '../video/video-channels'
-
-type Use<K extends keyof AccountModel, M> = PickWith<AccountModel, K, M>
-
-// ############################################################################
-
-export type MAccount =
-  Omit<AccountModel, 'Actor' | 'User' | 'Application' | 'VideoChannels' | 'VideoPlaylists' |
-  'VideoComments' | 'BlockedAccounts'>
-
-// ############################################################################
-
-// Only some attributes
-export type MAccountId = Pick<MAccount, 'id'>
-export type MAccountUserId = Pick<MAccount, 'userId'>
-
-// Only some Actor attributes
-export type MAccountUrl = Use<'Actor', MActorUrl>
-export type MAccountAudience = Use<'Actor', MActorAudience>
-
-export type MAccountIdActor =
-  MAccountId &
-  Use<'Actor', MActor>
-
-export type MAccountIdActorId =
-  MAccountId &
-  Use<'Actor', MActorId>
-
-// ############################################################################
-
-// Default scope
-export type MAccountDefault =
-  MAccount &
-  Use<'Actor', MActorDefault>
-
-// Default with default association scopes
-export type MAccountDefaultChannelDefault =
-  MAccount &
-  Use<'Actor', MActorDefault> &
-  Use<'VideoChannels', MChannelDefault[]>
-
-// We don't need some actors attributes
-export type MAccountLight =
-  MAccount &
-  Use<'Actor', MActorDefaultLight>
-
-// ############################################################################
-
-// Full actor
-export type MAccountActor =
-  MAccount &
-  Use<'Actor', MActor>
-
-// Full actor with server
-export type MAccountServer =
-  MAccount &
-  Use<'Actor', MActorServer>
-
-// ############################################################################
-
-// For API
-
-export type MAccountSummary =
-  FunctionProperties<MAccount> &
-  Pick<MAccount, 'id' | 'name'> &
-  Use<'Actor', MActorSummary>
-
-export type MAccountSummaryBlocks =
-  MAccountSummary &
-  Use<'BlockedAccounts', MAccountBlocklistId[]>
-
-export type MAccountAPI =
-  MAccount &
-  Use<'Actor', MActorAPI>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MAccountSummaryFormattable =
-  FunctionProperties<MAccount> &
-  Pick<MAccount, 'id' | 'name'> &
-  Use<'Actor', MActorSummaryFormattable>
-
-export type MAccountFormattable =
-  FunctionProperties<MAccount> &
-  Pick<MAccount, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'userId'> &
-  Use<'Actor', MActorFormattable>
-
-export type MAccountAP =
-  Pick<MAccount, 'name' | 'description'> &
-  Use<'Actor', MActorAP>
diff --git a/server/typings/models/account/actor-follow.ts b/server/typings/models/account/actor-follow.ts
deleted file mode 100644 (file)
index 5d0c03c..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
-import {
-  MActor,
-  MActorChannelAccountActor,
-  MActorDefault,
-  MActorDefaultAccountChannel,
-  MActorFormattable,
-  MActorHost,
-  MActorUsername
-} from './actor'
-import { PickWith } from '../../utils'
-import { ActorModel } from '@server/models/activitypub/actor'
-import { MChannelDefault } from '../video/video-channels'
-
-type Use<K extends keyof ActorFollowModel, M> = PickWith<ActorFollowModel, K, M>
-
-// ############################################################################
-
-export type MActorFollow = Omit<ActorFollowModel, 'ActorFollower' | 'ActorFollowing'>
-
-// ############################################################################
-
-export type MActorFollowFollowingHost =
-  MActorFollow &
-  Use<'ActorFollowing', MActorUsername & MActorHost>
-
-// ############################################################################
-
-// With actors or actors default
-
-export type MActorFollowActors =
-  MActorFollow &
-  Use<'ActorFollower', MActor> &
-  Use<'ActorFollowing', MActor>
-
-export type MActorFollowActorsDefault =
-  MActorFollow &
-  Use<'ActorFollower', MActorDefault> &
-  Use<'ActorFollowing', MActorDefault>
-
-export type MActorFollowFull =
-  MActorFollow &
-  Use<'ActorFollower', MActorDefaultAccountChannel> &
-  Use<'ActorFollowing', MActorDefaultAccountChannel>
-
-// ############################################################################
-
-// For subscriptions
-
-type SubscriptionFollowing =
-  MActorDefault &
-  PickWith<ActorModel, 'VideoChannel', MChannelDefault>
-
-export type MActorFollowActorsDefaultSubscription =
-  MActorFollow &
-  Use<'ActorFollower', MActorDefault> &
-  Use<'ActorFollowing', SubscriptionFollowing>
-
-export type MActorFollowSubscriptions =
-  MActorFollow &
-  Use<'ActorFollowing', MActorChannelAccountActor>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MActorFollowFormattable =
-  Pick<MActorFollow, 'id' | 'score' | 'state' | 'createdAt' | 'updatedAt'> &
-  Use<'ActorFollower', MActorFormattable> &
-  Use<'ActorFollowing', MActorFormattable>
diff --git a/server/typings/models/account/actor.ts b/server/typings/models/account/actor.ts
deleted file mode 100644 (file)
index 1160e84..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-import { ActorModel } from '../../../models/activitypub/actor'
-import { FunctionProperties, PickWith, PickWithOpt } from '../../utils'
-import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account'
-import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server'
-import { MAvatar, MAvatarFormattable } from './avatar'
-import { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video'
-
-type Use<K extends keyof ActorModel, M> = PickWith<ActorModel, K, M>
-
-// ############################################################################
-
-export type MActor = Omit<ActorModel, 'Account' | 'VideoChannel' | 'ActorFollowing' | 'Avatar' | 'ActorFollowers' | 'Server'>
-
-// ############################################################################
-
-export type MActorUrl = Pick<MActor, 'url'>
-export type MActorId = Pick<MActor, 'id'>
-export type MActorUsername = Pick<MActor, 'preferredUsername'>
-
-export type MActorFollowersUrl = Pick<MActor, 'followersUrl'>
-export type MActorAudience = MActorUrl & MActorFollowersUrl
-export type MActorWithInboxes = Pick<ActorModel, 'sharedInboxUrl' | 'inboxUrl' | 'getSharedInbox'>
-export type MActorSignature = MActorAccountChannelId
-
-export type MActorLight = Omit<MActor, 'privateKey' | 'privateKey'>
-
-// ############################################################################
-
-// Some association attributes
-
-export type MActorHost = Use<'Server', MServerHost>
-export type MActorRedundancyAllowedOpt = PickWithOpt<ActorModel, 'Server', MServerRedundancyAllowed>
-
-export type MActorDefaultLight =
-  MActorLight &
-  Use<'Server', MServerHost> &
-  Use<'Avatar', MAvatar>
-
-export type MActorAccountId =
-  MActor &
-  Use<'Account', MAccountId>
-export type MActorAccountIdActor =
-  MActor &
-  Use<'Account', MAccountIdActor>
-
-export type MActorChannelId =
-  MActor &
-  Use<'VideoChannel', MChannelId>
-export type MActorChannelIdActor =
-  MActor &
-  Use<'VideoChannel', MChannelIdActor>
-
-export type MActorAccountChannelId = MActorAccountId & MActorChannelId
-export type MActorAccountChannelIdActor = MActorAccountIdActor & MActorChannelIdActor
-
-// ############################################################################
-
-// Include raw account/channel/server
-
-export type MActorAccount =
-  MActor &
-  Use<'Account', MAccount>
-
-export type MActorChannel =
-  MActor &
-  Use<'VideoChannel', MChannel>
-
-export type MActorDefaultAccountChannel = MActorDefault & MActorAccount & MActorChannel
-
-export type MActorServer =
-  MActor &
-  Use<'Server', MServer>
-
-// ############################################################################
-
-// Complex actor associations
-
-export type MActorDefault =
-  MActor &
-  Use<'Server', MServer> &
-  Use<'Avatar', MAvatar>
-
-// Actor with channel that is associated to an account and its actor
-// Actor -> VideoChannel -> Account -> Actor
-export type MActorChannelAccountActor =
-  MActor &
-  Use<'VideoChannel', MChannelAccountActor>
-
-export type MActorFull =
-  MActor &
-  Use<'Server', MServer> &
-  Use<'Avatar', MAvatar> &
-  Use<'Account', MAccount> &
-  Use<'VideoChannel', MChannelAccountActor>
-
-// Same than ActorFull, but the account and the channel have their actor
-export type MActorFullActor =
-  MActor &
-  Use<'Server', MServer> &
-  Use<'Avatar', MAvatar> &
-  Use<'Account', MAccountDefault> &
-  Use<'VideoChannel', MChannelAccountDefault>
-
-// ############################################################################
-
-// API
-
-export type MActorSummary =
-  FunctionProperties<MActor> &
-  Pick<MActor, 'id' | 'preferredUsername' | 'url' | 'serverId' | 'avatarId'> &
-  Use<'Server', MServerHost> &
-  Use<'Avatar', MAvatar>
-
-export type MActorSummaryBlocks =
-  MActorSummary &
-  Use<'Server', MServerHostBlocks>
-
-export type MActorAPI =
-  Omit<MActorDefault, 'publicKey' | 'privateKey' | 'inboxUrl' | 'outboxUrl' | 'sharedInboxUrl' |
-  'followersUrl' | 'followingUrl' | 'url' | 'createdAt' | 'updatedAt'>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MActorSummaryFormattable =
-  FunctionProperties<MActor> &
-  Pick<MActor, 'url' | 'preferredUsername'> &
-  Use<'Server', MServerHost> &
-  Use<'Avatar', MAvatarFormattable>
-
-export type MActorFormattable =
-  MActorSummaryFormattable &
-  Pick<MActor, 'id' | 'followingCount' | 'followersCount' | 'createdAt' | 'updatedAt'> &
-  Use<'Server', MServerHost & Partial<Pick<MServer, 'redundancyAllowed'>>>
-
-export type MActorAP =
-  MActor &
-  Use<'Avatar', MAvatar>
diff --git a/server/typings/models/account/avatar.ts b/server/typings/models/account/avatar.ts
deleted file mode 100644 (file)
index 21b4718..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-import { AvatarModel } from '../../../models/avatar/avatar'
-import { FunctionProperties } from '@server/typings/utils'
-
-export type MAvatar = AvatarModel
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MAvatarFormattable =
-  FunctionProperties<MAvatar> &
-  Pick<MAvatar, 'filename' | 'createdAt' | 'updatedAt'>
diff --git a/server/typings/models/account/index.ts b/server/typings/models/account/index.ts
deleted file mode 100644 (file)
index 513c09c..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-export * from './account'
-export * from './account-blocklist'
-export * from './actor'
-export * from './actor-follow'
-export * from './avatar'
diff --git a/server/typings/models/index.ts b/server/typings/models/index.ts
deleted file mode 100644 (file)
index 78b4948..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-export * from './account'
-export * from './oauth'
-export * from './server'
-export * from './user'
-export * from './video'
diff --git a/server/typings/models/oauth/index.ts b/server/typings/models/oauth/index.ts
deleted file mode 100644 (file)
index 36b7ea8..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from './oauth-client'
-export * from './oauth-token'
diff --git a/server/typings/models/oauth/oauth-client.ts b/server/typings/models/oauth/oauth-client.ts
deleted file mode 100644 (file)
index 904a078..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-import { OAuthClientModel } from '@server/models/oauth/oauth-client'
-
-export type MOAuthClient = Omit<OAuthClientModel, 'OAuthTokens'>
diff --git a/server/typings/models/oauth/oauth-token.ts b/server/typings/models/oauth/oauth-token.ts
deleted file mode 100644 (file)
index b24a95f..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-import { OAuthTokenModel } from '@server/models/oauth/oauth-token'
-import { PickWith } from '@server/typings/utils'
-import { MUserAccountUrl } from '../user/user'
-
-type Use<K extends keyof OAuthTokenModel, M> = PickWith<OAuthTokenModel, K, M>
-
-// ############################################################################
-
-export type MOAuthToken = Omit<OAuthTokenModel, 'User' | 'OAuthClients'>
-
-export type MOAuthTokenUser =
-  MOAuthToken &
-  Use<'User', MUserAccountUrl> &
-  { user?: MUserAccountUrl }
diff --git a/server/typings/models/server/index.ts b/server/typings/models/server/index.ts
deleted file mode 100644 (file)
index c853795..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-export * from './plugin'
-export * from './server'
-export * from './server-blocklist'
diff --git a/server/typings/models/server/plugin.ts b/server/typings/models/server/plugin.ts
deleted file mode 100644 (file)
index 83eb837..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-import { PluginModel } from '@server/models/server/plugin'
-
-export type MPlugin = PluginModel
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MPluginFormattable =
-  Pick<MPlugin, 'name' | 'type' | 'version' | 'latestVersion' | 'enabled' | 'uninstalled'
-  | 'peertubeEngine' | 'description' | 'homepage' | 'settings' | 'createdAt' | 'updatedAt'>
diff --git a/server/typings/models/server/server-blocklist.ts b/server/typings/models/server/server-blocklist.ts
deleted file mode 100644 (file)
index ff6f491..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-import { ServerBlocklistModel } from '@server/models/server/server-blocklist'
-import { PickWith } from '@server/typings/utils'
-import { MAccountDefault, MAccountFormattable } from '../account/account'
-import { MServer, MServerFormattable } from './server'
-
-type Use<K extends keyof ServerBlocklistModel, M> = PickWith<ServerBlocklistModel, K, M>
-
-// ############################################################################
-
-export type MServerBlocklist = Omit<ServerBlocklistModel, 'ByAccount' | 'BlockedServer'>
-
-// ############################################################################
-
-export type MServerBlocklistAccountServer =
-  MServerBlocklist &
-  Use<'ByAccount', MAccountDefault> &
-  Use<'BlockedServer', MServer>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MServerBlocklistFormattable =
-  Pick<MServerBlocklist, 'createdAt'> &
-  Use<'ByAccount', MAccountFormattable> &
-  Use<'BlockedServer', MServerFormattable>
diff --git a/server/typings/models/server/server.ts b/server/typings/models/server/server.ts
deleted file mode 100644 (file)
index b35e55a..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-import { ServerModel } from '../../../models/server/server'
-import { FunctionProperties, PickWith } from '../../utils'
-import { MAccountBlocklistId } from '../account'
-
-type Use<K extends keyof ServerModel, M> = PickWith<ServerModel, K, M>
-
-// ############################################################################
-
-export type MServer = Omit<ServerModel, 'Actors' | 'BlockedByAccounts'>
-
-// ############################################################################
-
-export type MServerHost = Pick<MServer, 'host'>
-export type MServerRedundancyAllowed = Pick<MServer, 'redundancyAllowed'>
-
-export type MServerHostBlocks =
-  MServerHost &
-  Use<'BlockedByAccounts', MAccountBlocklistId[]>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MServerFormattable =
-  FunctionProperties<MServer> &
-  Pick<MServer, 'host'>
diff --git a/server/typings/models/user/index.ts b/server/typings/models/user/index.ts
deleted file mode 100644 (file)
index 6657b21..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-export * from './user'
-export * from './user-notification'
-export * from './user-notification-setting'
-export * from './user-video-history'
diff --git a/server/typings/models/user/user-notification-setting.ts b/server/typings/models/user/user-notification-setting.ts
deleted file mode 100644 (file)
index c674add..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-import { UserNotificationSettingModel } from '@server/models/account/user-notification-setting'
-
-export type MNotificationSetting = Omit<UserNotificationSettingModel, 'User'>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MNotificationSettingFormattable = MNotificationSetting
diff --git a/server/typings/models/user/user-notification.ts b/server/typings/models/user/user-notification.ts
deleted file mode 100644 (file)
index 2080360..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-import { UserNotificationModel } from '../../../models/account/user-notification'
-import { PickWith, PickWithOpt } from '../../utils'
-import { VideoModel } from '../../../models/video/video'
-import { ActorModel } from '../../../models/activitypub/actor'
-import { ServerModel } from '../../../models/server/server'
-import { AvatarModel } from '../../../models/avatar/avatar'
-import { VideoChannelModel } from '../../../models/video/video-channel'
-import { AccountModel } from '../../../models/account/account'
-import { VideoCommentModel } from '../../../models/video/video-comment'
-import { VideoAbuseModel } from '../../../models/video/video-abuse'
-import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
-import { VideoImportModel } from '../../../models/video/video-import'
-import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
-
-type Use<K extends keyof UserNotificationModel, M> = PickWith<UserNotificationModel, K, M>
-
-// ############################################################################
-
-export module UserNotificationIncludes {
-
-  export type VideoInclude = Pick<VideoModel, 'id' | 'uuid' | 'name'>
-  export type VideoIncludeChannel =
-    VideoInclude &
-    PickWith<VideoModel, 'VideoChannel', VideoChannelIncludeActor>
-
-  export type ActorInclude =
-    Pick<ActorModel, 'preferredUsername' | 'getHost'> &
-    PickWith<ActorModel, 'Avatar', Pick<AvatarModel, 'filename' | 'getStaticPath'>> &
-    PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>>
-
-  export type VideoChannelInclude = Pick<VideoChannelModel, 'id' | 'name' | 'getDisplayName'>
-  export type VideoChannelIncludeActor =
-    VideoChannelInclude &
-    PickWith<VideoChannelModel, 'Actor', ActorInclude>
-
-  export type AccountInclude = Pick<AccountModel, 'id' | 'name' | 'getDisplayName'>
-  export type AccountIncludeActor =
-    AccountInclude &
-    PickWith<AccountModel, 'Actor', ActorInclude>
-
-  export type VideoCommentInclude =
-    Pick<VideoCommentModel, 'id' | 'originCommentId' | 'getThreadId'> &
-    PickWith<VideoCommentModel, 'Account', AccountIncludeActor> &
-    PickWith<VideoCommentModel, 'Video', VideoInclude>
-
-  export type VideoAbuseInclude =
-    Pick<VideoAbuseModel, 'id'> &
-    PickWith<VideoAbuseModel, 'Video', VideoInclude>
-
-  export type VideoBlacklistInclude =
-    Pick<VideoBlacklistModel, 'id'> &
-    PickWith<VideoAbuseModel, 'Video', VideoInclude>
-
-  export type VideoImportInclude =
-    Pick<VideoImportModel, 'id' | 'magnetUri' | 'targetUrl' | 'torrentName'> &
-    PickWith<VideoImportModel, 'Video', VideoInclude>
-
-  export type ActorFollower =
-    Pick<ActorModel, 'preferredUsername' | 'getHost'> &
-    PickWith<ActorModel, 'Account', AccountInclude> &
-    PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>> &
-    PickWithOpt<ActorModel, 'Avatar', Pick<AvatarModel, 'filename' | 'getStaticPath'>>
-
-  export type ActorFollowing =
-    Pick<ActorModel, 'preferredUsername' | 'type' | 'getHost'> &
-    PickWith<ActorModel, 'VideoChannel', VideoChannelInclude> &
-    PickWith<ActorModel, 'Account', AccountInclude> &
-    PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>>
-
-  export type ActorFollowInclude =
-    Pick<ActorFollowModel, 'id' | 'state'> &
-    PickWith<ActorFollowModel, 'ActorFollower', ActorFollower> &
-    PickWith<ActorFollowModel, 'ActorFollowing', ActorFollowing>
-}
-
-// ############################################################################
-
-export type MUserNotification =
-  Omit<UserNotificationModel, 'User' | 'Video' | 'Comment' | 'VideoAbuse' | 'VideoBlacklist' |
-  'VideoImport' | 'Account' | 'ActorFollow'>
-
-// ############################################################################
-
-export type UserNotificationModelForApi =
-  MUserNotification &
-  Use<'Video', UserNotificationIncludes.VideoIncludeChannel> &
-  Use<'Comment', UserNotificationIncludes.VideoCommentInclude> &
-  Use<'VideoAbuse', UserNotificationIncludes.VideoAbuseInclude> &
-  Use<'VideoBlacklist', UserNotificationIncludes.VideoBlacklistInclude> &
-  Use<'VideoImport', UserNotificationIncludes.VideoImportInclude> &
-  Use<'ActorFollow', UserNotificationIncludes.ActorFollowInclude> &
-  Use<'Account', UserNotificationIncludes.AccountIncludeActor>
diff --git a/server/typings/models/user/user-video-history.ts b/server/typings/models/user/user-video-history.ts
deleted file mode 100644 (file)
index 62673ab..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-import { UserVideoHistoryModel } from '../../../models/account/user-video-history'
-
-export type MUserVideoHistory = Omit<UserVideoHistoryModel, 'Video' | 'User'>
-
-export type MUserVideoHistoryTime = Pick<MUserVideoHistory, 'currentTime'>
diff --git a/server/typings/models/user/user.ts b/server/typings/models/user/user.ts
deleted file mode 100644 (file)
index 31cf075..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-import { UserModel } from '../../../models/account/user'
-import { PickWith, PickWithOpt } from '../../utils'
-import {
-  MAccount,
-  MAccountDefault,
-  MAccountDefaultChannelDefault,
-  MAccountFormattable,
-  MAccountId,
-  MAccountIdActorId,
-  MAccountUrl
-} from '../account'
-import { MNotificationSetting, MNotificationSettingFormattable } from './user-notification-setting'
-import { AccountModel } from '@server/models/account/account'
-import { MChannelFormattable } from '../video/video-channels'
-import { MVideoPlaylist } from '@server/typings/models'
-
-type Use<K extends keyof UserModel, M> = PickWith<UserModel, K, M>
-
-// ############################################################################
-
-export type MUser = Omit<UserModel, 'Account' | 'NotificationSetting' | 'VideoImports' | 'OAuthTokens'>
-
-// ############################################################################
-
-export type MUserQuotaUsed = MUser & { videoQuotaUsed?: number, videoQuotaUsedDaily?: number }
-export type MUserId = Pick<UserModel, 'id'>
-
-// ############################################################################
-
-// With account
-
-export type MUserAccountId =
-  MUser &
-  Use<'Account', MAccountId>
-
-export type MUserAccountUrl =
-  MUser &
-  Use<'Account', MAccountUrl & MAccountIdActorId>
-
-export type MUserAccount =
-  MUser &
-  Use<'Account', MAccount>
-
-export type MUserAccountDefault =
-  MUser &
-  Use<'Account', MAccountDefault>
-
-// With channel
-
-export type MUserNotifSettingChannelDefault =
-  MUser &
-  Use<'NotificationSetting', MNotificationSetting> &
-  Use<'Account', MAccountDefaultChannelDefault>
-
-// With notification settings
-
-export type MUserWithNotificationSetting =
-  MUser &
-  Use<'NotificationSetting', MNotificationSetting>
-
-export type MUserNotifSettingAccount =
-  MUser &
-  Use<'NotificationSetting', MNotificationSetting> &
-  Use<'Account', MAccount>
-
-// Default scope
-
-export type MUserDefault =
-  MUser &
-  Use<'NotificationSetting', MNotificationSetting> &
-  Use<'Account', MAccountDefault>
-
-// ############################################################################
-
-// Format for API or AP object
-
-type MAccountWithChannels = MAccountFormattable & PickWithOpt<AccountModel, 'VideoChannels', MChannelFormattable[]>
-type MAccountWithChannelsAndSpecialPlaylists =
-  MAccountWithChannels &
-  PickWithOpt<AccountModel, 'VideoPlaylists', MVideoPlaylist[]>
-
-export type MUserFormattable =
-  MUserQuotaUsed &
-  Use<'Account', MAccountWithChannels> &
-  PickWithOpt<UserModel, 'NotificationSetting', MNotificationSettingFormattable>
-
-export type MMyUserFormattable =
-  MUserFormattable &
-  Use<'Account', MAccountWithChannelsAndSpecialPlaylists>
diff --git a/server/typings/models/video/index.ts b/server/typings/models/video/index.ts
deleted file mode 100644 (file)
index bd69c8a..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-export * from './schedule-video-update'
-export * from './tag'
-export * from './thumbnail'
-export * from './video'
-export * from './video-abuse'
-export * from './video-blacklist'
-export * from './video-caption'
-export * from './video-change-ownership'
-export * from './video-channels'
-export * from './video-comment'
-export * from './video-file'
-export * from './video-import'
-export * from './video-playlist'
-export * from './video-playlist-element'
-export * from './video-rate'
-export * from './video-redundancy'
-export * from './video-share'
-export * from './video-streaming-playlist'
diff --git a/server/typings/models/video/schedule-video-update.ts b/server/typings/models/video/schedule-video-update.ts
deleted file mode 100644 (file)
index 95a53d1..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update'
-import { PickWith } from '@server/typings/utils'
-import { MVideoAPWithoutCaption, MVideoWithBlacklistLight } from './video'
-
-type Use<K extends keyof ScheduleVideoUpdateModel, M> = PickWith<ScheduleVideoUpdateModel, K, M>
-
-// ############################################################################
-
-export type MScheduleVideoUpdate = Omit<ScheduleVideoUpdateModel, 'Video'>
-
-// ############################################################################
-
-export type MScheduleVideoUpdateVideoAll =
-  MScheduleVideoUpdate &
-  Use<'Video', MVideoAPWithoutCaption & MVideoWithBlacklistLight>
-
-// Format for API or AP object
-
-export type MScheduleVideoUpdateFormattable = Pick<MScheduleVideoUpdate, 'updateAt' | 'privacy'>
diff --git a/server/typings/models/video/tag.ts b/server/typings/models/video/tag.ts
deleted file mode 100644 (file)
index 64a6887..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-import { TagModel } from '../../../models/video/tag'
-
-export type MTag = Omit<TagModel, 'Videos'>
diff --git a/server/typings/models/video/thumbnail.ts b/server/typings/models/video/thumbnail.ts
deleted file mode 100644 (file)
index c03ba55..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-import { ThumbnailModel } from '../../../models/video/thumbnail'
-
-export type MThumbnail = Omit<ThumbnailModel, 'Video' | 'VideoPlaylist'>
diff --git a/server/typings/models/video/video-abuse.ts b/server/typings/models/video/video-abuse.ts
deleted file mode 100644 (file)
index d60f05e..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-import { VideoAbuseModel } from '../../../models/video/video-abuse'
-import { PickWith } from '../../utils'
-import { MVideoAccountLightBlacklistAllFiles, MVideo } from './video'
-import { MAccountDefault, MAccountFormattable } from '../account'
-
-type Use<K extends keyof VideoAbuseModel, M> = PickWith<VideoAbuseModel, K, M>
-
-// ############################################################################
-
-export type MVideoAbuse = Omit<VideoAbuseModel, 'Account' | 'Video' | 'toActivityPubObject'>
-
-// ############################################################################
-
-export type MVideoAbuseId = Pick<VideoAbuseModel, 'id'>
-
-export type MVideoAbuseVideo =
-  MVideoAbuse &
-  Pick<VideoAbuseModel, 'toActivityPubObject'> &
-  Use<'Video', MVideo>
-
-export type MVideoAbuseAccountVideo =
-  MVideoAbuse &
-  Pick<VideoAbuseModel, 'toActivityPubObject'> &
-  Use<'Video', MVideoAccountLightBlacklistAllFiles> &
-  Use<'Account', MAccountDefault>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MVideoAbuseFormattable =
-  MVideoAbuse &
-  Use<'Account', MAccountFormattable> &
-  Use<'Video', Pick<MVideoAccountLightBlacklistAllFiles,
-  'id' | 'uuid' | 'name' | 'nsfw' | 'getMiniatureStaticPath' | 'isBlacklisted' | 'VideoChannel'>>
diff --git a/server/typings/models/video/video-blacklist.ts b/server/typings/models/video/video-blacklist.ts
deleted file mode 100644 (file)
index ddb4db8..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
-import { PickWith } from '@server/typings/utils'
-import { MVideo, MVideoFormattable } from './video'
-
-type Use<K extends keyof VideoBlacklistModel, M> = PickWith<VideoBlacklistModel, K, M>
-
-// ############################################################################
-
-export type MVideoBlacklist = Omit<VideoBlacklistModel, 'Video'>
-
-export type MVideoBlacklistLight = Pick<MVideoBlacklist, 'id' | 'reason' | 'unfederated'>
-export type MVideoBlacklistUnfederated = Pick<MVideoBlacklist, 'unfederated'>
-
-// ############################################################################
-
-export type MVideoBlacklistLightVideo =
-  MVideoBlacklistLight &
-  Use<'Video', MVideo>
-
-export type MVideoBlacklistVideo =
-  MVideoBlacklist &
-  Use<'Video', MVideo>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MVideoBlacklistFormattable =
-  MVideoBlacklist &
-  Use<'Video', MVideoFormattable>
diff --git a/server/typings/models/video/video-caption.ts b/server/typings/models/video/video-caption.ts
deleted file mode 100644 (file)
index e7aff69..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-import { VideoCaptionModel } from '../../../models/video/video-caption'
-import { FunctionProperties, PickWith } from '@server/typings/utils'
-import { MVideo, MVideoUUID } from './video'
-
-type Use<K extends keyof VideoCaptionModel, M> = PickWith<VideoCaptionModel, K, M>
-
-// ############################################################################
-
-export type MVideoCaption = Omit<VideoCaptionModel, 'Video'>
-
-// ############################################################################
-
-export type MVideoCaptionLanguage = Pick<MVideoCaption, 'language'>
-export type MVideoCaptionLanguageUrl = Pick<MVideoCaption, 'language' | 'fileUrl' | 'getFileUrl'>
-
-export type MVideoCaptionVideo =
-  MVideoCaption &
-  Use<'Video', Pick<MVideo, 'id' | 'remote' | 'uuid'>>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MVideoCaptionFormattable =
-  FunctionProperties<MVideoCaption> &
-  Pick<MVideoCaption, 'language'> &
-  Use<'Video', MVideoUUID>
diff --git a/server/typings/models/video/video-change-ownership.ts b/server/typings/models/video/video-change-ownership.ts
deleted file mode 100644 (file)
index 971dc3d..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-import { VideoChangeOwnershipModel } from '@server/models/video/video-change-ownership'
-import { PickWith } from '@server/typings/utils'
-import { MAccountDefault, MAccountFormattable } from '../account/account'
-import { MVideo, MVideoWithAllFiles } from './video'
-
-type Use<K extends keyof VideoChangeOwnershipModel, M> = PickWith<VideoChangeOwnershipModel, K, M>
-
-// ############################################################################
-
-export type MVideoChangeOwnership = Omit<VideoChangeOwnershipModel, 'Initiator' | 'NextOwner' | 'Video'>
-
-export type MVideoChangeOwnershipFull =
-  MVideoChangeOwnership &
-  Use<'Initiator', MAccountDefault> &
-  Use<'NextOwner', MAccountDefault> &
-  Use<'Video', MVideoWithAllFiles>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MVideoChangeOwnershipFormattable =
-  Pick<MVideoChangeOwnership, 'id' | 'status' | 'createdAt'> &
-  Use<'Initiator', MAccountFormattable> &
-  Use<'NextOwner', MAccountFormattable> &
-  Use<'Video', Pick<MVideo, 'id' | 'uuid' | 'url' | 'name'>>
diff --git a/server/typings/models/video/video-channels.ts b/server/typings/models/video/video-channels.ts
deleted file mode 100644 (file)
index 50f7c2d..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-import { FunctionProperties, PickWith, PickWithOpt } from '../../utils'
-import { VideoChannelModel } from '../../../models/video/video-channel'
-import {
-  MAccountActor,
-  MAccountAPI,
-  MAccountDefault,
-  MAccountFormattable,
-  MAccountLight,
-  MAccountSummaryBlocks,
-  MAccountSummaryFormattable,
-  MAccountUrl,
-  MAccountUserId,
-  MActor,
-  MActorAccountChannelId,
-  MActorAP,
-  MActorAPI,
-  MActorDefault,
-  MActorDefaultLight,
-  MActorFormattable,
-  MActorLight,
-  MActorSummary,
-  MActorSummaryFormattable, MActorUrl
-} from '../account'
-import { MVideo } from './video'
-
-type Use<K extends keyof VideoChannelModel, M> = PickWith<VideoChannelModel, K, M>
-
-// ############################################################################
-
-export type MChannel = Omit<VideoChannelModel, 'Actor' | 'Account' | 'Videos' | 'VideoPlaylists'>
-
-// ############################################################################
-
-export type MChannelId = Pick<MChannel, 'id'>
-
-// ############################################################################
-
-export type MChannelIdActor =
-  MChannelId &
-  Use<'Actor', MActorAccountChannelId>
-
-export type MChannelUserId =
-  Pick<MChannel, 'accountId'> &
-  Use<'Account', MAccountUserId>
-
-export type MChannelActor =
-  MChannel &
-  Use<'Actor', MActor>
-
-export type MChannelUrl = Use<'Actor', MActorUrl>
-
-// Default scope
-export type MChannelDefault =
-  MChannel &
-  Use<'Actor', MActorDefault>
-
-// ############################################################################
-
-// Not all association attributes
-
-export type MChannelLight =
-  MChannel &
-  Use<'Actor', MActorDefaultLight>
-
-export type MChannelActorLight =
-  MChannel &
-  Use<'Actor', MActorLight>
-
-export type MChannelAccountLight =
-  MChannel &
-  Use<'Actor', MActorDefaultLight> &
-  Use<'Account', MAccountLight>
-
-// ############################################################################
-
-// Account associations
-
-export type MChannelAccountActor =
-  MChannel &
-  Use<'Account', MAccountActor>
-
-export type MChannelAccountDefault =
-  MChannel &
-  Use<'Actor', MActorDefault> &
-  Use<'Account', MAccountDefault>
-
-export type MChannelActorAccountActor =
-  MChannel &
-  Use<'Account', MAccountActor> &
-  Use<'Actor', MActor>
-
-// ############################################################################
-
-// Videos  associations
-export type MChannelVideos =
-  MChannel &
-  Use<'Videos', MVideo[]>
-
-export type MChannelActorAccountDefaultVideos =
-  MChannel &
-  Use<'Actor', MActorDefault> &
-  Use<'Account', MAccountDefault> &
-  Use<'Videos', MVideo[]>
-
-// ############################################################################
-
-// For API
-
-export type MChannelSummary =
-  FunctionProperties<MChannel> &
-  Pick<MChannel, 'id' | 'name' | 'description' | 'actorId'> &
-  Use<'Actor', MActorSummary>
-
-export type MChannelSummaryAccount =
-  MChannelSummary &
-  Use<'Account', MAccountSummaryBlocks>
-
-export type MChannelAPI =
-  MChannel &
-  Use<'Actor', MActorAPI> &
-  Use<'Account', MAccountAPI>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MChannelSummaryFormattable =
-  FunctionProperties<MChannel> &
-  Pick<MChannel, 'id' | 'name'> &
-  Use<'Actor', MActorSummaryFormattable>
-
-export type MChannelAccountSummaryFormattable =
-  MChannelSummaryFormattable &
-  Use<'Account', MAccountSummaryFormattable>
-
-export type MChannelFormattable =
-  FunctionProperties<MChannel> &
-  Pick<MChannel, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'support'> &
-  Use<'Actor', MActorFormattable> &
-  PickWithOpt<VideoChannelModel, 'Account', MAccountFormattable>
-
-export type MChannelAP =
-  Pick<MChannel, 'name' | 'description' | 'support'> &
-  Use<'Actor', MActorAP> &
-  Use<'Account', MAccountUrl>
diff --git a/server/typings/models/video/video-comment.ts b/server/typings/models/video/video-comment.ts
deleted file mode 100644 (file)
index d6e0b66..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-import { VideoCommentModel } from '../../../models/video/video-comment'
-import { PickWith, PickWithOpt } from '../../utils'
-import { MAccountDefault, MAccountFormattable, MAccountUrl } from '../account'
-import { MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUrl } from './video'
-
-type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M>
-
-// ############################################################################
-
-export type MComment = Omit<VideoCommentModel, 'OriginVideoComment' | 'InReplyToVideoComment' | 'Video' | 'Account'>
-export type MCommentTotalReplies = MComment & { totalReplies?: number }
-export type MCommentId = Pick<MComment, 'id'>
-export type MCommentUrl = Pick<MComment, 'url'>
-
-// ############################################################################
-
-export type MCommentOwner =
-  MComment &
-  Use<'Account', MAccountDefault>
-
-export type MCommentVideo =
-  MComment &
-  Use<'Video', MVideoAccountLight>
-
-export type MCommentReply =
-  MComment &
-  Use<'InReplyToVideoComment', MComment>
-
-export type MCommentOwnerVideo =
-  MComment &
-  Use<'Account', MAccountDefault> &
-  Use<'Video', MVideoAccountLight>
-
-export type MCommentOwnerVideoReply =
-  MComment &
-  Use<'Account', MAccountDefault> &
-  Use<'Video', MVideoAccountLight> &
-  Use<'InReplyToVideoComment', MComment>
-
-export type MCommentOwnerReplyVideoLight =
-  MComment &
-  Use<'Account', MAccountDefault> &
-  Use<'InReplyToVideoComment', MComment> &
-  Use<'Video', MVideoIdUrl>
-
-export type MCommentOwnerVideoFeed =
-  MCommentOwner &
-  Use<'Video', MVideoFeed>
-
-// ############################################################################
-
-export type MCommentAPI = MComment & { totalReplies: number }
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MCommentFormattable =
-  MCommentTotalReplies &
-  Use<'Account', MAccountFormattable>
-
-export type MCommentAP =
-  MComment &
-  Use<'Account', MAccountUrl> &
-  PickWithOpt<VideoCommentModel, 'Video', MVideoUrl> &
-  PickWithOpt<VideoCommentModel, 'InReplyToVideoComment', MCommentUrl>
diff --git a/server/typings/models/video/video-file.ts b/server/typings/models/video/video-file.ts
deleted file mode 100644 (file)
index 3fcaca7..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-import { VideoFileModel } from '../../../models/video/video-file'
-import { PickWith, PickWithOpt } from '../../utils'
-import { MVideo, MVideoUUID } from './video'
-import { MVideoRedundancy, MVideoRedundancyFileUrl } from './video-redundancy'
-import { MStreamingPlaylistVideo, MStreamingPlaylist } from './video-streaming-playlist'
-
-type Use<K extends keyof VideoFileModel, M> = PickWith<VideoFileModel, K, M>
-
-// ############################################################################
-
-export type MVideoFile = Omit<VideoFileModel, 'Video' | 'RedundancyVideos' | 'VideoStreamingPlaylist'>
-
-export type MVideoFileVideo =
-  MVideoFile &
-  Use<'Video', MVideo>
-
-export type MVideoFileStreamingPlaylist =
-  MVideoFile &
-  Use<'VideoStreamingPlaylist', MStreamingPlaylist>
-
-export type MVideoFileStreamingPlaylistVideo =
-  MVideoFile &
-  Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
-
-export type MVideoFileVideoUUID =
-  MVideoFile &
-  Use<'Video', MVideoUUID>
-
-export type MVideoFileRedundanciesAll =
-  MVideoFile &
-  PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancy[]>
-
-export type MVideoFileRedundanciesOpt =
-  MVideoFile &
-  PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]>
-
-export function isStreamingPlaylistFile (file: any): file is MVideoFileStreamingPlaylist {
-  return !!file.videoStreamingPlaylistId
-}
-
-export function isWebtorrentFile (file: any): file is MVideoFileVideo {
-  return !!file.videoId
-}
diff --git a/server/typings/models/video/video-import.ts b/server/typings/models/video/video-import.ts
deleted file mode 100644 (file)
index 4e5c2e4..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-import { VideoImportModel } from '@server/models/video/video-import'
-import { PickWith, PickWithOpt } from '@server/typings/utils'
-import { MVideo, MVideoAccountLight, MVideoFormattable, MVideoTag, MVideoThumbnail, MVideoWithFile } from './video'
-import { MUser } from '../user/user'
-
-type Use<K extends keyof VideoImportModel, M> = PickWith<VideoImportModel, K, M>
-
-// ############################################################################
-
-export type MVideoImport = Omit<VideoImportModel, 'User' | 'Video'>
-
-export type MVideoImportVideo =
-  MVideoImport &
-  Use<'Video', MVideo>
-
-// ############################################################################
-
-type VideoAssociation = MVideoTag & MVideoAccountLight & MVideoThumbnail
-
-export type MVideoImportDefault =
-  MVideoImport &
-  Use<'User', MUser> &
-  Use<'Video', VideoAssociation>
-
-export type MVideoImportDefaultFiles =
-  MVideoImport &
-  Use<'User', MUser> &
-  Use<'Video', VideoAssociation & MVideoWithFile>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MVideoImportFormattable =
-  MVideoImport &
-  PickWithOpt<VideoImportModel, 'Video', MVideoFormattable & MVideoTag>
diff --git a/server/typings/models/video/video-playlist-element.ts b/server/typings/models/video/video-playlist-element.ts
deleted file mode 100644 (file)
index f33c765..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element'
-import { PickWith } from '@server/typings/utils'
-import { MVideoFormattable, MVideoThumbnail, MVideoUrl } from './video'
-import { MVideoPlaylistPrivacy } from './video-playlist'
-
-type Use<K extends keyof VideoPlaylistElementModel, M> = PickWith<VideoPlaylistElementModel, K, M>
-
-// ############################################################################
-
-export type MVideoPlaylistElement = Omit<VideoPlaylistElementModel, 'VideoPlaylist' | 'Video'>
-
-// ############################################################################
-
-export type MVideoPlaylistElementId = Pick<MVideoPlaylistElement, 'id'>
-
-export type MVideoPlaylistElementLight = Pick<MVideoPlaylistElement, 'id' | 'videoId' | 'startTimestamp' | 'stopTimestamp'>
-
-// ############################################################################
-
-export type MVideoPlaylistVideoThumbnail =
-  MVideoPlaylistElement &
-  Use<'Video', MVideoThumbnail>
-
-export type MVideoPlaylistElementVideoUrlPlaylistPrivacy =
-  MVideoPlaylistElement &
-  Use<'Video', MVideoUrl> &
-  Use<'VideoPlaylist', MVideoPlaylistPrivacy>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MVideoPlaylistElementFormattable =
-  MVideoPlaylistElement &
-  Use<'Video', MVideoFormattable>
-
-export type MVideoPlaylistElementAP =
-  MVideoPlaylistElement &
-  Use<'Video', MVideoUrl>
diff --git a/server/typings/models/video/video-playlist.ts b/server/typings/models/video/video-playlist.ts
deleted file mode 100644 (file)
index 49c27f4..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-import { VideoPlaylistModel } from '../../../models/video/video-playlist'
-import { PickWith } from '../../utils'
-import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account'
-import { MThumbnail } from './thumbnail'
-import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable, MChannelUrl } from './video-channels'
-import { MVideoPlaylistElementLight } from '@server/typings/models/video/video-playlist-element'
-
-type Use<K extends keyof VideoPlaylistModel, M> = PickWith<VideoPlaylistModel, K, M>
-
-// ############################################################################
-
-export type MVideoPlaylist = Omit<VideoPlaylistModel, 'OwnerAccount' | 'VideoChannel' | 'VideoPlaylistElements' | 'Thumbnail'>
-
-// ############################################################################
-
-export type MVideoPlaylistId = Pick<MVideoPlaylist, 'id'>
-export type MVideoPlaylistPrivacy = Pick<MVideoPlaylist, 'privacy'>
-export type MVideoPlaylistUUID = Pick<MVideoPlaylist, 'uuid'>
-export type MVideoPlaylistVideosLength = MVideoPlaylist & { videosLength?: number }
-
-// ############################################################################
-
-// With elements
-
-export type MVideoPlaylistWithElements =
-  MVideoPlaylist &
-  Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
-
-export type MVideoPlaylistIdWithElements =
-  MVideoPlaylistId &
-  Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
-
-// ############################################################################
-
-// With account
-
-export type MVideoPlaylistOwner =
-  MVideoPlaylist &
-  Use<'OwnerAccount', MAccount>
-
-export type MVideoPlaylistOwnerDefault =
-  MVideoPlaylist &
-  Use<'OwnerAccount', MAccountDefault>
-
-// ############################################################################
-
-// With thumbnail
-
-export type MVideoPlaylistThumbnail =
-  MVideoPlaylist &
-  Use<'Thumbnail', MThumbnail>
-
-export type MVideoPlaylistAccountThumbnail =
-  MVideoPlaylist &
-  Use<'OwnerAccount', MAccountDefault> &
-  Use<'Thumbnail', MThumbnail>
-
-// ############################################################################
-
-// With channel
-
-export type MVideoPlaylistAccountChannelDefault =
-  MVideoPlaylist &
-  Use<'OwnerAccount', MAccountDefault> &
-  Use<'VideoChannel', MChannelDefault>
-
-// ############################################################################
-
-// With all associations
-
-export type MVideoPlaylistFull =
-  MVideoPlaylist &
-  Use<'OwnerAccount', MAccountDefault> &
-  Use<'VideoChannel', MChannelDefault> &
-  Use<'Thumbnail', MThumbnail>
-
-// ############################################################################
-
-// For API
-
-export type MVideoPlaylistAccountChannelSummary =
-  MVideoPlaylist &
-  Use<'OwnerAccount', MAccountSummary> &
-  Use<'VideoChannel', MChannelSummary>
-
-export type MVideoPlaylistFullSummary =
-  MVideoPlaylist &
-  Use<'Thumbnail', MThumbnail> &
-  Use<'OwnerAccount', MAccountSummary> &
-  Use<'VideoChannel', MChannelSummary>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MVideoPlaylistFormattable =
-  MVideoPlaylistVideosLength &
-  Use<'OwnerAccount', MAccountSummaryFormattable> &
-  Use<'VideoChannel', MChannelSummaryFormattable>
-
-export type MVideoPlaylistAP =
-  MVideoPlaylist &
-  Use<'Thumbnail', MThumbnail> &
-  Use<'VideoChannel', MChannelUrl>
diff --git a/server/typings/models/video/video-rate.ts b/server/typings/models/video/video-rate.ts
deleted file mode 100644 (file)
index 64ce496..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-import { AccountVideoRateModel } from '@server/models/account/account-video-rate'
-import { PickWith } from '@server/typings/utils'
-import { MAccountAudience, MAccountUrl } from '../account/account'
-import { MVideo, MVideoFormattable } from './video'
-
-type Use<K extends keyof AccountVideoRateModel, M> = PickWith<AccountVideoRateModel, K, M>
-
-// ############################################################################
-
-export type MAccountVideoRate = Omit<AccountVideoRateModel, 'Video' | 'Account'>
-
-export type MAccountVideoRateAccountUrl =
-  MAccountVideoRate &
-  Use<'Account', MAccountUrl>
-
-export type MAccountVideoRateAccountVideo =
-  MAccountVideoRate &
-  Use<'Account', MAccountAudience> &
-  Use<'Video', MVideo>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MAccountVideoRateFormattable =
-  Pick<MAccountVideoRate, 'type'> &
-  Use<'Video', MVideoFormattable>
diff --git a/server/typings/models/video/video-redundancy.ts b/server/typings/models/video/video-redundancy.ts
deleted file mode 100644 (file)
index 5107aa7..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy'
-import { PickWith, PickWithOpt } from '@server/typings/utils'
-import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'
-import { VideoFileModel } from '@server/models/video/video-file'
-import { MVideoFile, MVideoFileVideo } from './video-file'
-import { MStreamingPlaylistVideo } from './video-streaming-playlist'
-import { MVideoUrl } from './video'
-
-type Use<K extends keyof VideoRedundancyModel, M> = PickWith<VideoRedundancyModel, K, M>
-
-// ############################################################################
-
-export type MVideoRedundancy = Omit<VideoRedundancyModel, 'VideoFile' | 'VideoStreamingPlaylist' | 'Actor'>
-
-export type MVideoRedundancyFileUrl = Pick<MVideoRedundancy, 'fileUrl'>
-
-// ############################################################################
-
-export type MVideoRedundancyFile =
-  MVideoRedundancy &
-  Use<'VideoFile', MVideoFile>
-
-export type MVideoRedundancyFileVideo =
-  MVideoRedundancy &
-  Use<'VideoFile', MVideoFileVideo>
-
-export type MVideoRedundancyStreamingPlaylistVideo =
-  MVideoRedundancy &
-  Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
-
-export type MVideoRedundancyVideo =
-  MVideoRedundancy &
-  Use<'VideoFile', MVideoFileVideo> &
-  Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MVideoRedundancyAP =
-  MVideoRedundancy &
-  PickWithOpt<VideoRedundancyModel, 'VideoFile', MVideoFile & PickWith<VideoFileModel, 'Video', MVideoUrl>> &
-  PickWithOpt<VideoRedundancyModel, 'VideoStreamingPlaylist', PickWith<VideoStreamingPlaylistModel, 'Video', MVideoUrl>>
diff --git a/server/typings/models/video/video-share.ts b/server/typings/models/video/video-share.ts
deleted file mode 100644 (file)
index 50ca75d..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-import { VideoShareModel } from '../../../models/video/video-share'
-import { PickWith } from '../../utils'
-import { MActorDefault } from '../account'
-import { MVideo } from './video'
-
-type Use<K extends keyof VideoShareModel, M> = PickWith<VideoShareModel, K, M>
-
-// ############################################################################
-
-export type MVideoShare = Omit<VideoShareModel, 'Actor' | 'Video'>
-
-export type MVideoShareActor =
-  MVideoShare &
-  Use<'Actor', MActorDefault>
-
-export type MVideoShareFull =
-  MVideoShare &
-  Use<'Actor', MActorDefault> &
-  Use<'Video', MVideo>
diff --git a/server/typings/models/video/video-streaming-playlist.ts b/server/typings/models/video/video-streaming-playlist.ts
deleted file mode 100644 (file)
index 3f54aa5..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist'
-import { PickWith, PickWithOpt } from '../../utils'
-import { MVideoRedundancyFileUrl, MVideoRedundancy } from './video-redundancy'
-import { MVideo } from './video'
-import { MVideoFile } from './video-file'
-
-type Use<K extends keyof VideoStreamingPlaylistModel, M> = PickWith<VideoStreamingPlaylistModel, K, M>
-
-// ############################################################################
-
-export type MStreamingPlaylist = Omit<VideoStreamingPlaylistModel, 'Video' | 'RedundancyVideos' | 'VideoFiles'>
-
-export type MStreamingPlaylistFiles =
-  MStreamingPlaylist &
-  Use<'VideoFiles', MVideoFile[]>
-
-export type MStreamingPlaylistVideo =
-  MStreamingPlaylist &
-  Use<'Video', MVideo>
-
-export type MStreamingPlaylistFilesVideo =
-  MStreamingPlaylist &
-  Use<'VideoFiles', MVideoFile[]> &
-  Use<'Video', MVideo>
-
-export type MStreamingPlaylistRedundanciesAll =
-  MStreamingPlaylist &
-  Use<'VideoFiles', MVideoFile[]> &
-  Use<'RedundancyVideos', MVideoRedundancy[]>
-
-export type MStreamingPlaylistRedundancies =
-  MStreamingPlaylist &
-  Use<'VideoFiles', MVideoFile[]> &
-  Use<'RedundancyVideos', MVideoRedundancyFileUrl[]>
-
-export type MStreamingPlaylistRedundanciesOpt =
-  MStreamingPlaylist &
-  Use<'VideoFiles', MVideoFile[]> &
-  PickWithOpt<VideoStreamingPlaylistModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]>
-
-export function isStreamingPlaylist (value: MVideo | MStreamingPlaylistVideo): value is MStreamingPlaylistVideo {
-  return !!(value as MStreamingPlaylist).playlistUrl
-}
diff --git a/server/typings/models/video/video.ts b/server/typings/models/video/video.ts
deleted file mode 100644 (file)
index 022a956..0000000
+++ /dev/null
@@ -1,211 +0,0 @@
-import { VideoModel } from '../../../models/video/video'
-import { PickWith, PickWithOpt } from '../../utils'
-import {
-  MChannelAccountDefault,
-  MChannelAccountLight,
-  MChannelAccountSummaryFormattable,
-  MChannelActor,
-  MChannelFormattable,
-  MChannelUserId
-} from './video-channels'
-import { MTag } from './tag'
-import { MVideoCaptionLanguage, MVideoCaptionLanguageUrl } from './video-caption'
-import {
-  MStreamingPlaylistFiles,
-  MStreamingPlaylistRedundancies,
-  MStreamingPlaylistRedundanciesAll,
-  MStreamingPlaylistRedundanciesOpt
-} from './video-streaming-playlist'
-import { MVideoFile, MVideoFileRedundanciesAll, MVideoFileRedundanciesOpt } from './video-file'
-import { MThumbnail } from './thumbnail'
-import { MVideoBlacklist, MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist'
-import { MScheduleVideoUpdate } from './schedule-video-update'
-import { MUserVideoHistoryTime } from '../user/user-video-history'
-
-type Use<K extends keyof VideoModel, M> = PickWith<VideoModel, K, M>
-
-// ############################################################################
-
-export type MVideo =
-  Omit<VideoModel, 'VideoChannel' | 'Tags' | 'Thumbnails' | 'VideoPlaylistElements' | 'VideoAbuses' |
-  'VideoFiles' | 'VideoStreamingPlaylists' | 'VideoShares' | 'AccountVideoRates' | 'VideoComments' | 'VideoViews' | 'UserVideoHistories' |
-  'ScheduleVideoUpdate' | 'VideoBlacklist' | 'VideoImport' | 'VideoCaptions'>
-
-// ############################################################################
-
-export type MVideoId = Pick<MVideo, 'id'>
-export type MVideoUrl = Pick<MVideo, 'url'>
-export type MVideoUUID = Pick<MVideo, 'uuid'>
-
-export type MVideoImmutable = Pick<MVideo, 'id' | 'url' | 'uuid' | 'remote' | 'isOwned'>
-export type MVideoIdUrl = MVideoId & MVideoUrl
-export type MVideoFeed = Pick<MVideo, 'name' | 'uuid'>
-
-// ############################################################################
-
-// Video raw associations: schedules, video files, tags, thumbnails, captions, streaming playlists
-
-// "With" to not confuse with the VideoFile model
-export type MVideoWithFile =
-  MVideo &
-  Use<'VideoFiles', MVideoFile[]> &
-  Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>
-
-export type MVideoThumbnail =
-  MVideo &
-  Use<'Thumbnails', MThumbnail[]>
-
-export type MVideoIdThumbnail =
-  MVideoId &
-  Use<'Thumbnails', MThumbnail[]>
-
-export type MVideoWithFileThumbnail =
-  MVideo &
-  Use<'VideoFiles', MVideoFile[]> &
-  Use<'Thumbnails', MThumbnail[]>
-
-export type MVideoThumbnailBlacklist =
-  MVideo &
-  Use<'Thumbnails', MThumbnail[]> &
-  Use<'VideoBlacklist', MVideoBlacklistLight>
-
-export type MVideoTag =
-  MVideo &
-  Use<'Tags', MTag[]>
-
-export type MVideoWithSchedule =
-  MVideo &
-  PickWithOpt<VideoModel, 'ScheduleVideoUpdate', MScheduleVideoUpdate>
-
-export type MVideoWithCaptions =
-  MVideo &
-  Use<'VideoCaptions', MVideoCaptionLanguage[]>
-
-export type MVideoWithStreamingPlaylist =
-  MVideo &
-  Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>
-
-// ############################################################################
-
-// Associations with not all their attributes
-
-export type MVideoUserHistory =
-  MVideo &
-  Use<'UserVideoHistories', MUserVideoHistoryTime[]>
-
-export type MVideoWithBlacklistLight =
-  MVideo &
-  Use<'VideoBlacklist', MVideoBlacklistLight>
-
-export type MVideoAccountLight =
-  MVideo &
-  Use<'VideoChannel', MChannelAccountLight>
-
-export type MVideoWithRights =
-  MVideo &
-  Use<'VideoBlacklist', MVideoBlacklistLight> &
-  Use<'Thumbnails', MThumbnail[]> &
-  Use<'VideoChannel', MChannelUserId>
-
-// ############################################################################
-
-// All files with some additional associations
-
-export type MVideoWithAllFiles =
-  MVideo &
-  Use<'VideoFiles', MVideoFile[]> &
-  Use<'Thumbnails', MThumbnail[]> &
-  Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>
-
-export type MVideoAccountLightBlacklistAllFiles =
-  MVideo &
-  Use<'VideoFiles', MVideoFile[]> &
-  Use<'Thumbnails', MThumbnail[]> &
-  Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> &
-  Use<'VideoChannel', MChannelAccountLight> &
-  Use<'VideoBlacklist', MVideoBlacklistLight>
-
-// ############################################################################
-
-// With account
-
-export type MVideoAccountDefault =
-  MVideo &
-  Use<'VideoChannel', MChannelAccountDefault>
-
-export type MVideoThumbnailAccountDefault =
-  MVideo &
-  Use<'Thumbnails', MThumbnail[]> &
-  Use<'VideoChannel', MChannelAccountDefault>
-
-export type MVideoWithChannelActor =
-  MVideo &
-  Use<'VideoChannel', MChannelActor>
-
-export type MVideoFullLight =
-  MVideo &
-  Use<'Thumbnails', MThumbnail[]> &
-  Use<'VideoBlacklist', MVideoBlacklistLight> &
-  Use<'Tags', MTag[]> &
-  Use<'VideoChannel', MChannelAccountLight> &
-  Use<'UserVideoHistories', MUserVideoHistoryTime[]> &
-  Use<'VideoFiles', MVideoFile[]> &
-  Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
-  Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>
-
-// ############################################################################
-
-// API
-
-export type MVideoAP =
-  MVideo &
-  Use<'Tags', MTag[]> &
-  Use<'VideoChannel', MChannelAccountLight> &
-  Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> &
-  Use<'VideoCaptions', MVideoCaptionLanguageUrl[]> &
-  Use<'VideoBlacklist', MVideoBlacklistUnfederated> &
-  Use<'VideoFiles', MVideoFileRedundanciesOpt[]> &
-  Use<'Thumbnails', MThumbnail[]>
-
-export type MVideoAPWithoutCaption = Omit<MVideoAP, 'VideoCaptions'>
-
-export type MVideoDetails =
-  MVideo &
-  Use<'VideoBlacklist', MVideoBlacklistLight> &
-  Use<'Tags', MTag[]> &
-  Use<'VideoChannel', MChannelAccountLight> &
-  Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
-  Use<'Thumbnails', MThumbnail[]> &
-  Use<'UserVideoHistories', MUserVideoHistoryTime[]> &
-  Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundancies[]> &
-  Use<'VideoFiles', MVideoFileRedundanciesOpt[]>
-
-export type MVideoForUser =
-  MVideo &
-  Use<'VideoChannel', MChannelAccountDefault> &
-  Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
-  Use<'VideoBlacklist', MVideoBlacklistLight> &
-  Use<'Thumbnails', MThumbnail[]>
-
-export type MVideoForRedundancyAPI =
-  MVideo &
-  Use<'VideoFiles', MVideoFileRedundanciesAll[]> &
-  Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesAll[]>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MVideoFormattable =
-  MVideo &
-  PickWithOpt<VideoModel, 'UserVideoHistories', MUserVideoHistoryTime[]> &
-  Use<'VideoChannel', MChannelAccountSummaryFormattable> &
-  PickWithOpt<VideoModel, 'ScheduleVideoUpdate', Pick<MScheduleVideoUpdate, 'updateAt' | 'privacy'>> &
-  PickWithOpt<VideoModel, 'VideoBlacklist', Pick<MVideoBlacklist, 'reason'>>
-
-export type MVideoFormattableDetails =
-  MVideoFormattable &
-  Use<'VideoChannel', MChannelFormattable> &
-  Use<'Tags', MTag[]> &
-  Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesOpt[]> &
-  Use<'VideoFiles', MVideoFileRedundanciesOpt[]>
index 8f1d66007df44e46aaef41332e03d07a3ca8e358..b4594c6cd1139f02a711547fc5dac6b836179ce4 100644 (file)
@@ -17,7 +17,7 @@ import { PluginVideoLanguageManager } from '../../../shared/models/plugins/plugi
 import { PluginVideoLicenceManager } from '../../../shared/models/plugins/plugin-video-licence-manager.model'
 import { RegisterServerHookOptions } from '../../../shared/models/plugins/register-server-hook.model'
 import { RegisterServerSettingOptions } from '../../../shared/models/plugins/register-server-setting.model'
-import { MVideoThumbnail } from '../models'
+import { MVideoThumbnail } from '../../types/models'
 
 export type PeerTubeHelpers = {
   logger: Logger
diff --git a/server/typings/sequelize.ts b/server/typings/sequelize.ts
deleted file mode 100644 (file)
index 9cd8361..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-import { Model } from 'sequelize-typescript'
-
-// Thanks to sequelize-typescript: https://github.com/RobinBuschmann/sequelize-typescript
-
-export type Diff<T extends string | symbol | number, U extends string | symbol | number> =
-  ({ [P in T]: P } & { [P in U]: never } & { [ x: string ]: never })[T]
-
-export type Omit<T, K extends keyof T> = { [P in Diff<keyof T, K>]: T[P] }
-
-export type RecursivePartial<T> = { [P in keyof T]?: RecursivePartial<T[P]> }
-
-export type FilteredModelAttributes<T extends Model<T>> = RecursivePartial<Omit<T, keyof Model<any>>> & {
-  id?: number | any
-  createdAt?: Date | any
-  updatedAt?: Date | any
-  deletedAt?: Date | any
-  version?: number | any
-}
diff --git a/server/typings/utils.ts b/server/typings/utils.ts
deleted file mode 100644 (file)
index 55500d8..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/* eslint-disable @typescript-eslint/array-type */
-
-export type FunctionPropertyNames<T> = {
-  [K in keyof T]: T[K] extends Function ? K : never
-}[keyof T]
-
-export type FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>>
-
-export type PickWith<T, KT extends keyof T, V> = {
-  [P in KT]: T[P] extends V ? V : never
-}
-
-export type PickWithOpt<T, KT extends keyof T, V> = {
-  [P in KT]?: T[P] extends V ? V : never
-}
-
-// https://github.com/krzkaczor/ts-essentials Rocks!
-export type DeepPartial<T> = {
-  [P in keyof T]?: T[P] extends Array<infer U>
-    ? Array<DeepPartial<U>>
-    : T[P] extends ReadonlyArray<infer U>
-      ? ReadonlyArray<DeepPartial<U>>
-      : DeepPartial<T[P]>
-}
index eb06a151606fcfd048e9384abae0b9629a2c5373..2b04a03969d19f83bcc33e10deb735651d0b2ab5 100644 (file)
@@ -1,6 +1,6 @@
 import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../requests/requests'
 import { CustomConfig } from '../../models/server/custom-config.model'
-import { DeepPartial } from '@server/typings/utils'
+import { DeepPartial } from '@server/types/utils'
 import { merge } from 'lodash'
 
 function getConfig (url: string) {
index 4ffce94569d7cd88351c007a6bdadae4d9cb6fdb..fc6f0f258b9dbd25f781946ef9a035ffda7c111b 100644 (file)
@@ -1,5 +1,5 @@
 import { UserRole } from '@shared/models'
-import { MOAuthToken, MUser } from '@server/typings/models'
+import { MOAuthToken, MUser } from '@server/types/models'
 import * as express from 'express'
 
 export type RegisterServerAuthOptions = RegisterServerAuthPassOptions | RegisterServerAuthExternalOptions
index da09d0d8591d0cc61cc25e5081cfd6dd48f4a1a4..d305722c465456b57b7143ef56845b0f8b8b46a4 100644 (file)
@@ -19,7 +19,8 @@
     ],
     "typeRoots": [
       "node_modules/sitemap/node_modules/@types",
-      "node_modules/@types"
+      "node_modules/@types",
+      "server/typings"
     ],
     "baseUrl": "./",
     "paths": {