ActivityPub-federated video streaming platform using P2P directly in your web browser
Better thumbnail error handling
Chocobozzz13bceb5f404d
diff --git a/client/src/app/+videos-publish-manage/+video-publish/upload/video-upload.component.ts b/client/src/app/+videos-publish-manage/+video-publish/upload/video-upload.component.tsindex 3944613de0..ba2483e056 100644--- a/client/src/app/+videos-publish-manage/+video-publish/upload/video-upload.component.ts+++ b/client/src/app/+videos-publish-manage/+video-publish/upload/video-upload.component.ts@@ -1,11 +1,11 @@-import { NgIf } from '@angular/common'+import { CommonModule } from '@angular/common'import { AfterViewInit, Component, ElementRef, OnDestroy, OnInit, inject, input, output, viewChild } from '@angular/core'import { FormsModule, ReactiveFormsModule } from '@angular/forms'-import { ActivatedRoute, Router } from '@angular/router'+import { ActivatedRoute } from '@angular/router'import { VideoEdit } from '@app/+videos-publish-manage/shared-manage/common/video-edit.model'import { VideoUploadService } from '@app/+videos-publish-manage/shared-manage/common/video-upload.service'import { VideoManageController } from '@app/+videos-publish-manage/shared-manage/video-manage-controller.service'-import { CanComponentDeactivate, CanDeactivateGuard, HooksService, MetaService, Notifier, ServerService } from '@app/core'+import { CanComponentDeactivate, HooksService, MetaService, Notifier, ServerService } from '@app/core'import { NgbTooltip } from '@ng-bootstrap/ng-bootstrap'import { UserVideoQuota, VideoPrivacyType } from '@peertube/peertube-models'import debug from 'debug'@@ -29,7 +29,7 @@ const debugLogger = debug('peertube:video-publish')'./video-upload.component.scss'],imports: [- NgIf,+ CommonModule,DragDropDirective,GlobalIconComponent,NgbTooltip,@@ -49,8 +49,6 @@ export class VideoUploadComponent implements OnInit, OnDestroy, AfterViewInit, Cprivate route = inject(ActivatedRoute)private videoUploadService = inject(VideoUploadService)private manageController = inject(VideoManageController)- private router = inject(Router)- private canDeactivateGuard = inject(CanDeactivateGuard)readonly userChannels = input.required<SelectChannelItem[]>()readonly userQuota = input.required<UserVideoQuota>()@@ -167,6 +165,7 @@ export class VideoUploadComponent implements OnInit, OnDestroy, AfterViewInit, Cthis.firstStep = truethis.videoEdit = undefinedthis.uploadingAudioFile = false+ this.audioPreviewFile = undefined}uploadAudio () {diff --git a/client/src/app/helpers/utils/upload.ts b/client/src/app/helpers/utils/upload.tsindex d1c364a1e3..e08506b67e 100644--- a/client/src/app/helpers/utils/upload.ts+++ b/client/src/app/helpers/utils/upload.ts@@ -29,7 +29,11 @@ export function getUploadXRetryConfig () {}export function buildHTTPErrorResponse (state: UploadState): HttpErrorResponse {- const error = state.response?.error?.message || state.response?.error || 'Unknown error'+ const response = state.response++ console.log(response)++ const error = response?.detail || $localize`Unknown error`return {error: new Error(error),diff --git a/packages/models/src/common/index.ts b/packages/models/src/common/index.tsindex 846164d8f4..1df194458a 100644--- a/packages/models/src/common/index.ts+++ b/packages/models/src/common/index.ts@@ -1,3 +1,4 @@export * from './file-storage.enum.js'+export * from './peertube-error.model.js'export * from './result-list.model.js'export * from './simple-logger.model.js'diff --git a/packages/models/src/common/peertube-error.model.ts b/packages/models/src/common/peertube-error.model.tsnew file mode 100644index 0000000000..2e5869aa8b--- /dev/null+++ b/packages/models/src/common/peertube-error.model.ts@@ -0,0 +1,26 @@+import { OAuth2ErrorCodeType, ServerErrorCodeType } from '../server/server-error-code.enum.js'++export type InternalErrorCodeType = 'INVALID_IMAGE_FILE'++type ErrorCode = ServerErrorCodeType | OAuth2ErrorCodeType | InternalErrorCodeType++export class PeerTubeError extends Error {+ code: ErrorCode+ isPeerTubeError = true++ constructor (message: string, code: ErrorCode, cause?: Error) {+ super(message, { cause })++ this.code = code+ }++ static fromError (error: Error, code: ErrorCode) {+ return new PeerTubeError(error.message, code, error)+ }+}++export function isPeerTubeError (error: any): error is PeerTubeError {+ if (!error) return false++ return error instanceof PeerTubeError || error.isPeerTubeError === true+}diff --git a/server/core/controllers/api/videos/import.ts b/server/core/controllers/api/videos/import.tsindex 69dc368bde..9d3e02197a 100644--- a/server/core/controllers/api/videos/import.ts+++ b/server/core/controllers/api/videos/import.ts@@ -1,19 +1,20 @@-import express from 'express'-import { move } from 'fs-extra/esm'-import { readFile } from 'fs/promises'-import { decode } from 'magnet-uri'-import parseTorrent, { Instance } from 'parse-torrent'-import { join } from 'path'-import { buildVideoFromImport, buildYoutubeDLImport, insertFromImportIntoDB, YoutubeDlImportError } from '@server/lib/video-pre-import.js'-import { MThumbnail, MVideoThumbnail } from '@server/types/models/index.js'import {HttpStatusCode,+ HttpStatusCodeType,ServerErrorCode,ThumbnailType,VideoImportCreate,VideoImportPayload,VideoImportState} from '@peertube/peertube-models'+import { buildVideoFromImport, buildYoutubeDLImport, insertFromImportIntoDB, YoutubeDlImportError } from '@server/lib/video-pre-import.js'+import { MThumbnail, MVideoThumbnail } from '@server/types/models/index.js'+import express from 'express'+import { move } from 'fs-extra/esm'+import { readFile } from 'fs/promises'+import { decode } from 'magnet-uri'+import parseTorrent, { Instance } from 'parse-torrent'+import { join } from 'path'import { auditLoggerFactory, getAuditIdFromRes, VideoImportAuditView } from '../../../helpers/audit-logger.js'import { isArray } from '../../../helpers/custom-validators/misc.js'import { cleanUpReqFiles, createReqFiles } from '../../../helpers/express-utils.js'@@ -40,20 +41,23 @@ const reqVideoFileImport = createReqFiles({ ...MIMETYPES.TORRENT.MIMETYPE_EXT, ...MIMETYPES.IMAGE.MIMETYPE_EXT })-videoImportsRouter.post('/imports',+videoImportsRouter.post(+ '/imports',authenticate,reqVideoFileImport,asyncMiddleware(videoImportAddValidator),asyncRetryTransactionMiddleware(handleVideoImport))-videoImportsRouter.post('/imports/:id/cancel',+videoImportsRouter.post(+ '/imports/:id/cancel',authenticate,asyncMiddleware(videoImportCancelValidator),asyncRetryTransactionMiddleware(cancelVideoImport))-videoImportsRouter.delete('/imports/:id',+videoImportsRouter.delete(+ '/imports/:id',authenticate,asyncMiddleware(videoImportDeleteValidator),asyncRetryTransactionMiddleware(deleteVideoImport)@@ -152,7 +156,7 @@ async function handleTorrentImport (req: express.Request, res: express.Response,return res.json(videoImport.toFormattedJSON()).end()}-function statusFromYtDlImportError (err: YoutubeDlImportError): number {+function statusFromYtDlImportError (err: YoutubeDlImportError): HttpStatusCodeType {switch (err.code) {case YoutubeDlImportError.CODE.NOT_ONLY_UNICAST_URL:return HttpStatusCode.FORBIDDEN_403diff --git a/server/core/controllers/api/videos/upload.ts b/server/core/controllers/api/videos/upload.tsindex 042415d315..f9da69ab42 100644--- a/server/core/controllers/api/videos/upload.ts+++ b/server/core/controllers/api/videos/upload.ts@@ -1,5 +1,5 @@import { ffprobePromise, getChaptersFromContainer } from '@peertube/peertube-ffmpeg'-import { ThumbnailType, VideoCreate } from '@peertube/peertube-models'+import { isPeerTubeError, ThumbnailType, VideoCreate } from '@peertube/peertube-models'import { uuidToShort } from '@peertube/peertube-node-utils'import { getResumableUploadPath } from '@server/helpers/upload.js'import { LocalVideoCreator } from '@server/lib/local-video-creator.js'@@ -38,7 +38,8 @@ const reqVideoFileAddResumable = createReqFiles(getResumableUploadPath())-uploadRouter.post('/upload',+uploadRouter.post(+ '/upload',openapiOperationDoc({ operationId: 'uploadLegacy' }),authenticate,setReqTimeout(1000 * 60 * 10), // Uploading the video could be long@@ -90,11 +91,14 @@ async function addVideoResumable (req: express.Request, res: express.Response) {const videoInfo = videoPhysicalFile.metadataconst files = { previewfile: videoInfo.previewfile, thumbnailfile: videoInfo.thumbnailfile }- const response = await addVideo({ req, res, videoPhysicalFile, videoInfo, files })- await Redis.Instance.deleteUploadSession(req.query.upload_id)- await uploadx.storage.delete(res.locals.uploadVideoFileResumable)+ try {+ const response = await addVideo({ req, res, videoPhysicalFile, videoInfo, files })- return res.json(response)+ return res.json(response)+ } finally {+ await Redis.Instance.deleteUploadSession(req.query.upload_id)+ await uploadx.storage.delete(res.locals.uploadVideoFileResumable)+ }}async function addVideo (options: {@@ -157,19 +161,31 @@ async function addVideo (options: {thumbnails})- const { video } = await localVideoCreator.create()+ try {+ const { video } = await localVideoCreator.create()- auditLogger.create(getAuditIdFromRes(res), new VideoAuditView(video.toFormattedDetailsJSON()))- logger.info('Video with name %s and uuid %s created.', videoInfo.name, video.uuid, lTags(video.uuid))+ auditLogger.create(getAuditIdFromRes(res), new VideoAuditView(video.toFormattedDetailsJSON()))+ logger.info('Video with name %s and uuid %s created.', videoInfo.name, video.uuid, lTags(video.uuid))- Hooks.runAction('action:api.video.uploaded', { video, req, res })+ Hooks.runAction('action:api.video.uploaded', { video, req, res })- return {- video: {- id: video.id,- shortUUID: uuidToShort(video.uuid),- uuid: video.uuid+ return {+ video: {+ id: video.id,+ shortUUID: uuidToShort(video.uuid),+ uuid: video.uuid+ }}+ } catch (err) {+ if (isPeerTubeError(err) && err.code === 'INVALID_IMAGE_FILE') {+ logger.warn('Invalid thumbnail file provided for video upload.', { err, ...lTags() })++ return res.fail({+ message: req.t('The provided thumbnail file is invalid.')+ })+ }++ throw err}}diff --git a/server/core/lib/local-video-creator.ts b/server/core/lib/local-video-creator.tsindex a61a6e2df8..dd079e48f6 100644--- a/server/core/lib/local-video-creator.ts+++ b/server/core/lib/local-video-creator.ts@@ -3,6 +3,7 @@ import {LiveVideoCreate,LiveVideoLatencyMode,NSFWFlag,+ PeerTubeError,ThumbnailType,ThumbnailType_Type,VideoCreate,@@ -258,6 +259,9 @@ export class LocalVideoCreator {type,automaticallyGenerated: thumbnail.automaticallyGenerated || false,keepOriginal: thumbnail.keepOriginal+ }).catch(err => {+ // eslint-disable-next-line @typescript-eslint/only-throw-error+ throw PeerTubeError.fromError(err, 'INVALID_IMAGE_FILE')}))diff --git a/server/core/models/abuse/abuse-message.ts b/server/core/models/abuse/abuse-message.tsindex 09e82094a9..fdddd9b155 100644--- a/server/core/models/abuse/abuse-message.ts+++ b/server/core/models/abuse/abuse-message.ts@@ -19,25 +19,24 @@ import { AbuseModel } from './abuse.js']})export class AbuseMessageModel extends SequelizeModel<AbuseMessageModel> {-@AllowNull(false)@Is('AbuseMessage', value => throwIfNotValid(value, isAbuseMessageValid, 'message'))@Column(DataType.TEXT)- message: string+ declare message: string@AllowNull(false)@Column- byModerator: boolean+ declare byModerator: boolean@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => AccountModel)@Column- accountId: number+ declare accountId: number@BelongsTo(() => AccountModel, {foreignKey: {@@ -46,11 +45,11 @@ export class AbuseMessageModel extends SequelizeModel<AbuseMessageModel> {},onDelete: 'set null'})- Account: Awaited<AccountModel>+ declare Account: Awaited<AccountModel>@ForeignKey(() => AbuseModel)@Column- abuseId: number+ declare abuseId: number@BelongsTo(() => AbuseModel, {foreignKey: {@@ -59,7 +58,7 @@ export class AbuseMessageModel extends SequelizeModel<AbuseMessageModel> {},onDelete: 'cascade'})- Abuse: Awaited<AbuseModel>+ declare Abuse: Awaited<AbuseModel>static listForApi (abuseId: number) {const getQuery = (forCount: boolean) => {diff --git a/server/core/models/abuse/abuse.ts b/server/core/models/abuse/abuse.tsindex 44cb80f35e..5a3802ee86 100644--- a/server/core/models/abuse/abuse.ts+++ b/server/core/models/abuse/abuse.ts@@ -200,38 +200,38 @@ export class AbuseModel extends SequelizeModel<AbuseModel> {@Default(null)@Is('AbuseReason', value => throwIfNotValid(value, isAbuseReasonValid, 'reason'))@Column(DataType.STRING(CONSTRAINTS_FIELDS.ABUSES.REASON.max))- reason: string+ declare reason: string@AllowNull(false)@Default(null)@Is('AbuseState', value => throwIfNotValid(value, isAbuseStateValid, 'state'))@Column- state: AbuseStateType+ declare state: AbuseStateType@AllowNull(true)@Default(null)@Is('AbuseModerationComment', value => throwIfNotValid(value, isAbuseModerationCommentValid, 'moderationComment', true))@Column(DataType.STRING(CONSTRAINTS_FIELDS.ABUSES.MODERATION_COMMENT.max))- moderationComment: string+ declare moderationComment: string@AllowNull(true)@Default(null)@Column(DataType.ARRAY(DataType.INTEGER))- predefinedReasons: AbusePredefinedReasonsType[]+ declare predefinedReasons: AbusePredefinedReasonsType[]@AllowNull(true)@Column- processedAt: Date+ declare processedAt: Date@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => AccountModel)@Column- reporterAccountId: number+ declare reporterAccountId: number@BelongsTo(() => AccountModel, {foreignKey: {@@ -241,11 +241,11 @@ export class AbuseModel extends SequelizeModel<AbuseModel> {as: 'ReporterAccount',onDelete: 'set null'})- ReporterAccount: Awaited<AccountModel>+ declare ReporterAccount: Awaited<AccountModel>@ForeignKey(() => AccountModel)@Column- flaggedAccountId: number+ declare flaggedAccountId: number@BelongsTo(() => AccountModel, {foreignKey: {@@ -255,7 +255,7 @@ export class AbuseModel extends SequelizeModel<AbuseModel> {as: 'FlaggedAccount',onDelete: 'set null'})- FlaggedAccount: Awaited<AccountModel>+ declare FlaggedAccount: Awaited<AccountModel>@HasOne(() => VideoCommentAbuseModel, {foreignKey: {@@ -264,7 +264,7 @@ export class AbuseModel extends SequelizeModel<AbuseModel> {},onDelete: 'cascade'})- VideoCommentAbuse: Awaited<VideoCommentAbuseModel>+ declare VideoCommentAbuse: Awaited<VideoCommentAbuseModel>@HasOne(() => VideoAbuseModel, {foreignKey: {@@ -273,7 +273,7 @@ export class AbuseModel extends SequelizeModel<AbuseModel> {},onDelete: 'cascade'})- VideoAbuse: Awaited<VideoAbuseModel>+ declare VideoAbuse: Awaited<VideoAbuseModel>static loadByIdWithReporter (id: number): Promise<MAbuseReporter> {const query = {diff --git a/server/core/models/abuse/video-abuse.ts b/server/core/models/abuse/video-abuse.tsindex 2c681eef7c..774736f952 100644--- a/server/core/models/abuse/video-abuse.ts+++ b/server/core/models/abuse/video-abuse.ts@@ -16,31 +16,30 @@ import { SequelizeModel } from '../shared/index.js']})export class VideoAbuseModel extends SequelizeModel<VideoAbuseModel> {-@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@AllowNull(true)@Default(null)@Column- startAt: number+ declare startAt: number@AllowNull(true)@Default(null)@Column- endAt: number+ declare endAt: number@AllowNull(true)@Default(null)@Column(DataType.JSONB)- deletedVideo: VideoDetails+ declare deletedVideo: VideoDetails@ForeignKey(() => AbuseModel)@Column- abuseId: number+ declare abuseId: number@BelongsTo(() => AbuseModel, {foreignKey: {@@ -48,11 +47,11 @@ export class VideoAbuseModel extends SequelizeModel<VideoAbuseModel> {},onDelete: 'cascade'})- Abuse: Awaited<AbuseModel>+ declare Abuse: Awaited<AbuseModel>@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@BelongsTo(() => VideoModel, {foreignKey: {@@ -60,5 +59,5 @@ export class VideoAbuseModel extends SequelizeModel<VideoAbuseModel> {},onDelete: 'set null'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>}diff --git a/server/core/models/abuse/video-comment-abuse.ts b/server/core/models/abuse/video-comment-abuse.tsindex 8bc143c284..ad482b3254 100644--- a/server/core/models/abuse/video-comment-abuse.ts+++ b/server/core/models/abuse/video-comment-abuse.ts@@ -15,16 +15,15 @@ import { SequelizeModel } from '../shared/index.js']})export class VideoCommentAbuseModel extends SequelizeModel<VideoCommentAbuseModel> {-@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => AbuseModel)@Column- abuseId: number+ declare abuseId: number@BelongsTo(() => AbuseModel, {foreignKey: {@@ -32,11 +31,11 @@ export class VideoCommentAbuseModel extends SequelizeModel<VideoCommentAbuseMode},onDelete: 'cascade'})- Abuse: Awaited<AbuseModel>+ declare Abuse: Awaited<AbuseModel>@ForeignKey(() => VideoCommentModel)@Column- videoCommentId: number+ declare videoCommentId: number@BelongsTo(() => VideoCommentModel, {foreignKey: {@@ -44,5 +43,5 @@ export class VideoCommentAbuseModel extends SequelizeModel<VideoCommentAbuseMode},onDelete: 'set null'})- VideoComment: Awaited<VideoCommentModel>+ declare VideoComment: Awaited<VideoCommentModel>}diff --git a/server/core/models/account/account-blocklist.ts b/server/core/models/account/account-blocklist.tsindex 018c907fd5..88a0e81b4c 100644--- a/server/core/models/account/account-blocklist.ts+++ b/server/core/models/account/account-blocklist.ts@@ -22,16 +22,15 @@ import { WEBSERVER } from '@server/initializers/constants.js']})export class AccountBlocklistModel extends SequelizeModel<AccountBlocklistModel> {-@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => AccountModel)@Column- accountId: number+ declare accountId: number@BelongsTo(() => AccountModel, {foreignKey: {@@ -41,11 +40,11 @@ export class AccountBlocklistModel extends SequelizeModel<AccountBlocklistModel>as: 'ByAccount',onDelete: 'CASCADE'})- ByAccount: Awaited<AccountModel>+ declare ByAccount: Awaited<AccountModel>@ForeignKey(() => AccountModel)@Column- targetAccountId: number+ declare targetAccountId: number@BelongsTo(() => AccountModel, {foreignKey: {@@ -55,7 +54,7 @@ export class AccountBlocklistModel extends SequelizeModel<AccountBlocklistModel>as: 'BlockedAccount',onDelete: 'CASCADE'})- BlockedAccount: Awaited<AccountModel>+ declare BlockedAccount: Awaited<AccountModel>static isAccountMutedByAccounts (accountIds: number[], targetAccountId: number) {const query = {@@ -70,16 +69,16 @@ export class AccountBlocklistModel extends SequelizeModel<AccountBlocklistModel>}return AccountBlocklistModel.unscoped()- .findAll(query)- .then(rows => {- const result: { [accountId: number]: boolean } = {}+ .findAll(query)+ .then(rows => {+ const result: { [accountId: number]: boolean } = {}- for (const accountId of accountIds) {- result[accountId] = !!rows.find(r => r.accountId === accountId)- }+ for (const accountId of accountIds) {+ result[accountId] = !!rows.find(r => r.accountId === accountId)+ }- return result- })+ return result+ })}static loadByAccountAndTarget (accountId: number, targetAccountId: number): Promise<MAccountBlocklist> {@@ -203,10 +202,10 @@ export class AccountBlocklistModel extends SequelizeModel<AccountBlocklistModel>const sanitizedHandles = handlesToNameAndHost(handles)const localHandles = sanitizedHandles.filter(h => !h.host)- .map(h => h.name)+ .map(h => h.name)const remoteHandles = sanitizedHandles.filter(h => !!h.host)- .map(h => ([ h.name, h.host ]))+ .map(h => [ h.name, h.host ])const handlesWhere: string[] = []diff --git a/server/core/models/account/account-video-rate.ts b/server/core/models/account/account-video-rate.tsindex e9f00f9141..9cccd2dcc8 100644--- a/server/core/models/account/account-video-rate.ts+++ b/server/core/models/account/account-video-rate.ts@@ -42,25 +42,24 @@ import { AccountModel } from './account.js']})export class AccountVideoRateModel extends SequelizeModel<AccountVideoRateModel> {-@AllowNull(false)@Column(DataType.ENUM(...Object.values(VIDEO_RATE_TYPES)))- type: VideoRateType+ declare type: VideoRateType@AllowNull(false)@Is('AccountVideoRateUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_RATES.URL.max))- url: string+ declare url: string@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@BelongsTo(() => VideoModel, {foreignKey: {@@ -68,11 +67,11 @@ export class AccountVideoRateModel extends SequelizeModel<AccountVideoRateModel>},onDelete: 'CASCADE'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>@ForeignKey(() => AccountModel)@Column- accountId: number+ declare accountId: number@BelongsTo(() => AccountModel, {foreignKey: {@@ -80,7 +79,7 @@ export class AccountVideoRateModel extends SequelizeModel<AccountVideoRateModel>},onDelete: 'CASCADE'})- Account: Awaited<AccountModel>+ declare Account: Awaited<AccountModel>static load (accountId: number, videoId: number, transaction?: Transaction): Promise<MAccountVideoRate> {const options: FindOptions = {diff --git a/server/core/models/account/account.ts b/server/core/models/account/account.tsindex c2598d57ad..c43f0aa915 100644--- a/server/core/models/account/account.ts+++ b/server/core/models/account/account.ts@@ -151,23 +151,23 @@ export type SummaryOptions = {export class AccountModel extends SequelizeModel<AccountModel> {@AllowNull(false)@Column- name: string+ declare name: string@AllowNull(true)@Default(null)@Is('AccountDescription', value => throwIfNotValid(value, isAccountDescriptionValid, 'description', true))@Column(DataType.STRING(CONSTRAINTS_FIELDS.USERS.DESCRIPTION.max))- description: string+ declare description: string@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => ActorModel)@Column- actorId: number+ declare actorId: number@BelongsTo(() => ActorModel, {foreignKey: {@@ -175,11 +175,11 @@ export class AccountModel extends SequelizeModel<AccountModel> {},onDelete: 'cascade'})- Actor: Awaited<ActorModel>+ declare Actor: Awaited<ActorModel>@ForeignKey(() => UserModel)@Column- userId: number+ declare userId: number@BelongsTo(() => UserModel, {foreignKey: {@@ -187,11 +187,11 @@ export class AccountModel extends SequelizeModel<AccountModel> {},onDelete: 'cascade'})- User: Awaited<UserModel>+ declare User: Awaited<UserModel>@ForeignKey(() => ApplicationModel)@Column- applicationId: number+ declare applicationId: number@BelongsTo(() => ApplicationModel, {foreignKey: {@@ -199,7 +199,7 @@ export class AccountModel extends SequelizeModel<AccountModel> {},onDelete: 'cascade'})- Application: Awaited<ApplicationModel>+ declare Application: Awaited<ApplicationModel>@HasMany(() => VideoChannelModel, {foreignKey: {@@ -208,7 +208,7 @@ export class AccountModel extends SequelizeModel<AccountModel> {onDelete: 'cascade',hooks: true})- VideoChannels: Awaited<VideoChannelModel>[]+ declare VideoChannels: Awaited<VideoChannelModel>[]@HasMany(() => VideoPlaylistModel, {foreignKey: {@@ -217,7 +217,7 @@ export class AccountModel extends SequelizeModel<AccountModel> {onDelete: 'cascade',hooks: true})- VideoPlaylists: Awaited<VideoPlaylistModel>[]+ declare VideoPlaylists: Awaited<VideoPlaylistModel>[]@HasMany(() => VideoCommentModel, {foreignKey: {@@ -226,7 +226,7 @@ export class AccountModel extends SequelizeModel<AccountModel> {onDelete: 'cascade',hooks: true})- VideoComments: Awaited<VideoCommentModel>[]+ declare VideoComments: Awaited<VideoCommentModel>[]@HasMany(() => AccountBlocklistModel, {foreignKey: {@@ -236,7 +236,7 @@ export class AccountModel extends SequelizeModel<AccountModel> {as: 'BlockedBy',onDelete: 'CASCADE'})- BlockedBy: Awaited<AccountBlocklistModel>[]+ declare BlockedBy: Awaited<AccountBlocklistModel>[]@HasMany(() => AccountAutomaticTagPolicyModel, {foreignKey: {@@ -245,19 +245,19 @@ export class AccountModel extends SequelizeModel<AccountModel> {},onDelete: 'cascade'})- AccountAutomaticTagPolicies: Awaited<AccountAutomaticTagPolicyModel>[]+ declare AccountAutomaticTagPolicies: Awaited<AccountAutomaticTagPolicyModel>[]@HasMany(() => CommentAutomaticTagModel, {foreignKey: 'accountId',onDelete: 'CASCADE'})- CommentAutomaticTags: Awaited<CommentAutomaticTagModel>[]+ declare CommentAutomaticTags: Awaited<CommentAutomaticTagModel>[]@HasMany(() => VideoAutomaticTagModel, {foreignKey: 'accountId',onDelete: 'CASCADE'})- VideoAutomaticTags: Awaited<VideoAutomaticTagModel>[]+ declare VideoAutomaticTags: Awaited<VideoAutomaticTagModel>[]@BeforeDestroystatic async sendDeleteIfOwned (instance: AccountModel, options) {diff --git a/server/core/models/account/actor-custom-page.ts b/server/core/models/account/actor-custom-page.tsindex 3c239f270a..78198ca3d5 100644--- a/server/core/models/account/actor-custom-page.ts+++ b/server/core/models/account/actor-custom-page.ts@@ -14,24 +14,23 @@ import { SequelizeModel } from '../shared/index.js']})export class ActorCustomPageModel extends SequelizeModel<ActorCustomPageModel> {-@AllowNull(true)@Column(DataType.TEXT)- content: string+ declare content: string@AllowNull(false)@Column- type: 'homepage'+ declare type: 'homepage'@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => ActorModel)@Column- actorId: number+ declare actorId: number@BelongsTo(() => ActorModel, {foreignKey: {@@ -40,7 +39,7 @@ export class ActorCustomPageModel extends SequelizeModel<ActorCustomPageModel> {},onDelete: 'cascade'})- Actor: Awaited<ActorModel>+ declare Actor: Awaited<ActorModel>static async updateInstanceHomepage (content: string) {const serverActor = await getServerActor()diff --git a/server/core/models/actor/actor-follow.ts b/server/core/models/actor/actor-follow.tsindex 4006151085..6852a0b3a0 100644--- a/server/core/models/actor/actor-follow.ts+++ b/server/core/models/actor/actor-follow.ts@@ -73,30 +73,30 @@ import { InstanceListFollowingQueryBuilder, ListFollowingOptions } from './sql/iexport class ActorFollowModel extends SequelizeModel<ActorFollowModel> {@AllowNull(false)@Column(DataType.ENUM(...Object.values(FOLLOW_STATES)))- state: FollowState+ declare state: FollowState@AllowNull(false)@Default(ACTOR_FOLLOW_SCORE.BASE)@IsInt@Max(ACTOR_FOLLOW_SCORE.MAX)@Column- score: number+ declare score: number// Allow null because we added this column in PeerTube v3, and don't want to generate fake URLs of remote follows@AllowNull(true)@Is('ActorFollowUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))@Column(DataType.STRING(CONSTRAINTS_FIELDS.COMMONS.URL.max))- url: string+ declare url: string@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => ActorModel)@Column- actorId: number+ declare actorId: number@BelongsTo(() => ActorModel, {foreignKey: {@@ -106,11 +106,11 @@ export class ActorFollowModel extends SequelizeModel<ActorFollowModel> {as: 'ActorFollower',onDelete: 'CASCADE'})- ActorFollower: Awaited<ActorModel>+ declare ActorFollower: Awaited<ActorModel>@ForeignKey(() => ActorModel)@Column- targetActorId: number+ declare targetActorId: number@BelongsTo(() => ActorModel, {foreignKey: {@@ -120,7 +120,7 @@ export class ActorFollowModel extends SequelizeModel<ActorFollowModel> {as: 'ActorFollowing',onDelete: 'CASCADE'})- ActorFollowing: Awaited<ActorModel>+ declare ActorFollowing: Awaited<ActorModel>@AfterCreatestatic incrementFollowerAndFollowingCount (instance: ActorFollowModel, options: any) {diff --git a/server/core/models/actor/actor-image.ts b/server/core/models/actor/actor-image.tsindex 7a1272e67a..b54b1ae678 100644--- a/server/core/models/actor/actor-image.ts+++ b/server/core/models/actor/actor-image.ts@@ -27,39 +27,39 @@ import { ActorModel } from './actor.js'export class ActorImageModel extends SequelizeModel<ActorImageModel> {@AllowNull(false)@Column- filename: string+ declare filename: string@AllowNull(true)@Default(null)@Column- height: number+ declare height: number@AllowNull(true)@Default(null)@Column- width: number+ declare width: number@AllowNull(true)@Column- fileUrl: string+ declare fileUrl: string@AllowNull(false)@Column- onDisk: boolean+ declare onDisk: boolean@AllowNull(false)@Column- type: ActorImageType_Type+ declare type: ActorImageType_Type@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => ActorModel)@Column- actorId: number+ declare actorId: number@BelongsTo(() => ActorModel, {foreignKey: {@@ -67,7 +67,7 @@ export class ActorImageModel extends SequelizeModel<ActorImageModel> {},onDelete: 'CASCADE'})- Actor: Awaited<ActorModel> // TODO: Remove awaited: https://github.com/sequelize/sequelize-typescript/issues/825+ declare Actor: Awaited<ActorModel> // TODO: Remove awaited: https://github.com/sequelize/sequelize-typescript/issues/825@AfterDestroystatic removeFile (instance: ActorImageModel) {diff --git a/server/core/models/actor/actor.ts b/server/core/models/actor/actor.tsindex 72cd98c863..371a2c57d8 100644--- a/server/core/models/actor/actor.ts+++ b/server/core/models/actor/actor.ts@@ -158,72 +158,72 @@ export const unusedActorAttributesForAPI: (keyof AttributesOnly<ActorModel>)[] =export class ActorModel extends SequelizeModel<ActorModel> {@AllowNull(false)@Column(DataType.ENUM(...Object.values(ACTIVITY_PUB_ACTOR_TYPES)))- type: ActivityPubActorType+ declare type: ActivityPubActorType@AllowNull(false)@Is('ActorPreferredUsername', value => throwIfNotValid(value, isActorPreferredUsernameValid, 'actor preferred username'))@Column- preferredUsername: string+ declare preferredUsername: string@AllowNull(false)@Is('ActorUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))- url: string+ declare url: string@AllowNull(true)@Is('ActorPublicKey', value => throwIfNotValid(value, isActorPublicKeyValid, 'public key', true))@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.PUBLIC_KEY.max))- publicKey: string+ declare publicKey: string@AllowNull(true)@Is('ActorPublicKey', value => throwIfNotValid(value, isActorPrivateKeyValid, 'private key', true))@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.PRIVATE_KEY.max))- privateKey: string+ declare privateKey: string@AllowNull(false)@Is('ActorFollowersCount', value => throwIfNotValid(value, isActorFollowersCountValid, 'followers count'))@Column- followersCount: number+ declare followersCount: number@AllowNull(false)@Is('ActorFollowersCount', value => throwIfNotValid(value, isActorFollowingCountValid, 'following count'))@Column- followingCount: number+ declare followingCount: number@AllowNull(false)@Is('ActorInboxUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'inbox url'))@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))- inboxUrl: string+ declare inboxUrl: string@AllowNull(true)@Is('ActorOutboxUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'outbox url', true))@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))- outboxUrl: string+ declare outboxUrl: string@AllowNull(true)@Is('ActorSharedInboxUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'shared inbox url', true))@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))- sharedInboxUrl: string+ declare sharedInboxUrl: string@AllowNull(true)@Is('ActorFollowersUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'followers url', true))@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))- followersUrl: string+ declare followersUrl: string@AllowNull(true)@Is('ActorFollowingUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'following url', true))@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))- followingUrl: string+ declare followingUrl: string@AllowNull(true)@Column- remoteCreatedAt: Date+ declare remoteCreatedAt: Date@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@HasMany(() => ActorImageModel, {as: 'Avatars',@@ -236,7 +236,7 @@ export class ActorModel extends SequelizeModel<ActorModel> {type: ActorImageType.AVATAR}})- Avatars: Awaited<ActorImageModel>[]+ declare Avatars: Awaited<ActorImageModel>[]@HasMany(() => ActorImageModel, {as: 'Banners',@@ -249,7 +249,7 @@ export class ActorModel extends SequelizeModel<ActorModel> {type: ActorImageType.BANNER}})- Banners: Awaited<ActorImageModel>[]+ declare Banners: Awaited<ActorImageModel>[]@HasMany(() => UploadImageModel, {as: 'UploadImages',@@ -259,7 +259,7 @@ export class ActorModel extends SequelizeModel<ActorModel> {allowNull: false}})- UploadImages: Awaited<UploadImageModel>[]+ declare UploadImages: Awaited<UploadImageModel>[]@HasMany(() => ActorFollowModel, {foreignKey: {@@ -269,7 +269,7 @@ export class ActorModel extends SequelizeModel<ActorModel> {as: 'ActorFollowings',onDelete: 'cascade'})- ActorFollowing: Awaited<ActorFollowModel>[]+ declare ActorFollowing: Awaited<ActorFollowModel>[]@HasMany(() => ActorFollowModel, {foreignKey: {@@ -279,11 +279,11 @@ export class ActorModel extends SequelizeModel<ActorModel> {as: 'ActorFollowers',onDelete: 'cascade'})- ActorFollowers: Awaited<ActorFollowModel>[]+ declare ActorFollowers: Awaited<ActorFollowModel>[]@ForeignKey(() => ServerModel)@Column- serverId: number+ declare serverId: number@BelongsTo(() => ServerModel, {foreignKey: {@@ -291,7 +291,7 @@ export class ActorModel extends SequelizeModel<ActorModel> {},onDelete: 'cascade'})- Server: Awaited<ServerModel>+ declare Server: Awaited<ServerModel>@HasOne(() => AccountModel, {foreignKey: {@@ -300,7 +300,7 @@ export class ActorModel extends SequelizeModel<ActorModel> {onDelete: 'cascade',hooks: true})- Account: Awaited<AccountModel>+ declare Account: Awaited<AccountModel>@HasOne(() => VideoChannelModel, {foreignKey: {@@ -309,7 +309,7 @@ export class ActorModel extends SequelizeModel<ActorModel> {onDelete: 'cascade',hooks: true})- VideoChannel: Awaited<VideoChannelModel>+ declare VideoChannel: Awaited<VideoChannelModel>// ---------------------------------------------------------------------------diff --git a/server/core/models/application/application.ts b/server/core/models/application/application.tsindex 15ee7b7276..ce2dfb4a24 100644--- a/server/core/models/application/application.ts+++ b/server/core/models/application/application.ts@@ -40,19 +40,19 @@ export class ApplicationModel extends SequelizeModel<ApplicationModel> {@Default(0)@IsInt@Column- migrationVersion: number+ declare migrationVersion: number@AllowNull(true)@Column- latestPeerTubeVersion: string+ declare latestPeerTubeVersion: string@AllowNull(false)@Column- nodeVersion: string+ declare nodeVersion: string@AllowNull(false)@Column- nodeABIVersion: number+ declare nodeABIVersion: number@HasOne(() => AccountModel, {foreignKey: {@@ -60,7 +60,7 @@ export class ApplicationModel extends SequelizeModel<ApplicationModel> {},onDelete: 'cascade'})- Account: Awaited<AccountModel>+ declare Account: Awaited<AccountModel>static countTotal () {return ApplicationModel.count()diff --git a/server/core/models/application/upload-image.ts b/server/core/models/application/upload-image.tsindex 8327bb61ed..9db64fd236 100644--- a/server/core/models/application/upload-image.ts+++ b/server/core/models/application/upload-image.ts@@ -28,35 +28,35 @@ import { SequelizeModel } from '../shared/index.js'export class UploadImageModel extends SequelizeModel<UploadImageModel> {@AllowNull(false)@Column- filename: string+ declare filename: string@AllowNull(true)@Default(null)@Column- height: number+ declare height: number@AllowNull(true)@Default(null)@Column- width: number+ declare width: number@AllowNull(true)@Column- fileUrl: string+ declare fileUrl: string@AllowNull(false)@Column- type: UploadImageType_Type+ declare type: UploadImageType_Type@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => ActorModel)@Column- actorId: number+ declare actorId: number@BelongsTo(() => ActorModel, {foreignKey: {@@ -64,7 +64,7 @@ export class UploadImageModel extends SequelizeModel<UploadImageModel> {},onDelete: 'CASCADE'})- Actor: Awaited<ActorModel>+ declare Actor: Awaited<ActorModel>@AfterDestroystatic removeFile (instance: UploadImageModel) {diff --git a/server/core/models/automatic-tag/account-automatic-tag-policy.ts b/server/core/models/automatic-tag/account-automatic-tag-policy.tsindex 141d0028fc..dcb5b33eef 100644--- a/server/core/models/automatic-tag/account-automatic-tag-policy.ts+++ b/server/core/models/automatic-tag/account-automatic-tag-policy.ts@@ -17,18 +17,18 @@ import { AutomaticTagModel } from './automatic-tag.js'})export class AccountAutomaticTagPolicyModel extends SequelizeModel<AccountAutomaticTagPolicyModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@AllowNull(true)@Column(DataType.INTEGER)- policy: AutomaticTagPolicyType+ declare policy: AutomaticTagPolicyType@ForeignKey(() => AccountModel)@Column- accountId: number+ declare accountId: number@BelongsTo(() => AccountModel, {foreignKey: {@@ -36,11 +36,11 @@ export class AccountAutomaticTagPolicyModel extends SequelizeModel<AccountAutoma},onDelete: 'cascade'})- Account: Awaited<AccountModel>+ declare Account: Awaited<AccountModel>@ForeignKey(() => AutomaticTagModel)@Column- automaticTagId: number+ declare automaticTagId: number@BelongsTo(() => AutomaticTagModel, {foreignKey: {@@ -48,7 +48,7 @@ export class AccountAutomaticTagPolicyModel extends SequelizeModel<AccountAutoma},onDelete: 'cascade'})- AutomaticTag: Awaited<AutomaticTagModel>+ declare AutomaticTag: Awaited<AutomaticTagModel>static async listOfAccount (account: MAccountId) {const rows = await this.findAll({@@ -88,7 +88,7 @@ export class AccountAutomaticTagPolicyModel extends SequelizeModel<AccountAutomaconst query = `SELECT 1 FROM "accountAutomaticTagPolicy" ` +`INNER JOIN "automaticTag" ON "automaticTag"."id" = "accountAutomaticTagPolicy"."automaticTagId" ` +`WHERE "accountId" = $accountId AND "accountAutomaticTagPolicy"."policy" = $policy AND ` +- `"automaticTag"."name" IN (${createSafeIn(this.sequelize, tags)}) ` ++ `"automaticTag"."name" IN (${createSafeIn(this.sequelize, tags)}) ` +`LIMIT 1`return doesExist({ sequelize: this.sequelize, query, bind: { accountId, policy }, transaction })diff --git a/server/core/models/automatic-tag/automatic-tag.ts b/server/core/models/automatic-tag/automatic-tag.tsindex 5f662f8c49..f09952e428 100644--- a/server/core/models/automatic-tag/automatic-tag.ts+++ b/server/core/models/automatic-tag/automatic-tag.ts@@ -21,22 +21,21 @@ import { VideoAutomaticTagModel } from './video-automatic-tag.js']})export class AutomaticTagModel extends SequelizeModel<AutomaticTagModel> {-@AllowNull(false)@Column- name: string+ declare name: string@HasMany(() => CommentAutomaticTagModel, {foreignKey: 'automaticTagId',onDelete: 'CASCADE'})- CommentAutomaticTags: Awaited<CommentAutomaticTagModel>[]+ declare CommentAutomaticTags: Awaited<CommentAutomaticTagModel>[]@HasMany(() => VideoAutomaticTagModel, {foreignKey: 'automaticTagId',onDelete: 'CASCADE'})- VideoAutomaticTags: Awaited<VideoAutomaticTagModel>[]+ declare VideoAutomaticTags: Awaited<VideoAutomaticTagModel>[]@HasMany(() => AccountAutomaticTagPolicyModel, {foreignKey: {@@ -45,7 +44,7 @@ export class AutomaticTagModel extends SequelizeModel<AutomaticTagModel> {},onDelete: 'cascade'})- AccountAutomaticTagPolicies: Awaited<AccountAutomaticTagPolicyModel>[]+ declare AccountAutomaticTagPolicies: Awaited<AccountAutomaticTagPolicyModel>[]static findOrCreateAutomaticTag (options: {tag: stringdiff --git a/server/core/models/automatic-tag/comment-automatic-tag.ts b/server/core/models/automatic-tag/comment-automatic-tag.tsindex 9c673cb11b..da856da944 100644--- a/server/core/models/automatic-tag/comment-automatic-tag.ts+++ b/server/core/models/automatic-tag/comment-automatic-tag.ts@@ -6,10 +6,8 @@ import { AutomaticTagModel } from './automatic-tag.js'import { Transaction } from 'sequelize'/**- ** Sequelize doesn't seem to support many to many relation using BelongsToMany with 3 tables* So we reproduce the behaviour with classic BelongsTo/HasMany relations- **/@Table({@@ -17,25 +15,25 @@ import { Transaction } from 'sequelize'})export class CommentAutomaticTagModel extends SequelizeModel<CommentAutomaticTagModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => VideoCommentModel)@PrimaryKey@Column- commentId: number+ declare commentId: number@ForeignKey(() => AutomaticTagModel)@PrimaryKey@Column- automaticTagId: number+ declare automaticTagId: number@ForeignKey(() => AccountModel)@PrimaryKey@Column- accountId: number+ declare accountId: number@BelongsTo(() => AccountModel, {foreignKey: {@@ -43,7 +41,7 @@ export class CommentAutomaticTagModel extends SequelizeModel<CommentAutomaticTag},onDelete: 'CASCADE'})- Account: Awaited<AccountModel>+ declare Account: Awaited<AccountModel>@BelongsTo(() => AutomaticTagModel, {foreignKey: {@@ -51,7 +49,7 @@ export class CommentAutomaticTagModel extends SequelizeModel<CommentAutomaticTag},onDelete: 'CASCADE'})- AutomaticTag: Awaited<AutomaticTagModel>+ declare AutomaticTag: Awaited<AutomaticTagModel>@BelongsTo(() => VideoCommentModel, {foreignKey: {@@ -59,7 +57,7 @@ export class CommentAutomaticTagModel extends SequelizeModel<CommentAutomaticTag},onDelete: 'CASCADE'})- VideoComment: Awaited<VideoCommentModel>+ declare VideoComment: Awaited<VideoCommentModel>static deleteAllOfAccountAndComment (options: {accountId: numberdiff --git a/server/core/models/automatic-tag/video-automatic-tag.ts b/server/core/models/automatic-tag/video-automatic-tag.tsindex d16d3b229c..7d93754efa 100644--- a/server/core/models/automatic-tag/video-automatic-tag.ts+++ b/server/core/models/automatic-tag/video-automatic-tag.ts@@ -6,10 +6,8 @@ import { VideoModel } from '../video/video.js'import { AutomaticTagModel } from './automatic-tag.js'/**- ** Sequelize doesn't seem to support many to many relation using BelongsToMany with 3 tables* So we reproduce the behaviour with classic BelongsTo/HasMany relations- **/@Table({@@ -17,25 +15,25 @@ import { AutomaticTagModel } from './automatic-tag.js'})export class VideoAutomaticTagModel extends SequelizeModel<VideoAutomaticTagModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => VideoModel)@PrimaryKey@Column- videoId: number+ declare videoId: number@ForeignKey(() => AutomaticTagModel)@PrimaryKey@Column- automaticTagId: number+ declare automaticTagId: number@ForeignKey(() => AccountModel)@PrimaryKey@Column- accountId: number+ declare accountId: number@BelongsTo(() => AccountModel, {foreignKey: {@@ -43,7 +41,7 @@ export class VideoAutomaticTagModel extends SequelizeModel<VideoAutomaticTagMode},onDelete: 'CASCADE'})- Account: Awaited<AccountModel>+ declare Account: Awaited<AccountModel>@BelongsTo(() => AutomaticTagModel, {foreignKey: {@@ -51,7 +49,7 @@ export class VideoAutomaticTagModel extends SequelizeModel<VideoAutomaticTagMode},onDelete: 'CASCADE'})- AutomaticTag: Awaited<AutomaticTagModel>+ declare AutomaticTag: Awaited<AutomaticTagModel>@BelongsTo(() => VideoModel, {foreignKey: {@@ -59,7 +57,7 @@ export class VideoAutomaticTagModel extends SequelizeModel<VideoAutomaticTagMode},onDelete: 'CASCADE'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>static deleteAllOfAccountAndVideo (options: {accountId: numberdiff --git a/server/core/models/oauth/oauth-client.ts b/server/core/models/oauth/oauth-client.tsindex dc022c8917..7a15c9c0da 100644--- a/server/core/models/oauth/oauth-client.ts+++ b/server/core/models/oauth/oauth-client.ts@@ -16,31 +16,30 @@ import { SequelizeModel } from '../shared/index.js']})export class OAuthClientModel extends SequelizeModel<OAuthClientModel> {-@AllowNull(false)@Column- clientId: string+ declare clientId: string@AllowNull(false)@Column- clientSecret: string+ declare clientSecret: string@Column(DataType.ARRAY(DataType.STRING))- grants: string[]+ declare grants: string[]@Column(DataType.ARRAY(DataType.STRING))- redirectUris: string[]+ declare redirectUris: string[]@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@HasMany(() => OAuthTokenModel, {onDelete: 'cascade'})- OAuthTokens: Awaited<OAuthTokenModel>[]+ declare OAuthTokens: Awaited<OAuthTokenModel>[]static countTotal () {return OAuthClientModel.count()diff --git a/server/core/models/oauth/oauth-token.ts b/server/core/models/oauth/oauth-token.tsindex 29772c6141..3743fba53e 100644--- a/server/core/models/oauth/oauth-token.ts+++ b/server/core/models/oauth/oauth-token.ts@@ -6,7 +6,8 @@ import {BelongsTo,Column,CreatedAt,- ForeignKey, Scopes,+ ForeignKey,+ Scopes,Table,UpdatedAt} from 'sequelize-typescript'@@ -79,35 +80,34 @@ enum ScopeNames {]})export class OAuthTokenModel extends SequelizeModel<OAuthTokenModel> {-@AllowNull(false)@Column- accessToken: string+ declare accessToken: string@AllowNull(false)@Column- accessTokenExpiresAt: Date+ declare accessTokenExpiresAt: Date@AllowNull(false)@Column- refreshToken: string+ declare refreshToken: string@AllowNull(false)@Column- refreshTokenExpiresAt: Date+ declare refreshTokenExpiresAt: Date@Column- authName: string+ declare authName: string@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => UserModel)@Column- userId: number+ declare userId: number@BelongsTo(() => UserModel, {foreignKey: {@@ -115,11 +115,11 @@ export class OAuthTokenModel extends SequelizeModel<OAuthTokenModel> {},onDelete: 'cascade'})- User: Awaited<UserModel>+ declare User: Awaited<UserModel>@ForeignKey(() => OAuthClientModel)@Column- oAuthClientId: number+ declare oAuthClientId: number@BelongsTo(() => OAuthClientModel, {foreignKey: {@@ -127,7 +127,7 @@ export class OAuthTokenModel extends SequelizeModel<OAuthTokenModel> {},onDelete: 'cascade'})- OAuthClients: Awaited<OAuthClientModel>[]+ declare OAuthClients: Awaited<OAuthClientModel>[]@AfterUpdate@AfterDestroy@@ -152,25 +152,25 @@ export class OAuthTokenModel extends SequelizeModel<OAuthTokenModel> {}return OAuthTokenModel.scope(ScopeNames.WITH_USER)- .findOne(query)- .then(token => {- if (!token) return null-- return {- refreshToken: token.refreshToken,- refreshTokenExpiresAt: token.refreshTokenExpiresAt,- client: {- id: token.oAuthClientId,- grants: []- },- user: token.User,- token- } as OAuthTokenInfo- })- .catch(err => {- logger.error('getRefreshToken error.', { err })- throw err- })+ .findOne(query)+ .then(token => {+ if (!token) return null++ return {+ refreshToken: token.refreshToken,+ refreshTokenExpiresAt: token.refreshTokenExpiresAt,+ client: {+ id: token.oAuthClientId,+ grants: []+ },+ user: token.User,+ token+ } as OAuthTokenInfo+ })+ .catch(err => {+ logger.error('getRefreshToken error.', { err })+ throw err+ })}static getByTokenAndPopulateUser (bearerToken: string): Promise<MOAuthTokenUser> {@@ -181,12 +181,12 @@ export class OAuthTokenModel extends SequelizeModel<OAuthTokenModel> {}return OAuthTokenModel.scope(ScopeNames.WITH_USER)- .findOne(query)- .then(token => {- if (!token) return null+ .findOne(query)+ .then(token => {+ if (!token) return null- return Object.assign(token, { user: token.User })- })+ return Object.assign(token, { user: token.User })+ })}static getByRefreshTokenAndPopulateUser (refreshToken: string): Promise<MOAuthTokenUser> {diff --git a/server/core/models/redundancy/video-redundancy.ts b/server/core/models/redundancy/video-redundancy.tsindex f0167f0c5f..6c8b0787d4 100644--- a/server/core/models/redundancy/video-redundancy.ts+++ b/server/core/models/redundancy/video-redundancy.ts@@ -78,31 +78,31 @@ export enum ScopeNames {})export class VideoRedundancyModel extends SequelizeModel<VideoRedundancyModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@AllowNull(true)@Column- expiresOn: Date+ declare expiresOn: Date@AllowNull(false)@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS_REDUNDANCY.URL.max))- fileUrl: string+ declare fileUrl: string@AllowNull(false)@Is('VideoRedundancyUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS_REDUNDANCY.URL.max))- url: string+ declare url: string@AllowNull(true)@Column- strategy: string // Only used by us+ declare strategy: string // Only used by us@ForeignKey(() => VideoStreamingPlaylistModel)@Column- videoStreamingPlaylistId: number+ declare videoStreamingPlaylistId: number@BelongsTo(() => VideoStreamingPlaylistModel, {foreignKey: {@@ -110,11 +110,11 @@ export class VideoRedundancyModel extends SequelizeModel<VideoRedundancyModel> {},onDelete: 'cascade'})- VideoStreamingPlaylist: Awaited<VideoStreamingPlaylistModel>+ declare VideoStreamingPlaylist: Awaited<VideoStreamingPlaylistModel>@ForeignKey(() => ActorModel)@Column- actorId: number+ declare actorId: number@BelongsTo(() => ActorModel, {foreignKey: {@@ -122,7 +122,7 @@ export class VideoRedundancyModel extends SequelizeModel<VideoRedundancyModel> {},onDelete: 'cascade'})- Actor: Awaited<ActorModel>+ declare Actor: Awaited<ActorModel>@BeforeDestroystatic async removeFile (instance: VideoRedundancyModel) {diff --git a/server/core/models/runner/runner-job.ts b/server/core/models/runner/runner-job.tsindex 5fc4213127..86a260dbbd 100644--- a/server/core/models/runner/runner-job.ts+++ b/server/core/models/runner/runner-job.ts@@ -19,7 +19,8 @@ import {DataType,Default,ForeignKey,- IsUUID, Scopes,+ IsUUID,+ Scopes,Table,UpdatedAt} from 'sequelize-typescript'@@ -66,68 +67,67 @@ enum ScopeNames {]})export class RunnerJobModel extends SequelizeModel<RunnerJobModel> {-@AllowNull(false)@IsUUID(4)@Column(DataType.UUID)- uuid: string+ declare uuid: string@AllowNull(false)@Column- type: RunnerJobType+ declare type: RunnerJobType@AllowNull(false)@Column(DataType.JSONB)- payload: RunnerJobPayload+ declare payload: RunnerJobPayload@AllowNull(false)@Column(DataType.JSONB)- privatePayload: RunnerJobPrivatePayload+ declare privatePayload: RunnerJobPrivatePayload@AllowNull(false)@Column- state: RunnerJobStateType+ declare state: RunnerJobStateType@AllowNull(false)@Default(0)@Column- failures: number+ declare failures: number@AllowNull(true)@Column(DataType.STRING(CONSTRAINTS_FIELDS.RUNNER_JOBS.ERROR_MESSAGE.max))- error: string+ declare error: string// Less has priority@AllowNull(false)@Column- priority: number+ declare priority: number// Used to fetch the appropriate job when the runner wants to post the result@AllowNull(true)@Column- processingJobToken: string+ declare processingJobToken: string@AllowNull(true)@Column- progress: number+ declare progress: number@AllowNull(true)@Column- startedAt: Date+ declare startedAt: Date@AllowNull(true)@Column- finishedAt: Date+ declare finishedAt: Date@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => RunnerJobModel)@Column- dependsOnRunnerJobId: number+ declare dependsOnRunnerJobId: number@BelongsTo(() => RunnerJobModel, {foreignKey: {@@ -136,11 +136,11 @@ export class RunnerJobModel extends SequelizeModel<RunnerJobModel> {},onDelete: 'cascade'})- DependsOnRunnerJob: Awaited<RunnerJobModel>+ declare DependsOnRunnerJob: Awaited<RunnerJobModel>@ForeignKey(() => RunnerModel)@Column- runnerId: number+ declare runnerId: number@BelongsTo(() => RunnerModel, {foreignKey: {@@ -149,7 +149,7 @@ export class RunnerJobModel extends SequelizeModel<RunnerJobModel> {},onDelete: 'SET NULL'})- Runner: Awaited<RunnerModel>+ declare Runner: Awaited<RunnerModel>// ---------------------------------------------------------------------------@@ -309,7 +309,11 @@ export class RunnerJobModel extends SequelizeModel<RunnerJobModel> {setToErrorOrCancel (// eslint-disable-next-line max-len- state: typeof RunnerJobState.PARENT_ERRORED | typeof RunnerJobState.ERRORED | typeof RunnerJobState.CANCELLED | typeof RunnerJobState.PARENT_CANCELLED+ state:+ | typeof RunnerJobState.PARENT_ERRORED+ | typeof RunnerJobState.ERRORED+ | typeof RunnerJobState.CANCELLED+ | typeof RunnerJobState.PARENT_CANCELLED) {this.state = statethis.processingJobToken = nulldiff --git a/server/core/models/runner/runner-registration-token.ts b/server/core/models/runner/runner-registration-token.tsindex 5d055f4a06..7fa6c768df 100644--- a/server/core/models/runner/runner-registration-token.ts+++ b/server/core/models/runner/runner-registration-token.ts@@ -6,9 +6,7 @@ import { SequelizeModel, getSort } from '../shared/index.js'import { RunnerModel } from './runner.js'/**- ** Tokens used by PeerTube runners to register themselves to the PeerTube instance- **/@Table({@@ -21,16 +19,15 @@ import { RunnerModel } from './runner.js']})export class RunnerRegistrationTokenModel extends SequelizeModel<RunnerRegistrationTokenModel> {-@AllowNull(false)@Column- registrationToken: string+ declare registrationToken: string@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@HasMany(() => RunnerModel, {foreignKey: {@@ -38,7 +35,7 @@ export class RunnerRegistrationTokenModel extends SequelizeModel<RunnerRegistrat},onDelete: 'cascade'})- Runners: Awaited<RunnerModel>[]+ declare Runners: Awaited<RunnerModel>[]static load (id: number) {return RunnerRegistrationTokenModel.findByPk(id)diff --git a/server/core/models/runner/runner.ts b/server/core/models/runner/runner.tsindex 0d46e6cd47..b96d243528 100644--- a/server/core/models/runner/runner.ts+++ b/server/core/models/runner/runner.ts@@ -23,37 +23,36 @@ import { CONSTRAINTS_FIELDS } from '@server/initializers/constants.js']})export class RunnerModel extends SequelizeModel<RunnerModel> {-// Used to identify the appropriate runner when it uses the runner REST API@AllowNull(false)@Column- runnerToken: string+ declare runnerToken: string@AllowNull(false)@Column- name: string+ declare name: string@AllowNull(true)@Column(DataType.STRING(CONSTRAINTS_FIELDS.RUNNERS.DESCRIPTION.max))- description: string+ declare description: string@AllowNull(false)@Column- lastContact: Date+ declare lastContact: Date@AllowNull(false)@Column- ip: string+ declare ip: string@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => RunnerRegistrationTokenModel)@Column- runnerRegistrationTokenId: number+ declare runnerRegistrationTokenId: number@BelongsTo(() => RunnerRegistrationTokenModel, {foreignKey: {@@ -61,7 +60,7 @@ export class RunnerModel extends SequelizeModel<RunnerModel> {},onDelete: 'cascade'})- RunnerRegistrationToken: Awaited<RunnerRegistrationTokenModel>+ declare RunnerRegistrationToken: Awaited<RunnerRegistrationTokenModel>// ---------------------------------------------------------------------------diff --git a/server/core/models/server/plugin.ts b/server/core/models/server/plugin.tsindex daf31b8081..c7b6fbcde6 100644--- a/server/core/models/server/plugin.ts+++ b/server/core/models/server/plugin.ts@@ -24,7 +24,6 @@ import { SequelizeModel, getSort, throwIfNotValid } from '../shared/index.js'exclude: [ 'storage' ]}}))-@Table({tableName: 'plugin',indexes: [@@ -35,62 +34,61 @@ import { SequelizeModel, getSort, throwIfNotValid } from '../shared/index.js']})export class PluginModel extends SequelizeModel<PluginModel> {-@AllowNull(false)@Is('PluginName', value => throwIfNotValid(value, isPluginNameValid, 'name'))@Column- name: string+ declare name: string@AllowNull(false)@Is('PluginType', value => throwIfNotValid(value, isPluginTypeValid, 'type'))@Column- type: PluginType_Type+ declare type: PluginType_Type@AllowNull(false)@Is('PluginVersion', value => throwIfNotValid(value, isPluginStableOrUnstableVersionValid, 'version'))@Column- version: string+ declare version: string@AllowNull(true)@Is('PluginLatestVersion', value => throwIfNotValid(value, isPluginStableVersionValid, 'version'))@Column- latestVersion: string+ declare latestVersion: string@AllowNull(false)@Column- enabled: boolean+ declare enabled: boolean@AllowNull(false)@Column- uninstalled: boolean+ declare uninstalled: boolean@AllowNull(false)@Column- peertubeEngine: string+ declare peertubeEngine: string@AllowNull(true)@Is('PluginDescription', value => throwIfNotValid(value, isPluginDescriptionValid, 'description'))@Column- description: string+ declare description: string@AllowNull(false)@Is('PluginHomepage', value => throwIfNotValid(value, isPluginHomepage, 'homepage'))@Column- homepage: string+ declare homepage: string@AllowNull(true)@Column(DataType.JSONB)- settings: any+ declare settings: any@AllowNull(true)@Column(DataType.JSONB)- storage: any+ declare storage: any@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Datestatic listEnabledPluginsAndThemes (): Promise<MPlugin[]> {const query = {@@ -219,7 +217,7 @@ export class PluginModel extends SequelizeModel<PluginModel> {static storeData (pluginName: string, pluginType: PluginType_Type, key: string, data: any) {const query = 'UPDATE "plugin" SET "storage" = jsonb_set(coalesce("storage", \'{}\'), :key, :data::jsonb) ' +- 'WHERE "name" = :pluginName AND "type" = :pluginType'+ 'WHERE "name" = :pluginName AND "type" = :pluginType'const jsonPath = '{' + key + '}'@@ -229,7 +227,7 @@ export class PluginModel extends SequelizeModel<PluginModel> {}return PluginModel.sequelize.query(query, options)- .then(() => undefined)+ .then(() => undefined)}static listForApi (options: {@@ -312,5 +310,4 @@ export class PluginModel extends SequelizeModel<PluginModel> {updatedAt: this.updatedAt}}-}diff --git a/server/core/models/server/server-blocklist.ts b/server/core/models/server/server-blocklist.tsindex 4d3d9e0576..20b131b1ff 100644--- a/server/core/models/server/server-blocklist.ts+++ b/server/core/models/server/server-blocklist.ts@@ -29,7 +29,6 @@ enum ScopeNames {]}}))-@Table({tableName: 'serverBlocklist',indexes: [@@ -43,16 +42,15 @@ enum ScopeNames {]})export class ServerBlocklistModel extends SequelizeModel<ServerBlocklistModel> {-@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => AccountModel)@Column- accountId: number+ declare accountId: number@BelongsTo(() => AccountModel, {foreignKey: {@@ -61,11 +59,11 @@ export class ServerBlocklistModel extends SequelizeModel<ServerBlocklistModel> {},onDelete: 'CASCADE'})- ByAccount: Awaited<AccountModel>+ declare ByAccount: Awaited<AccountModel>@ForeignKey(() => ServerModel)@Column- targetServerId: number+ declare targetServerId: number@BelongsTo(() => ServerModel, {foreignKey: {@@ -73,7 +71,7 @@ export class ServerBlocklistModel extends SequelizeModel<ServerBlocklistModel> {},onDelete: 'CASCADE'})- BlockedServer: Awaited<ServerModel>+ declare BlockedServer: Awaited<ServerModel>static isServerMutedByAccounts (accountIds: number[], targetServerId: number) {const query = {@@ -88,16 +86,16 @@ export class ServerBlocklistModel extends SequelizeModel<ServerBlocklistModel> {}return ServerBlocklistModel.unscoped()- .findAll(query)- .then(rows => {- const result: { [accountId: number]: boolean } = {}+ .findAll(query)+ .then(rows => {+ const result: { [accountId: number]: boolean } = {}- for (const accountId of accountIds) {- result[accountId] = !!rows.find(r => r.accountId === accountId)- }+ for (const accountId of accountIds) {+ result[accountId] = !!rows.find(r => r.accountId === accountId)+ }- return result- })+ return result+ })}static loadByAccountAndHost (accountId: number, host: string): Promise<MServerBlocklist> {@@ -121,7 +119,7 @@ export class ServerBlocklistModel extends SequelizeModel<ServerBlocklistModel> {static listHostsBlockedBy (accountIds: number[]): Promise<string[]> {const query = {- attributes: [ ],+ attributes: [],where: {accountId: {[Op.in]: accountIdsdiff --git a/server/core/models/server/server.ts b/server/core/models/server/server.tsindex d1e45e7ff6..4538f17056 100644--- a/server/core/models/server/server.ts+++ b/server/core/models/server/server.ts@@ -16,22 +16,21 @@ import { ServerBlocklistModel } from './server-blocklist.js']})export class ServerModel extends SequelizeModel<ServerModel> {-@AllowNull(false)@Is('Host', value => throwIfNotValid(value, isHostValid, 'valid host'))@Column- host: string+ declare host: string@AllowNull(false)@Default(false)@Column- redundancyAllowed: boolean+ declare redundancyAllowed: boolean@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@HasMany(() => ActorModel, {foreignKey: {@@ -41,7 +40,7 @@ export class ServerModel extends SequelizeModel<ServerModel> {onDelete: 'CASCADE',hooks: true})- Actors: Awaited<ActorModel>[]+ declare Actors: Awaited<ActorModel>[]@HasMany(() => ServerBlocklistModel, {foreignKey: {@@ -49,7 +48,7 @@ export class ServerModel extends SequelizeModel<ServerModel> {},onDelete: 'CASCADE'})- BlockedBy: Awaited<ServerBlocklistModel>[]+ declare BlockedBy: Awaited<ServerBlocklistModel>[]// ---------------------------------------------------------------------------diff --git a/server/core/models/server/tracker.ts b/server/core/models/server/tracker.tsindex dfb41e8598..0f00b52a9a 100644--- a/server/core/models/server/tracker.ts+++ b/server/core/models/server/tracker.ts@@ -15,23 +15,22 @@ import { SequelizeModel } from '../shared/sequelize-type.js']})export class TrackerModel extends SequelizeModel<TrackerModel> {-@AllowNull(false)@Column- url: string+ declare url: string@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@BelongsToMany(() => VideoModel, {foreignKey: 'trackerId',through: () => VideoTrackerModel,onDelete: 'CASCADE'})- Videos: Awaited<VideoModel>[]+ declare Videos: Awaited<VideoModel>[]static listUrlsByVideoId (videoId: number) {const query = {diff --git a/server/core/models/server/video-tracker.ts b/server/core/models/server/video-tracker.tsindex 468abb4052..c0dc23d297 100644--- a/server/core/models/server/video-tracker.ts+++ b/server/core/models/server/video-tracker.ts@@ -16,16 +16,16 @@ import { SequelizeModel } from '../shared/index.js'})export class VideoTrackerModel extends SequelizeModel<VideoTrackerModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@ForeignKey(() => TrackerModel)@Column- trackerId: number+ declare trackerId: number}diff --git a/server/core/models/shared/sequelize-type.ts b/server/core/models/shared/sequelize-type.tsindex 00b06752bd..8e924ac7c0 100644--- a/server/core/models/shared/sequelize-type.ts+++ b/server/core/models/shared/sequelize-type.ts@@ -1,6 +1,6 @@import { AttributesOnly } from '@peertube/peertube-typescript-utils'import { Model } from 'sequelize-typescript'-export abstract class SequelizeModel <T> extends Model<Partial<AttributesOnly<T>>> {- id: number+export abstract class SequelizeModel<T> extends Model<Partial<AttributesOnly<T>>> {+ declare id: number}diff --git a/server/core/models/user/user-export.ts b/server/core/models/user/user-export.tsindex a54ee4e32f..3999ff0937 100644--- a/server/core/models/user/user-export.ts+++ b/server/core/models/user/user-export.ts@@ -35,42 +35,42 @@ import { UserModel } from './user.js'})export class UserExportModel extends SequelizeModel<UserExportModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@AllowNull(true)@Column- filename: string+ declare filename: string@AllowNull(false)@Column- withVideoFiles: boolean+ declare withVideoFiles: boolean@AllowNull(false)@Column- state: UserExportStateType+ declare state: UserExportStateType@AllowNull(true)@Column(DataType.TEXT)- error: string+ declare error: string@AllowNull(true)@Column(DataType.BIGINT)- size: number+ declare size: number@AllowNull(false)@Column- storage: FileStorageType+ declare storage: FileStorageType@AllowNull(true)@Column- fileUrl: string+ declare fileUrl: string@ForeignKey(() => UserModel)@Column- userId: number+ declare userId: number@BelongsTo(() => UserModel, {foreignKey: {@@ -78,7 +78,7 @@ export class UserExportModel extends SequelizeModel<UserExportModel> {},onDelete: 'CASCADE'})- User: Awaited<UserModel>+ declare User: Awaited<UserModel>@BeforeDestroystatic removeFile (instance: UserExportModel) {@@ -225,5 +225,4 @@ export class UserExportModel extends SequelizeModel<UserExportModel> {expiresOn: new Date(this.createdAt.getTime() + CONFIG.EXPORT.USERS.EXPORT_EXPIRATION).toISOString()}}-}diff --git a/server/core/models/user/user-import.ts b/server/core/models/user/user-import.tsindex f491f5e717..8ad67c32e8 100644--- a/server/core/models/user/user-import.ts+++ b/server/core/models/user/user-import.ts@@ -20,30 +20,30 @@ import { USER_IMPORT_STATES } from '@server/initializers/constants.js'})export class UserImportModel extends SequelizeModel<UserImportModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@AllowNull(true)@Column- filename: string+ declare filename: string@AllowNull(false)@Column- state: UserImportStateType+ declare state: UserImportStateType@AllowNull(true)@Column(DataType.TEXT)- error: string+ declare error: string@AllowNull(true)@Column(DataType.JSONB)- resultSummary: UserImportResultSummary+ declare resultSummary: UserImportResultSummary@ForeignKey(() => UserModel)@Column- userId: number+ declare userId: number@BelongsTo(() => UserModel, {foreignKey: {@@ -51,7 +51,7 @@ export class UserImportModel extends SequelizeModel<UserImportModel> {},onDelete: 'CASCADE'})- User: Awaited<UserModel>+ declare User: Awaited<UserModel>static load (id: number | string) {return UserImportModel.findByPk<MUserImport>(id)diff --git a/server/core/models/user/user-notification-setting.ts b/server/core/models/user/user-notification-setting.tsindex dc48ca55de..0dbf7bd968 100644--- a/server/core/models/user/user-notification-setting.ts+++ b/server/core/models/user/user-notification-setting.ts@@ -10,7 +10,8 @@ import {CreatedAt,Default,ForeignKey,- Is, Table,+ Is,+ Table,UpdatedAt} from 'sequelize-typescript'import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications.js'@@ -27,7 +28,6 @@ import { UserModel } from './user.js']})export class UserNotificationSettingModel extends SequelizeModel<UserNotificationSettingModel> {-@AllowNull(false)@Default(null)@Is(@@ -35,7 +35,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatiovalue => throwIfNotValid(value, isUserNotificationSettingValid, 'newVideoFromSubscription'))@Column- newVideoFromSubscription: UserNotificationSettingValueType+ declare newVideoFromSubscription: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -44,7 +44,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatiovalue => throwIfNotValid(value, isUserNotificationSettingValid, 'newCommentOnMyVideo'))@Column- newCommentOnMyVideo: UserNotificationSettingValueType+ declare newCommentOnMyVideo: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -53,7 +53,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatiovalue => throwIfNotValid(value, isUserNotificationSettingValid, 'abuseAsModerator'))@Column- abuseAsModerator: UserNotificationSettingValueType+ declare abuseAsModerator: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -62,7 +62,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatiovalue => throwIfNotValid(value, isUserNotificationSettingValid, 'videoAutoBlacklistAsModerator'))@Column- videoAutoBlacklistAsModerator: UserNotificationSettingValueType+ declare videoAutoBlacklistAsModerator: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -71,7 +71,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatiovalue => throwIfNotValid(value, isUserNotificationSettingValid, 'blacklistOnMyVideo'))@Column- blacklistOnMyVideo: UserNotificationSettingValueType+ declare blacklistOnMyVideo: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -80,7 +80,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatiovalue => throwIfNotValid(value, isUserNotificationSettingValid, 'myVideoPublished'))@Column- myVideoPublished: UserNotificationSettingValueType+ declare myVideoPublished: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -89,7 +89,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatiovalue => throwIfNotValid(value, isUserNotificationSettingValid, 'myVideoImportFinished'))@Column- myVideoImportFinished: UserNotificationSettingValueType+ declare myVideoImportFinished: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -98,7 +98,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatiovalue => throwIfNotValid(value, isUserNotificationSettingValid, 'newUserRegistration'))@Column- newUserRegistration: UserNotificationSettingValueType+ declare newUserRegistration: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -107,7 +107,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatiovalue => throwIfNotValid(value, isUserNotificationSettingValid, 'newInstanceFollower'))@Column- newInstanceFollower: UserNotificationSettingValueType+ declare newInstanceFollower: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -116,7 +116,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatiovalue => throwIfNotValid(value, isUserNotificationSettingValid, 'autoInstanceFollowing'))@Column- autoInstanceFollowing: UserNotificationSettingValueType+ declare autoInstanceFollowing: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -125,7 +125,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatiovalue => throwIfNotValid(value, isUserNotificationSettingValid, 'newFollow'))@Column- newFollow: UserNotificationSettingValueType+ declare newFollow: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -134,7 +134,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatiovalue => throwIfNotValid(value, isUserNotificationSettingValid, 'commentMention'))@Column- commentMention: UserNotificationSettingValueType+ declare commentMention: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -143,7 +143,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatiovalue => throwIfNotValid(value, isUserNotificationSettingValid, 'abuseStateChange'))@Column- abuseStateChange: UserNotificationSettingValueType+ declare abuseStateChange: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -152,7 +152,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatiovalue => throwIfNotValid(value, isUserNotificationSettingValid, 'abuseNewMessage'))@Column- abuseNewMessage: UserNotificationSettingValueType+ declare abuseNewMessage: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -161,7 +161,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatiovalue => throwIfNotValid(value, isUserNotificationSettingValid, 'newPeerTubeVersion'))@Column- newPeerTubeVersion: UserNotificationSettingValueType+ declare newPeerTubeVersion: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -170,7 +170,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatiovalue => throwIfNotValid(value, isUserNotificationSettingValid, 'newPluginVersion'))@Column- newPluginVersion: UserNotificationSettingValueType+ declare newPluginVersion: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -179,7 +179,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatiovalue => throwIfNotValid(value, isUserNotificationSettingValid, 'myVideoStudioEditionFinished'))@Column- myVideoStudioEditionFinished: UserNotificationSettingValueType+ declare myVideoStudioEditionFinished: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -188,11 +188,11 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatiovalue => throwIfNotValid(value, isUserNotificationSettingValid, 'myVideoTranscriptionGenerated'))@Column- myVideoTranscriptionGenerated: UserNotificationSettingValueType+ declare myVideoTranscriptionGenerated: UserNotificationSettingValueType@ForeignKey(() => UserModel)@Column- userId: number+ declare userId: number@BelongsTo(() => UserModel, {foreignKey: {@@ -200,13 +200,13 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatio},onDelete: 'cascade'})- User: Awaited<UserModel>+ declare User: Awaited<UserModel>@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@AfterUpdate@AfterDestroydiff --git a/server/core/models/user/user-notification.ts b/server/core/models/user/user-notification.tsindex b255852299..b7fcad0f9c 100644--- a/server/core/models/user/user-notification.ts+++ b/server/core/models/user/user-notification.ts@@ -116,23 +116,23 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>@Default(null)@Is('UserNotificationType', value => throwIfNotValid(value, isUserNotificationTypeValid, 'type'))@Column- type: UserNotificationType_Type+ declare type: UserNotificationType_Type@AllowNull(false)@Default(false)@Is('UserNotificationRead', value => throwIfNotValid(value, isBooleanValid, 'read'))@Column- read: boolean+ declare read: boolean@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => UserModel)@Column- userId: number+ declare userId: number@BelongsTo(() => UserModel, {foreignKey: {@@ -140,11 +140,11 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>},onDelete: 'cascade'})- User: Awaited<UserModel>+ declare User: Awaited<UserModel>@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@BelongsTo(() => VideoModel, {foreignKey: {@@ -152,11 +152,11 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>},onDelete: 'cascade'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>@ForeignKey(() => VideoCommentModel)@Column- commentId: number+ declare commentId: number@BelongsTo(() => VideoCommentModel, {foreignKey: {@@ -164,11 +164,11 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>},onDelete: 'cascade'})- VideoComment: Awaited<VideoCommentModel>+ declare VideoComment: Awaited<VideoCommentModel>@ForeignKey(() => AbuseModel)@Column- abuseId: number+ declare abuseId: number@BelongsTo(() => AbuseModel, {foreignKey: {@@ -176,11 +176,11 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>},onDelete: 'cascade'})- Abuse: Awaited<AbuseModel>+ declare Abuse: Awaited<AbuseModel>@ForeignKey(() => VideoBlacklistModel)@Column- videoBlacklistId: number+ declare videoBlacklistId: number@BelongsTo(() => VideoBlacklistModel, {foreignKey: {@@ -188,11 +188,11 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>},onDelete: 'cascade'})- VideoBlacklist: Awaited<VideoBlacklistModel>+ declare VideoBlacklist: Awaited<VideoBlacklistModel>@ForeignKey(() => VideoImportModel)@Column- videoImportId: number+ declare videoImportId: number@BelongsTo(() => VideoImportModel, {foreignKey: {@@ -200,11 +200,11 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>},onDelete: 'cascade'})- VideoImport: Awaited<VideoImportModel>+ declare VideoImport: Awaited<VideoImportModel>@ForeignKey(() => AccountModel)@Column- accountId: number+ declare accountId: number@BelongsTo(() => AccountModel, {foreignKey: {@@ -212,11 +212,11 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>},onDelete: 'cascade'})- Account: Awaited<AccountModel>+ declare Account: Awaited<AccountModel>@ForeignKey(() => ActorFollowModel)@Column- actorFollowId: number+ declare actorFollowId: number@BelongsTo(() => ActorFollowModel, {foreignKey: {@@ -224,11 +224,11 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>},onDelete: 'cascade'})- ActorFollow: Awaited<ActorFollowModel>+ declare ActorFollow: Awaited<ActorFollowModel>@ForeignKey(() => PluginModel)@Column- pluginId: number+ declare pluginId: number@BelongsTo(() => PluginModel, {foreignKey: {@@ -236,11 +236,11 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>},onDelete: 'cascade'})- Plugin: Awaited<PluginModel>+ declare Plugin: Awaited<PluginModel>@ForeignKey(() => ApplicationModel)@Column- applicationId: number+ declare applicationId: number@BelongsTo(() => ApplicationModel, {foreignKey: {@@ -248,11 +248,11 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>},onDelete: 'cascade'})- Application: Awaited<ApplicationModel>+ declare Application: Awaited<ApplicationModel>@ForeignKey(() => UserRegistrationModel)@Column- userRegistrationId: number+ declare userRegistrationId: number@BelongsTo(() => UserRegistrationModel, {foreignKey: {@@ -260,11 +260,11 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>},onDelete: 'cascade'})- UserRegistration: Awaited<UserRegistrationModel>+ declare UserRegistration: Awaited<UserRegistrationModel>@ForeignKey(() => VideoCaptionModel)@Column- videoCaptionId: number+ declare videoCaptionId: number@BelongsTo(() => VideoCaptionModel, {foreignKey: {@@ -272,7 +272,7 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>},onDelete: 'cascade'})- VideoCaption: Awaited<VideoCaptionModel>+ declare VideoCaption: Awaited<VideoCaptionModel>static listForApi (options: {userId: numberdiff --git a/server/core/models/user/user-registration.ts b/server/core/models/user/user-registration.tsindex 8a4340fcde..bd066506ff 100644--- a/server/core/models/user/user-registration.ts+++ b/server/core/models/user/user-registration.ts@@ -18,7 +18,8 @@ import {DataType,ForeignKey,Is,- IsEmail, Table,+ IsEmail,+ Table,UpdatedAt} from 'sequelize-typescript'import { isUserDisplayNameValid, isUserEmailVerifiedValid, isUserPasswordValid } from '../../helpers/custom-validators/users.js'@@ -48,69 +49,68 @@ import { forceNumber } from '@peertube/peertube-core-utils']})export class UserRegistrationModel extends SequelizeModel<UserRegistrationModel> {-@AllowNull(false)@Is('RegistrationState', value => throwIfNotValid(value, isRegistrationStateValid, 'state'))@Column- state: UserRegistrationStateType+ declare state: UserRegistrationStateType@AllowNull(false)@Is('RegistrationReason', value => throwIfNotValid(value, isRegistrationReasonValid, 'registration reason'))@Column(DataType.TEXT)- registrationReason: string+ declare registrationReason: string@AllowNull(true)@Is('RegistrationModerationResponse', value => throwIfNotValid(value, isRegistrationModerationResponseValid, 'moderation response', true))@Column(DataType.TEXT)- moderationResponse: string+ declare moderationResponse: string@AllowNull(true)@Is('RegistrationPassword', value => throwIfNotValid(value, isUserPasswordValid, 'registration password', true))@Column- password: string+ declare password: string@AllowNull(false)@Column- username: string+ declare username: string@AllowNull(false)@IsEmail@Column(DataType.STRING(400))- email: string+ declare email: string@AllowNull(true)@Is('RegistrationEmailVerified', value => throwIfNotValid(value, isUserEmailVerifiedValid, 'email verified boolean', true))@Column- emailVerified: boolean+ declare emailVerified: boolean@AllowNull(true)@Is('RegistrationAccountDisplayName', value => throwIfNotValid(value, isUserDisplayNameValid, 'account display name', true))@Column- accountDisplayName: string+ declare accountDisplayName: string@AllowNull(true)@Is('ChannelHandle', value => throwIfNotValid(value, isVideoChannelDisplayNameValid, 'channel handle', true))@Column- channelHandle: string+ declare channelHandle: string@AllowNull(true)@Is('ChannelDisplayName', value => throwIfNotValid(value, isVideoChannelDisplayNameValid, 'channel display name', true))@Column- channelDisplayName: string+ declare channelDisplayName: string@AllowNull(true)@Column- processedAt: Date+ declare processedAt: Date@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => UserModel)@Column- userId: number+ declare userId: number@BelongsTo(() => UserModel, {foreignKey: {@@ -118,7 +118,7 @@ export class UserRegistrationModel extends SequelizeModel<UserRegistrationModel>},onDelete: 'SET NULL'})- User: Awaited<UserModel>+ declare User: Awaited<UserModel>@BeforeCreatestatic async cryptPasswordIfNeeded (instance: UserRegistrationModel) {@@ -245,8 +245,8 @@ export class UserRegistrationModel extends SequelizeModel<UserRegistrationModel>static getStats () {const query = `SELECT ` +`AVG(EXTRACT(EPOCH FROM ("processedAt" - "createdAt") * 1000)) ` +- `FILTER (WHERE "processedAt" IS NOT NULL AND "createdAt" > CURRENT_DATE - INTERVAL '3 months')` +- `AS "avgResponseTime", ` ++ `FILTER (WHERE "processedAt" IS NOT NULL AND "createdAt" > CURRENT_DATE - INTERVAL '3 months')` ++ `AS "avgResponseTime", ` +// "processedAt" has been introduced in PeerTube 6.1 so also check the abuse state to check processed abuses`COUNT(*) FILTER (WHERE "processedAt" IS NOT NULL OR "state" != ${UserRegistrationState.PENDING}) AS "processedRequests", ` +`COUNT(*) AS "totalRequests" ` +diff --git a/server/core/models/user/user-video-history.ts b/server/core/models/user/user-video-history.tsindex 843d36978d..a5e88dbc30 100644--- a/server/core/models/user/user-video-history.ts+++ b/server/core/models/user/user-video-history.ts@@ -25,19 +25,19 @@ import { getSort } from '../shared/sort.js'})export class UserVideoHistoryModel extends SequelizeModel<UserVideoHistoryModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@AllowNull(false)@IsInt@Column- currentTime: number+ declare currentTime: number@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@BelongsTo(() => VideoModel, {foreignKey: {@@ -45,11 +45,11 @@ export class UserVideoHistoryModel extends SequelizeModel<UserVideoHistoryModel>},onDelete: 'CASCADE'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>@ForeignKey(() => UserModel)@Column- userId: number+ declare userId: number@BelongsTo(() => UserModel, {foreignKey: {@@ -57,7 +57,7 @@ export class UserVideoHistoryModel extends SequelizeModel<UserVideoHistoryModel>},onDelete: 'CASCADE'})- User: Awaited<UserModel>+ declare User: Awaited<UserModel>// FIXME: have to specify the result type to not break peertube typings generationstatic listForApi (user: MUserAccountId, start: number, count: number, search?: string): Promise<ResultList<VideoModel>> {diff --git a/server/core/models/user/user.ts b/server/core/models/user/user.tsindex 543efa7efb..4afde1b32d 100644--- a/server/core/models/user/user.ts+++ b/server/core/models/user/user.ts@@ -292,79 +292,79 @@ export class UserModel extends SequelizeModel<UserModel> {@AllowNull(true)@Is('UserPassword', value => throwIfNotValid(value, isUserPasswordValid, 'user password', true))@Column- password: string+ declare password: string@AllowNull(false)@Column- username: string+ declare username: string@AllowNull(false)@IsEmail@Column(DataType.STRING(400))- email: string+ declare email: string@AllowNull(true)@IsEmail@Column(DataType.STRING(400))- pendingEmail: string+ declare pendingEmail: string@AllowNull(true)@Default(null)@Is('UserEmailVerified', value => throwIfNotValid(value, isUserEmailVerifiedValid, 'email verified boolean', true))@Column- emailVerified: boolean+ declare emailVerified: boolean@AllowNull(false)@Is('UserNSFWPolicy', value => throwIfNotValid(value, isUserNSFWPolicyValid, 'NSFW policy'))@Column(DataType.ENUM(...Object.values(NSFW_POLICY_TYPES)))- nsfwPolicy: NSFWPolicyType+ declare nsfwPolicy: NSFWPolicyType@AllowNull(false)@Default(0)@Is('UserNSFWFlagsDisplayed', value => throwIfNotValid(value, isNSFWFlagsValid, 'NSFW flags'))@Column- nsfwFlagsDisplayed: number+ declare nsfwFlagsDisplayed: number@AllowNull(false)@Default(0)@Is('UserNSFWFlagsHidden', value => throwIfNotValid(value, isNSFWFlagsValid, 'NSFW flags'))@Column- nsfwFlagsHidden: number+ declare nsfwFlagsHidden: number@AllowNull(false)@Default(0)@Is('nsfwFlagsBlurred', value => throwIfNotValid(value, isNSFWFlagsValid, 'NSFW flags'))@Column- nsfwFlagsBlurred: number+ declare nsfwFlagsBlurred: number@AllowNull(false)@Default(0)@Is('UserNSFWFlagsWarned', value => throwIfNotValid(value, isNSFWFlagsValid, 'NSFW flags'))@Column- nsfwFlagsWarned: number+ declare nsfwFlagsWarned: number@AllowNull(false)@Is('p2pEnabled', value => throwIfNotValid(value, isUserP2PEnabledValid, 'P2P enabled'))@Column- p2pEnabled: boolean+ declare p2pEnabled: boolean@AllowNull(false)@Default(true)@Is('UserVideosHistoryEnabled', value => throwIfNotValid(value, isUserVideosHistoryEnabledValid, 'Videos history enabled'))@Column- videosHistoryEnabled: boolean+ declare videosHistoryEnabled: boolean@AllowNull(false)@Default(true)@Is('UserAutoPlayVideo', value => throwIfNotValid(value, isUserAutoPlayVideoValid, 'auto play video boolean'))@Column- autoPlayVideo: boolean+ declare autoPlayVideo: boolean@AllowNull(false)@Default(false)@Is('UserAutoPlayNextVideo', value => throwIfNotValid(value, isUserAutoPlayNextVideoValid, 'auto play next video boolean'))@Column- autoPlayNextVideo: boolean+ declare autoPlayNextVideo: boolean@AllowNull(false)@Default(true)@@ -373,56 +373,56 @@ export class UserModel extends SequelizeModel<UserModel> {value => throwIfNotValid(value, isUserAutoPlayNextVideoPlaylistValid, 'auto play next video for playlists boolean'))@Column- autoPlayNextVideoPlaylist: boolean+ declare autoPlayNextVideoPlaylist: boolean@AllowNull(true)@Column(DataType.STRING)- language: string+ declare language: string@AllowNull(true)@Default(null)@Is('UserVideoLanguages', value => throwIfNotValid(value, isUserVideoLanguages, 'video languages'))@Column(DataType.ARRAY(DataType.STRING))- videoLanguages: string[]+ declare videoLanguages: string[]@AllowNull(false)@Default(UserAdminFlag.NONE)@Is('UserAdminFlags', value => throwIfNotValid(value, isUserAdminFlagsValid, 'user admin flags'))@Column- adminFlags: UserAdminFlagType+ declare adminFlags: UserAdminFlagType@AllowNull(false)@Default(false)@Is('UserBlocked', value => throwIfNotValid(value, isUserBlockedValid, 'blocked boolean'))@Column- blocked: boolean+ declare blocked: boolean@AllowNull(true)@Default(null)@Is('UserBlockedReason', value => throwIfNotValid(value, isUserBlockedReasonValid, 'blocked reason', true))@Column- blockedReason: string+ declare blockedReason: string@AllowNull(false)@Is('UserRole', value => throwIfNotValid(value, isUserRoleValid, 'role'))@Column- role: UserRoleType+ declare role: UserRoleType@AllowNull(false)@Is('UserVideoQuota', value => throwIfNotValid(value, isUserVideoQuotaValid, 'video quota'))@Column(DataType.BIGINT)- videoQuota: number+ declare videoQuota: number@AllowNull(false)@Is('UserVideoQuotaDaily', value => throwIfNotValid(value, isUserVideoQuotaDailyValid, 'video quota daily'))@Column(DataType.BIGINT)- videoQuotaDaily: number+ declare videoQuotaDaily: number@AllowNull(false)@Default(DEFAULT_USER_THEME_NAME)@Is('UserTheme', value => throwIfNotValid(value, isThemeNameValid, 'theme'))@Column- theme: string+ declare theme: string@AllowNull(false)@Default(false)@@ -431,7 +431,7 @@ export class UserModel extends SequelizeModel<UserModel> {value => throwIfNotValid(value, isUserNoModal, 'no instance config warning modal'))@Column- noInstanceConfigWarningModal: boolean+ declare noInstanceConfigWarningModal: boolean@AllowNull(false)@Default(false)@@ -440,7 +440,7 @@ export class UserModel extends SequelizeModel<UserModel> {value => throwIfNotValid(value, isUserNoModal, 'no welcome modal'))@Column- noWelcomeModal: boolean+ declare noWelcomeModal: boolean@AllowNull(false)@Default(false)@@ -449,72 +449,72 @@ export class UserModel extends SequelizeModel<UserModel> {value => throwIfNotValid(value, isUserNoModal, 'no account setup warning modal'))@Column- noAccountSetupWarningModal: boolean+ declare noAccountSetupWarningModal: boolean@AllowNull(true)@Default(null)@Column- pluginAuth: string+ declare pluginAuth: string@AllowNull(false)@Default(DataType.UUIDV4)@IsUUID(4)@Column(DataType.UUID)- feedToken: string+ declare feedToken: string@AllowNull(true)@Default(null)@Column- lastLoginDate: Date+ declare lastLoginDate: Date@AllowNull(false)@Default(false)@Column- emailPublic: boolean+ declare emailPublic: boolean@AllowNull(true)@Default(null)@Column- otpSecret: string+ declare otpSecret: string@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@HasOne(() => AccountModel, {foreignKey: 'userId',onDelete: 'cascade',hooks: true})- Account: Awaited<AccountModel>+ declare Account: Awaited<AccountModel>@HasOne(() => UserNotificationSettingModel, {foreignKey: 'userId',onDelete: 'cascade',hooks: true})- NotificationSetting: Awaited<UserNotificationSettingModel>+ declare NotificationSetting: Awaited<UserNotificationSettingModel>@HasMany(() => VideoImportModel, {foreignKey: 'userId',onDelete: 'cascade'})- VideoImports: Awaited<VideoImportModel>[]+ declare VideoImports: Awaited<VideoImportModel>[]@HasMany(() => OAuthTokenModel, {foreignKey: 'userId',onDelete: 'cascade'})- OAuthTokens: Awaited<OAuthTokenModel>[]+ declare OAuthTokens: Awaited<OAuthTokenModel>[]@HasMany(() => UserExportModel, {foreignKey: 'userId',onDelete: 'cascade',hooks: true})- UserExports: Awaited<UserExportModel>[]+ declare UserExports: Awaited<UserExportModel>[]// Used if we already set an encrypted password in user modelskipPasswordEncryption = falsediff --git a/server/core/models/video/schedule-video-update.ts b/server/core/models/video/schedule-video-update.tsindex a74f7c58a6..d29b0f1303 100644--- a/server/core/models/video/schedule-video-update.ts+++ b/server/core/models/video/schedule-video-update.ts@@ -18,26 +18,25 @@ import { SequelizeModel } from '../shared/index.js']})export class ScheduleVideoUpdateModel extends SequelizeModel<ScheduleVideoUpdateModel> {-@AllowNull(false)@Default(null)@Column- updateAt: Date+ declare updateAt: Date@AllowNull(true)@Default(null)@Column(DataType.INTEGER)- privacy: typeof VideoPrivacy.PUBLIC | typeof VideoPrivacy.UNLISTED | typeof VideoPrivacy.INTERNAL+ declare privacy: typeof VideoPrivacy.PUBLIC | typeof VideoPrivacy.UNLISTED | typeof VideoPrivacy.INTERNAL@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@BelongsTo(() => VideoModel, {foreignKey: {@@ -45,7 +44,7 @@ export class ScheduleVideoUpdateModel extends SequelizeModel<ScheduleVideoUpdate},onDelete: 'cascade'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>static areVideosToUpdate () {const query = {diff --git a/server/core/models/video/sql/video/shared/video-file-query-builder.ts b/server/core/models/video/sql/video/shared/video-file-query-builder.tsindex 976ccb2f67..2d061be4a0 100644--- a/server/core/models/video/sql/video/shared/video-file-query-builder.ts+++ b/server/core/models/video/sql/video/shared/video-file-query-builder.ts@@ -13,14 +13,10 @@ export type FileQueryOptions = {}/**- ** Fetch files (web videos and streaming playlist) according to a video- **/export class VideoFileQueryBuilder extends AbstractVideoQueryBuilder {- protected attributes: { [key: string]: string }-constructor (protected readonly sequelize: Sequelize) {super(sequelize, 'get')}diff --git a/server/core/models/video/sql/video/video-model-get-query-builder.ts b/server/core/models/video/sql/video/video-model-get-query-builder.tsindex 885ee4a34a..a3d1ee801a 100644--- a/server/core/models/video/sql/video/video-model-get-query-builder.ts+++ b/server/core/models/video/sql/video/video-model-get-query-builder.ts@@ -6,21 +6,19 @@ import { VideoModelBuilder } from './shared/video-model-builder.js'import { VideoTableAttributes } from './shared/video-table-attributes.js'/**- ** Build a GET SQL query, fetch rows and create the video model- **/export type GetType =- 'api' |- 'full' |- 'account-blacklist-files' |- 'account' |- 'all-files' |- 'thumbnails' |- 'thumbnails-blacklist' |- 'id' |- 'blacklist-rights'+ | 'api'+ | 'full'+ | 'account-blacklist-files'+ | 'account'+ | 'all-files'+ | 'thumbnails'+ | 'thumbnails-blacklist'+ | 'id'+ | 'blacklist-rights'export type BuildVideoGetQueryOptions = {id?: number | string@@ -91,8 +89,6 @@ export class VideoModelGetQueryBuilder {}export class VideosModelGetQuerySubBuilder extends AbstractVideoQueryBuilder {- protected attributes: { [key: string]: string }-protected webVideoFilesQuery: stringprotected streamingPlaylistFilesQuery: stringdiff --git a/server/core/models/video/sql/video/videos-model-list-query-builder.ts b/server/core/models/video/sql/video/videos-model-list-query-builder.tsindex 675b9dae61..25fcb74d6f 100644--- a/server/core/models/video/sql/video/videos-model-list-query-builder.ts+++ b/server/core/models/video/sql/video/videos-model-list-query-builder.ts@@ -1,20 +1,18 @@-import { Sequelize } from 'sequelize'import { pick } from '@peertube/peertube-core-utils'import { VideoInclude } from '@peertube/peertube-models'+import { getServerActor } from '@server/models/application/application.js'+import { MActorAccount } from '@server/types/models/index.js'+import { Sequelize } from 'sequelize'import { AbstractVideoQueryBuilder } from './shared/abstract-video-query-builder.js'import { VideoFileQueryBuilder } from './shared/video-file-query-builder.js'import { VideoModelBuilder } from './shared/video-model-builder.js'import { BuildVideosListQueryOptions, VideosIdListQueryBuilder } from './videos-id-list-query-builder.js'-import { getServerActor } from '@server/models/application/application.js'-import { MActorAccount } from '@server/types/models/index.js'/*** Build videos list SQL query and create video models*/export class VideosModelListQueryBuilder extends AbstractVideoQueryBuilder {- protected attributes: { [key: string]: string }-private innerQuery: stringprivate innerSort: stringdiff --git a/server/core/models/video/storyboard.ts b/server/core/models/video/storyboard.tsindex 84a352a5f0..00ce7b1d68 100644--- a/server/core/models/video/storyboard.ts+++ b/server/core/models/video/storyboard.ts@@ -24,38 +24,37 @@ import { SequelizeModel } from '../shared/index.js']})export class StoryboardModel extends SequelizeModel<StoryboardModel> {-@AllowNull(false)@Column- filename: string+ declare filename: string@AllowNull(false)@Column- totalHeight: number+ declare totalHeight: number@AllowNull(false)@Column- totalWidth: number+ declare totalWidth: number@AllowNull(false)@Column- spriteHeight: number+ declare spriteHeight: number@AllowNull(false)@Column- spriteWidth: number+ declare spriteWidth: number@AllowNull(false)@Column- spriteDuration: number+ declare spriteDuration: number@AllowNull(true)@Column(DataType.STRING(CONSTRAINTS_FIELDS.COMMONS.URL.max))- fileUrl: string+ declare fileUrl: string@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@BelongsTo(() => VideoModel, {foreignKey: {@@ -63,13 +62,13 @@ export class StoryboardModel extends SequelizeModel<StoryboardModel> {},onDelete: 'CASCADE'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@AfterDestroystatic removeInstanceFile (instance: StoryboardModel) {@@ -77,7 +76,7 @@ export class StoryboardModel extends SequelizeModel<StoryboardModel> {// Don't block the transactioninstance.removeFile()- .catch(err => logger.error('Cannot remove storyboard file %s.', instance.filename, { err }))+ .catch(err => logger.error('Cannot remove storyboard file %s.', instance.filename, { err }))}static loadByVideo (videoId: number, transaction?: Transaction): Promise<MStoryboard> {diff --git a/server/core/models/video/tag.ts b/server/core/models/video/tag.tsindex 6dc53ae781..9d69ab801f 100644--- a/server/core/models/video/tag.ts+++ b/server/core/models/video/tag.ts@@ -22,18 +22,17 @@ import { VideoModel } from './video.js']})export class TagModel extends SequelizeModel<TagModel> {-@AllowNull(false)@Is('VideoTag', value => throwIfNotValid(value, isVideoTagValid, 'tag'))@Column- name: string+ declare name: string@BelongsToMany(() => VideoModel, {foreignKey: 'tagId',through: () => VideoTagModel,onDelete: 'CASCADE'})- Videos: Awaited<VideoModel>[]+ declare Videos: Awaited<VideoModel>[]// threshold corresponds to how many video the field should have to be returnedstatic getRandomSamples (threshold: number, count: number): Promise<string[]> {@@ -51,7 +50,7 @@ export class TagModel extends SequelizeModel<TagModel> {}return TagModel.sequelize.query<{ name: string }>(query, options)- .then(data => data.map(d => d.name))+ .then(data => data.map(d => d.name))}static findOrCreateMultiple (options: {diff --git a/server/core/models/video/thumbnail.ts b/server/core/models/video/thumbnail.tsindex 2a1827096e..27503ec080 100644--- a/server/core/models/video/thumbnail.ts+++ b/server/core/models/video/thumbnail.ts@@ -13,7 +13,8 @@ import {CreatedAt,DataType,Default,- ForeignKey, Table,+ ForeignKey,+ Table,UpdatedAt} from 'sequelize-typescript'import { logger } from '../../helpers/logger.js'@@ -40,40 +41,39 @@ import { SequelizeModel } from '../shared/sequelize-type.js']})export class ThumbnailModel extends SequelizeModel<ThumbnailModel> {-@AllowNull(false)@Column- filename: string+ declare filename: string@AllowNull(true)@Default(null)@Column- height: number+ declare height: number@AllowNull(true)@Default(null)@Column- width: number+ declare width: number@AllowNull(false)@Column- type: ThumbnailType_Type+ declare type: ThumbnailType_Type@AllowNull(true)@Column(DataType.STRING(CONSTRAINTS_FIELDS.COMMONS.URL.max))- fileUrl: string+ declare fileUrl: string@AllowNull(true)@Column- automaticallyGenerated: boolean+ declare automaticallyGenerated: boolean@AllowNull(false)@Column- onDisk: boolean+ declare onDisk: boolean@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@BelongsTo(() => VideoModel, {foreignKey: {@@ -81,11 +81,11 @@ export class ThumbnailModel extends SequelizeModel<ThumbnailModel> {},onDelete: 'CASCADE'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>@ForeignKey(() => VideoPlaylistModel)@Column- videoPlaylistId: number+ declare videoPlaylistId: number@BelongsTo(() => VideoPlaylistModel, {foreignKey: {@@ -93,18 +93,18 @@ export class ThumbnailModel extends SequelizeModel<ThumbnailModel> {},onDelete: 'CASCADE'})- VideoPlaylist: Awaited<VideoPlaylistModel>+ declare VideoPlaylist: Awaited<VideoPlaylistModel>@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date// If this thumbnail replaced existing one, track the old namepreviousThumbnailFilename: string- private static readonly types: { [ id in ThumbnailType_Type ]: { label: string, directory: string, staticPath: string } } = {+ private static readonly types: { [id in ThumbnailType_Type]: { label: string, directory: string, staticPath: string } } = {[ThumbnailType.MINIATURE]: {label: 'miniature',directory: CONFIG.STORAGE.THUMBNAILS_DIR,@@ -129,7 +129,7 @@ export class ThumbnailModel extends SequelizeModel<ThumbnailModel> {// Don't block the transactioninstance.removeThumbnail()- .catch(err => logger.error('Cannot remove thumbnail file %s.', instance.filename, { err }))+ .catch(err => logger.error('Cannot remove thumbnail file %s.', instance.filename, { err }))}static loadByFilename (filename: string, thumbnailType: ThumbnailType_Type): Promise<MThumbnail> {diff --git a/server/core/models/video/video-blacklist.ts b/server/core/models/video/video-blacklist.tsindex ed143131df..382e90b759 100644--- a/server/core/models/video/video-blacklist.ts+++ b/server/core/models/video/video-blacklist.ts@@ -19,31 +19,30 @@ import { VideoModel } from './video.js']})export class VideoBlacklistModel extends SequelizeModel<VideoBlacklistModel> {-@AllowNull(true)@Is('VideoBlacklistReason', value => throwIfNotValid(value, isVideoBlacklistReasonValid, 'reason', true))@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_BLACKLIST.REASON.max))- reason: string+ declare reason: string@AllowNull(false)@Column- unfederated: boolean+ declare unfederated: boolean@AllowNull(false)@Default(null)@Is('VideoBlacklistType', value => throwIfNotValid(value, isVideoBlacklistTypeValid, 'type'))@Column- type: VideoBlacklistType_Type+ declare type: VideoBlacklistType_Type@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@BelongsTo(() => VideoModel, {foreignKey: {@@ -51,7 +50,7 @@ export class VideoBlacklistModel extends SequelizeModel<VideoBlacklistModel> {},onDelete: 'cascade'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>static listForApi (parameters: {start: numberdiff --git a/server/core/models/video/video-caption.ts b/server/core/models/video/video-caption.tsindex d3671b94e2..73edcd12df 100644--- a/server/core/models/video/video-caption.ts+++ b/server/core/models/video/video-caption.ts@@ -75,44 +75,44 @@ const videoAttributes = [ 'id', 'name', 'remote', 'uuid', 'url', 'state', 'priva})export class VideoCaptionModel extends SequelizeModel<VideoCaptionModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@AllowNull(false)@Is('VideoCaptionLanguage', value => throwIfNotValid(value, isVideoCaptionLanguageValid, 'language'))@Column- language: string+ declare language: string@AllowNull(false)@Column- filename: string+ declare filename: string@AllowNull(true)@Column- m3u8Filename: string+ declare m3u8Filename: string@AllowNull(false)@Default(FileStorage.FILE_SYSTEM)@Column- storage: FileStorageType+ declare storage: FileStorageType@AllowNull(true)@Column(DataType.STRING(CONSTRAINTS_FIELDS.COMMONS.URL.max))- fileUrl: string+ declare fileUrl: string@AllowNull(true)@Column- m3u8Url: string+ declare m3u8Url: string@AllowNull(false)@Column- automaticallyGenerated: boolean+ declare automaticallyGenerated: boolean@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@BelongsTo(() => VideoModel, {foreignKey: {@@ -120,7 +120,7 @@ export class VideoCaptionModel extends SequelizeModel<VideoCaptionModel> {},onDelete: 'CASCADE'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>@BeforeDestroystatic async removeFiles (instance: VideoCaptionModel, options) {diff --git a/server/core/models/video/video-change-ownership.ts b/server/core/models/video/video-change-ownership.tsindex cd789b62cd..73a7c00b68 100644--- a/server/core/models/video/video-change-ownership.ts+++ b/server/core/models/video/video-change-ownership.ts@@ -55,18 +55,18 @@ enum ScopeNames {}))export class VideoChangeOwnershipModel extends SequelizeModel<VideoChangeOwnershipModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@AllowNull(false)@Column- status: VideoChangeOwnershipStatusType+ declare status: VideoChangeOwnershipStatusType@ForeignKey(() => AccountModel)@Column- initiatorAccountId: number+ declare initiatorAccountId: number@BelongsTo(() => AccountModel, {foreignKey: {@@ -75,11 +75,11 @@ export class VideoChangeOwnershipModel extends SequelizeModel<VideoChangeOwnersh},onDelete: 'cascade'})- Initiator: Awaited<AccountModel>+ declare Initiator: Awaited<AccountModel>@ForeignKey(() => AccountModel)@Column- nextOwnerAccountId: number+ declare nextOwnerAccountId: number@BelongsTo(() => AccountModel, {foreignKey: {@@ -88,11 +88,11 @@ export class VideoChangeOwnershipModel extends SequelizeModel<VideoChangeOwnersh},onDelete: 'cascade'})- NextOwner: Awaited<AccountModel>+ declare NextOwner: Awaited<AccountModel>@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@BelongsTo(() => VideoModel, {foreignKey: {@@ -100,7 +100,7 @@ export class VideoChangeOwnershipModel extends SequelizeModel<VideoChangeOwnersh},onDelete: 'cascade'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>static listForApi (nextOwnerId: number, start: number, count: number, sort: string) {const query = {@@ -120,7 +120,7 @@ export class VideoChangeOwnershipModel extends SequelizeModel<VideoChangeOwnershstatic load (id: number): Promise<MVideoChangeOwnershipFull> {return VideoChangeOwnershipModel.scope([ ScopeNames.WITH_ACCOUNTS, ScopeNames.WITH_VIDEO ])- .findByPk(id)+ .findByPk(id)}toFormattedJSON (this: MVideoChangeOwnershipFormattable): VideoChangeOwnership {diff --git a/server/core/models/video/video-channel-sync.ts b/server/core/models/video/video-channel-sync.tsindex c33eb9146a..f3f7e09fc5 100644--- a/server/core/models/video/video-channel-sync.ts+++ b/server/core/models/video/video-channel-sync.ts@@ -13,7 +13,8 @@ import {Default,DefaultScope,ForeignKey,- Is, Table,+ Is,+ Table,UpdatedAt} from 'sequelize-typescript'import { AccountModel } from '../account/account.js'@@ -38,32 +39,31 @@ import { VideoChannelModel } from './video-channel.js']})export class VideoChannelSyncModel extends SequelizeModel<VideoChannelSyncModel> {-@AllowNull(false)@Default(null)@Is('VideoChannelExternalChannelUrl', value => throwIfNotValid(value, isUrlValid, 'externalChannelUrl', true))@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_CHANNEL_SYNCS.EXTERNAL_CHANNEL_URL.max))- externalChannelUrl: string+ declare externalChannelUrl: string@AllowNull(false)@Default(VideoChannelSyncState.WAITING_FIRST_RUN)@Is('VideoChannelSyncState', value => throwIfNotValid(value, isVideoChannelSyncStateValid, 'state'))@Column- state: VideoChannelSyncStateType+ declare state: VideoChannelSyncStateType@AllowNull(true)@Column(DataType.DATE)- lastSyncAt: Date+ declare lastSyncAt: Date@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => VideoChannelModel)@Column- videoChannelId: number+ declare videoChannelId: number@BelongsTo(() => VideoChannelModel, {foreignKey: {@@ -71,7 +71,7 @@ export class VideoChannelSyncModel extends SequelizeModel<VideoChannelSyncModel>},onDelete: 'cascade'})- VideoChannel: Awaited<VideoChannelModel>+ declare VideoChannel: Awaited<VideoChannelModel>static listByAccountForAPI (options: {accountId: numberdiff --git a/server/core/models/video/video-channel.ts b/server/core/models/video/video-channel.tsindex b00bdbbe44..e7d87e8ff7 100644--- a/server/core/models/video/video-channel.ts+++ b/server/core/models/video/video-channel.ts@@ -357,29 +357,29 @@ export class VideoChannelModel extends SequelizeModel<VideoChannelModel> {@AllowNull(false)@Is('VideoChannelName', value => throwIfNotValid(value, isVideoChannelDisplayNameValid, 'name'))@Column- name: string+ declare name: string@AllowNull(true)@Default(null)@Is('VideoChannelDescription', value => throwIfNotValid(value, isVideoChannelDescriptionValid, 'description', true))@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_CHANNELS.DESCRIPTION.max))- description: string+ declare description: string@AllowNull(true)@Default(null)@Is('VideoChannelSupport', value => throwIfNotValid(value, isVideoChannelSupportValid, 'support', true))@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_CHANNELS.SUPPORT.max))- support: string+ declare support: string@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => ActorModel)@Column- actorId: number+ declare actorId: number@BelongsTo(() => ActorModel, {foreignKey: {@@ -387,18 +387,18 @@ export class VideoChannelModel extends SequelizeModel<VideoChannelModel> {},onDelete: 'cascade'})- Actor: Awaited<ActorModel>+ declare Actor: Awaited<ActorModel>@ForeignKey(() => AccountModel)@Column- accountId: number+ declare accountId: number@BelongsTo(() => AccountModel, {foreignKey: {allowNull: false}})- Account: Awaited<AccountModel>+ declare Account: Awaited<AccountModel>@HasMany(() => VideoModel, {foreignKey: {@@ -408,7 +408,7 @@ export class VideoChannelModel extends SequelizeModel<VideoChannelModel> {onDelete: 'CASCADE',hooks: true})- Videos: Awaited<VideoModel>[]+ declare Videos: Awaited<VideoModel>[]@HasMany(() => VideoPlaylistModel, {foreignKey: {@@ -417,7 +417,7 @@ export class VideoChannelModel extends SequelizeModel<VideoChannelModel> {onDelete: 'CASCADE',hooks: true})- VideoPlaylists: Awaited<VideoPlaylistModel>[]+ declare VideoPlaylists: Awaited<VideoPlaylistModel>[]@AfterCreatestatic notifyCreate (channel: MChannel) {diff --git a/server/core/models/video/video-chapter.ts b/server/core/models/video/video-chapter.tsindex e515cbc7bf..655aa2b162 100644--- a/server/core/models/video/video-chapter.ts+++ b/server/core/models/video/video-chapter.ts@@ -16,18 +16,17 @@ import { SequelizeModel } from '../shared/sequelize-type.js']})export class VideoChapterModel extends SequelizeModel<VideoChapterModel> {-@AllowNull(false)@Column- timecode: number+ declare timecode: number@AllowNull(false)@Column- title: string+ declare title: string@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@BelongsTo(() => VideoModel, {foreignKey: {@@ -35,13 +34,13 @@ export class VideoChapterModel extends SequelizeModel<VideoChapterModel> {},onDelete: 'CASCADE'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Datestatic deleteChapters (videoId: number, transaction: Transaction) {const query = {diff --git a/server/core/models/video/video-comment.ts b/server/core/models/video/video-comment.tsindex 9b8e205299..862e98110d 100644--- a/server/core/models/video/video-comment.ts+++ b/server/core/models/video/video-comment.ts@@ -138,35 +138,35 @@ export enum ScopeNames {})export class VideoCommentModel extends SequelizeModel<VideoCommentModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@AllowNull(true)@Column(DataType.DATE)- deletedAt: Date+ declare deletedAt: Date@AllowNull(false)@Is('VideoCommentUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS.URL.max))- url: string+ declare url: string@AllowNull(false)@Column(DataType.TEXT)- text: string+ declare text: string@AllowNull(false)@Column- heldForReview: boolean+ declare heldForReview: boolean@AllowNull(true)@Column- replyApproval: string+ declare replyApproval: string@ForeignKey(() => VideoCommentModel)@Column- originCommentId: number+ declare originCommentId: number@BelongsTo(() => VideoCommentModel, {foreignKey: {@@ -176,11 +176,11 @@ export class VideoCommentModel extends SequelizeModel<VideoCommentModel> {as: 'OriginVideoComment',onDelete: 'CASCADE'})- OriginVideoComment: Awaited<VideoCommentModel>+ declare OriginVideoComment: Awaited<VideoCommentModel>@ForeignKey(() => VideoCommentModel)@Column- inReplyToCommentId: number+ declare inReplyToCommentId: number@BelongsTo(() => VideoCommentModel, {foreignKey: {@@ -190,11 +190,11 @@ export class VideoCommentModel extends SequelizeModel<VideoCommentModel> {as: 'InReplyToVideoComment',onDelete: 'CASCADE'})- InReplyToVideoComment: Awaited<VideoCommentModel> | null+ declare InReplyToVideoComment: Awaited<VideoCommentModel> | null@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@BelongsTo(() => VideoModel, {foreignKey: {@@ -202,11 +202,11 @@ export class VideoCommentModel extends SequelizeModel<VideoCommentModel> {},onDelete: 'CASCADE'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>@ForeignKey(() => AccountModel)@Column- accountId: number+ declare accountId: number@BelongsTo(() => AccountModel, {foreignKey: {@@ -214,7 +214,7 @@ export class VideoCommentModel extends SequelizeModel<VideoCommentModel> {},onDelete: 'CASCADE'})- Account: Awaited<AccountModel>+ declare Account: Awaited<AccountModel>@HasMany(() => VideoCommentAbuseModel, {foreignKey: {@@ -223,13 +223,13 @@ export class VideoCommentModel extends SequelizeModel<VideoCommentModel> {},onDelete: 'set null'})- CommentAbuses: Awaited<VideoCommentAbuseModel>[]+ declare CommentAbuses: Awaited<VideoCommentAbuseModel>[]@HasMany(() => CommentAutomaticTagModel, {foreignKey: 'commentId',onDelete: 'CASCADE'})- CommentAutomaticTags: Awaited<CommentAutomaticTagModel>[]+ declare CommentAutomaticTags: Awaited<CommentAutomaticTagModel>[]@AfterCreate@AfterDestroydiff --git a/server/core/models/video/video-file.ts b/server/core/models/video/video-file.tsindex 2e9ce534fb..3da015762a 100644--- a/server/core/models/video/video-file.ts+++ b/server/core/models/video/video-file.ts@@ -12,11 +12,7 @@ import { logger } from '@server/helpers/logger.js'import { extractVideo } from '@server/helpers/video.js'import { CONFIG } from '@server/initializers/config.js'import { buildRemoteUrl } from '@server/lib/activitypub/url.js'-import {- getHLSPrivateFileUrl,- getObjectStoragePublicFileUrl,- getWebVideoPrivateFileUrl-} from '@server/lib/object-storage/index.js'+import { getHLSPrivateFileUrl, getObjectStoragePublicFileUrl, getWebVideoPrivateFileUrl } from '@server/lib/object-storage/index.js'import { getFSTorrentFilePath } from '@server/lib/paths.js'import { getVideoFileMimeType } from '@server/lib/video-file.js'import { isVideoInPrivateDirectory } from '@server/lib/video-privacy.js'@@ -34,7 +30,8 @@ import {Default,DefaultScope,ForeignKey,- Is, Scopes,+ Is,+ Scopes,Table,UpdatedAt} from 'sequelize-typescript'@@ -46,14 +43,7 @@ import {isVideoFileResolutionValid,isVideoFileSizeValid} from '../../helpers/custom-validators/videos.js'-import {- DOWNLOAD_PATHS,- LAZY_STATIC_PATHS,- MEMOIZE_LENGTH,- MEMOIZE_TTL,- STATIC_PATHS,- WEBSERVER-} from '../../initializers/constants.js'+import { DOWNLOAD_PATHS, LAZY_STATIC_PATHS, MEMOIZE_LENGTH, MEMOIZE_TTL, STATIC_PATHS, WEBSERVER } from '../../initializers/constants.js'import { MVideoFile, MVideoFileStreamingPlaylistVideo, MVideoFileVideo } from '../../types/models/video/video-file.js'import { SequelizeModel, doesExist, parseAggregateResult, throwIfNotValid } from '../shared/index.js'import { VideoStreamingPlaylistModel } from './video-streaming-playlist.js'@@ -146,89 +136,89 @@ export enum ScopeNames {})export class VideoFileModel extends SequelizeModel<VideoFileModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@AllowNull(false)@Is('VideoFileResolution', value => throwIfNotValid(value, isVideoFileResolutionValid, 'resolution'))@Column- resolution: number+ declare resolution: number@AllowNull(true)@Column- width: number+ declare width: number@AllowNull(true)@Column- height: number+ declare height: number@AllowNull(false)@Is('VideoFileSize', value => throwIfNotValid(value, isVideoFileSizeValid, 'size'))@Column(DataType.BIGINT)- size: number+ declare size: number@AllowNull(false)@Is('VideoFileExtname', value => throwIfNotValid(value, isVideoFileExtnameValid, 'extname'))@Column- extname: string+ declare extname: string@AllowNull(true)@Is('VideoFileInfohash', value => throwIfNotValid(value, isVideoFileInfoHashValid, 'info hash', true))@Column- infoHash: string+ declare infoHash: string@AllowNull(false)@Default(-1)@Is('VideoFileFPS', value => throwIfNotValid(value, isVideoFPSResolutionValid, 'fps'))@Column- fps: number+ declare fps: number@AllowNull(false)@Column- formatFlags: VideoFileFormatFlagType+ declare formatFlags: VideoFileFormatFlagType@AllowNull(false)@Column- streams: VideoFileStreamType+ declare streams: VideoFileStreamType@AllowNull(true)@Column(DataType.JSONB)- metadata: any+ declare metadata: any@AllowNull(true)@Column- metadataUrl: string+ declare metadataUrl: string// Could be null for remote files@AllowNull(true)@Column- fileUrl: string+ declare fileUrl: string// Could be null for live files@AllowNull(true)@Column- filename: string+ declare filename: string// Could be null for remote files@AllowNull(true)@Column- torrentUrl: string+ declare torrentUrl: string// Could be null for live files@AllowNull(true)@Column- torrentFilename: string+ declare torrentFilename: string@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@AllowNull(false)@Default(FileStorage.FILE_SYSTEM)@Column- storage: FileStorageType+ declare storage: FileStorageType@BelongsTo(() => VideoModel, {foreignKey: {@@ -236,11 +226,11 @@ export class VideoFileModel extends SequelizeModel<VideoFileModel> {},onDelete: 'CASCADE'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>@ForeignKey(() => VideoStreamingPlaylistModel)@Column- videoStreamingPlaylistId: number+ declare videoStreamingPlaylistId: number@BelongsTo(() => VideoStreamingPlaylistModel, {foreignKey: {@@ -248,7 +238,7 @@ export class VideoFileModel extends SequelizeModel<VideoFileModel> {},onDelete: 'CASCADE'})- VideoStreamingPlaylist: Awaited<VideoStreamingPlaylistModel>+ declare VideoStreamingPlaylist: Awaited<VideoStreamingPlaylistModel>static doesInfohashExistCached = memoizee(VideoFileModel.doesInfohashExist.bind(VideoFileModel), {promise: true,@@ -270,10 +260,10 @@ export class VideoFileModel extends SequelizeModel<VideoFileModel> {static async doesOwnedTorrentFileExist (filename: string) {const query = 'SELECT 1 FROM "videoFile" ' +- 'LEFT JOIN "video" "webvideo" ON "webvideo"."id" = "videoFile"."videoId" AND "webvideo"."remote" IS FALSE ' +- 'LEFT JOIN "videoStreamingPlaylist" ON "videoStreamingPlaylist"."id" = "videoFile"."videoStreamingPlaylistId" ' +- 'LEFT JOIN "video" "hlsVideo" ON "hlsVideo"."id" = "videoStreamingPlaylist"."videoId" AND "hlsVideo"."remote" IS FALSE ' +- 'WHERE "torrentFilename" = $filename AND ("hlsVideo"."id" IS NOT NULL OR "webvideo"."id" IS NOT NULL) LIMIT 1'+ 'LEFT JOIN "video" "webvideo" ON "webvideo"."id" = "videoFile"."videoId" AND "webvideo"."remote" IS FALSE ' ++ 'LEFT JOIN "videoStreamingPlaylist" ON "videoStreamingPlaylist"."id" = "videoFile"."videoStreamingPlaylistId" ' ++ 'LEFT JOIN "video" "hlsVideo" ON "hlsVideo"."id" = "videoStreamingPlaylist"."videoId" AND "hlsVideo"."remote" IS FALSE ' ++ 'WHERE "torrentFilename" = $filename AND ("hlsVideo"."id" IS NOT NULL OR "webvideo"."id" IS NOT NULL) LIMIT 1'return doesExist({ sequelize: this.sequelize, query, bind: { filename } })}diff --git a/server/core/models/video/video-import.ts b/server/core/models/video/video-import.tsindex 830f03a997..4d366fc580 100644--- a/server/core/models/video/video-import.ts+++ b/server/core/models/video/video-import.ts@@ -62,42 +62,42 @@ const defaultVideoScope = () => {})export class VideoImportModel extends SequelizeModel<VideoImportModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@AllowNull(true)@Default(null)@Is('VideoImportTargetUrl', value => throwIfNotValid(value, isVideoImportTargetUrlValid, 'targetUrl', true))@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_IMPORTS.URL.max))- targetUrl: string+ declare targetUrl: string@AllowNull(true)@Default(null)@Is('VideoImportMagnetUri', value => throwIfNotValid(value, isVideoMagnetUriValid, 'magnetUri', true))@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_IMPORTS.URL.max)) // Use the same constraints than URLs- magnetUri: string+ declare magnetUri: string@AllowNull(true)@Default(null)@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_IMPORTS.TORRENT_NAME.max))- torrentName: string+ declare torrentName: string@AllowNull(false)@Default(null)@Is('VideoImportState', value => throwIfNotValid(value, isVideoImportStateValid, 'state'))@Column- state: VideoImportStateType+ declare state: VideoImportStateType@AllowNull(true)@Default(null)@Column(DataType.TEXT)- error: string+ declare error: string@ForeignKey(() => UserModel)@Column- userId: number+ declare userId: number@BelongsTo(() => UserModel, {foreignKey: {@@ -105,11 +105,11 @@ export class VideoImportModel extends SequelizeModel<VideoImportModel> {},onDelete: 'cascade'})- User: Awaited<UserModel>+ declare User: Awaited<UserModel>@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@BelongsTo(() => VideoModel, {foreignKey: {@@ -117,11 +117,11 @@ export class VideoImportModel extends SequelizeModel<VideoImportModel> {},onDelete: 'set null'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>@ForeignKey(() => VideoChannelSyncModel)@Column- videoChannelSyncId: number+ declare videoChannelSyncId: number@BelongsTo(() => VideoChannelSyncModel, {foreignKey: {@@ -129,7 +129,7 @@ export class VideoImportModel extends SequelizeModel<VideoImportModel> {},onDelete: 'set null'})- VideoChannelSync: Awaited<VideoChannelSyncModel>+ declare VideoChannelSync: Awaited<VideoChannelSyncModel>@AfterUpdatestatic deleteVideoIfFailed (instance: VideoImportModel, options) {diff --git a/server/core/models/video/video-job-info.ts b/server/core/models/video/video-job-info.tsindex 042ccf29cf..910fc8f002 100644--- a/server/core/models/video/video-job-info.ts+++ b/server/core/models/video/video-job-info.ts@@ -21,33 +21,33 @@ export type VideoJobInfoColumnType = 'pendingMove' | 'pendingTranscode' | 'pendi})export class VideoJobInfoModel extends SequelizeModel<VideoJobInfoModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@AllowNull(false)@Default(0)@IsInt@Column- pendingMove: number+ declare pendingMove: number@AllowNull(false)@Default(0)@IsInt@Column- pendingTranscode: number+ declare pendingTranscode: number@AllowNull(false)@Default(0)@IsInt@Column- pendingTranscription: number+ declare pendingTranscription: number@ForeignKey(() => VideoModel)@Unique@Column- videoId: number+ declare videoId: number@BelongsTo(() => VideoModel, {foreignKey: {@@ -55,7 +55,7 @@ export class VideoJobInfoModel extends SequelizeModel<VideoJobInfoModel> {},onDelete: 'cascade'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>static load (videoId: number, transaction?: Transaction) {const where = {diff --git a/server/core/models/video/video-live-replay-setting.ts b/server/core/models/video/video-live-replay-setting.tsindex 9999b7d034..0b7903a4d3 100644--- a/server/core/models/video/video-live-replay-setting.ts+++ b/server/core/models/video/video-live-replay-setting.ts@@ -10,17 +10,16 @@ import { SequelizeModel } from '../shared/index.js'tableName: 'videoLiveReplaySetting'})export class VideoLiveReplaySettingModel extends SequelizeModel<VideoLiveReplaySettingModel> {-@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@AllowNull(false)@Is('VideoPrivacy', value => throwIfNotValid(value, isVideoPrivacyValid, 'privacy'))@Column- privacy: VideoPrivacyType+ declare privacy: VideoPrivacyTypestatic load (id: number, transaction?: Transaction): Promise<MLiveReplaySetting> {return VideoLiveReplaySettingModel.findOne({diff --git a/server/core/models/video/video-live-session.ts b/server/core/models/video/video-live-session.tsindex cd3bb356b8..ffd09eb4a1 100644--- a/server/core/models/video/video-live-session.ts+++ b/server/core/models/video/video-live-session.ts@@ -56,34 +56,34 @@ export enum ScopeNames {})export class VideoLiveSessionModel extends SequelizeModel<VideoLiveSessionModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@AllowNull(false)@Column(DataType.DATE)- startDate: Date+ declare startDate: Date@AllowNull(true)@Column(DataType.DATE)- endDate: Date+ declare endDate: Date@AllowNull(true)@Column- error: LiveVideoErrorType+ declare error: LiveVideoErrorType@AllowNull(false)@Column- saveReplay: boolean+ declare saveReplay: boolean@AllowNull(false)@Column- endingProcessed: boolean+ declare endingProcessed: boolean@ForeignKey(() => VideoModel)@Column- replayVideoId: number+ declare replayVideoId: number@BelongsTo(() => VideoModel, {foreignKey: {@@ -93,11 +93,11 @@ export class VideoLiveSessionModel extends SequelizeModel<VideoLiveSessionModel>as: 'ReplayVideo',onDelete: 'set null'})- ReplayVideo: Awaited<VideoModel>+ declare ReplayVideo: Awaited<VideoModel>@ForeignKey(() => VideoModel)@Column- liveVideoId: number+ declare liveVideoId: number@BelongsTo(() => VideoModel, {foreignKey: {@@ -107,11 +107,11 @@ export class VideoLiveSessionModel extends SequelizeModel<VideoLiveSessionModel>as: 'LiveVideo',onDelete: 'set null'})- LiveVideo: Awaited<VideoModel>+ declare LiveVideo: Awaited<VideoModel>@ForeignKey(() => VideoLiveReplaySettingModel)@Column- replaySettingId: number+ declare replaySettingId: number@BelongsTo(() => VideoLiveReplaySettingModel, {foreignKey: {@@ -119,7 +119,7 @@ export class VideoLiveSessionModel extends SequelizeModel<VideoLiveSessionModel>},onDelete: 'set null'})- ReplaySetting: Awaited<VideoLiveReplaySettingModel>+ declare ReplaySetting: Awaited<VideoLiveReplaySettingModel>@BeforeDestroystatic deleteReplaySetting (instance: VideoLiveSessionModel) {diff --git a/server/core/models/video/video-live.ts b/server/core/models/video/video-live.tsindex a18e4a6cc1..09ebda51d8 100644--- a/server/core/models/video/video-live.ts+++ b/server/core/models/video/video-live.ts@@ -11,7 +11,8 @@ import {CreatedAt,DataType,DefaultScope,- ForeignKey, Table,+ ForeignKey,+ Table,UpdatedAt} from 'sequelize-typescript'import { VideoBlacklistModel } from './video-blacklist.js'@@ -51,32 +52,31 @@ import { SequelizeModel } from '../shared/index.js']})export class VideoLiveModel extends SequelizeModel<VideoLiveModel> {-@AllowNull(true)@Column(DataType.STRING)- streamKey: string+ declare streamKey: string@AllowNull(false)@Column- saveReplay: boolean+ declare saveReplay: boolean@AllowNull(false)@Column- permanentLive: boolean+ declare permanentLive: boolean@AllowNull(false)@Column- latencyMode: LiveVideoLatencyModeType+ declare latencyMode: LiveVideoLatencyModeType@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@BelongsTo(() => VideoModel, {foreignKey: {@@ -84,11 +84,11 @@ export class VideoLiveModel extends SequelizeModel<VideoLiveModel> {},onDelete: 'cascade'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>@ForeignKey(() => VideoLiveReplaySettingModel)@Column- replaySettingId: number+ declare replaySettingId: number@BelongsTo(() => VideoLiveReplaySettingModel, {foreignKey: {@@ -96,7 +96,7 @@ export class VideoLiveModel extends SequelizeModel<VideoLiveModel> {},onDelete: 'set null'})- ReplaySetting: Awaited<VideoLiveReplaySettingModel>+ declare ReplaySetting: Awaited<VideoLiveReplaySettingModel>@BeforeDestroystatic deleteReplaySetting (instance: VideoLiveModel, options: { transaction: Transaction }) {diff --git a/server/core/models/video/video-password.ts b/server/core/models/video/video-password.tsindex 7812701eaa..d4636f13f4 100644--- a/server/core/models/video/video-password.ts+++ b/server/core/models/video/video-password.ts@@ -25,21 +25,20 @@ import { pick } from '@peertube/peertube-core-utils']})export class VideoPasswordModel extends SequelizeModel<VideoPasswordModel> {-@AllowNull(false)@Is('VideoPassword', value => throwIfNotValid(value, isPasswordValid, 'videoPassword'))@Column- password: string+ declare password: string@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@BelongsTo(() => VideoModel, {foreignKey: {@@ -47,7 +46,7 @@ export class VideoPasswordModel extends SequelizeModel<VideoPasswordModel> {},onDelete: 'cascade'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>static async countByVideoId (videoId: number, t?: Transaction) {const query = {diff --git a/server/core/models/video/video-playlist-element.ts b/server/core/models/video/video-playlist-element.tsindex dfee5cc319..329d184c9b 100644--- a/server/core/models/video/video-playlist-element.ts+++ b/server/core/models/video/video-playlist-element.ts@@ -55,38 +55,38 @@ import { ForAPIOptions, VideoModel, ScopeNames as VideoScopeNames } from './vide})export class VideoPlaylistElementModel extends SequelizeModel<VideoPlaylistElementModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@AllowNull(true)@Is('VideoPlaylistUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url', true))@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_PLAYLISTS.URL.max))- url: string+ declare url: string@AllowNull(false)@Default(1)@IsInt@Min(1)@Column- position: number+ declare position: number@AllowNull(true)@IsInt@Min(0)@Column- startTimestamp: number+ declare startTimestamp: number@AllowNull(true)@IsInt@Min(0)@Column- stopTimestamp: number+ declare stopTimestamp: number@ForeignKey(() => VideoPlaylistModel)@Column- videoPlaylistId: number+ declare videoPlaylistId: number@BelongsTo(() => VideoPlaylistModel, {foreignKey: {@@ -94,11 +94,11 @@ export class VideoPlaylistElementModel extends SequelizeModel<VideoPlaylistEleme},onDelete: 'CASCADE'})- VideoPlaylist: Awaited<VideoPlaylistModel>+ declare VideoPlaylist: Awaited<VideoPlaylistModel>@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@BelongsTo(() => VideoModel, {foreignKey: {@@ -106,7 +106,7 @@ export class VideoPlaylistElementModel extends SequelizeModel<VideoPlaylistEleme},onDelete: 'set null'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>static deleteAllOf (videoPlaylistId: number, transaction?: Transaction) {const query = {diff --git a/server/core/models/video/video-playlist.ts b/server/core/models/video/video-playlist.tsindex 9875b7cb3a..6afdaded21 100644--- a/server/core/models/video/video-playlist.ts+++ b/server/core/models/video/video-playlist.ts@@ -291,49 +291,49 @@ function getVideoLengthSelect () {})export class VideoPlaylistModel extends SequelizeModel<VideoPlaylistModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@AllowNull(false)@Is('VideoPlaylistName', value => throwIfNotValid(value, isVideoPlaylistNameValid, 'name'))@Column- name: string+ declare name: string@AllowNull(true)@Is('VideoPlaylistDescription', value => throwIfNotValid(value, isVideoPlaylistDescriptionValid, 'description', true))@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_PLAYLISTS.DESCRIPTION.max))- description: string+ declare description: string@AllowNull(false)@Is('VideoPlaylistPrivacy', value => throwIfNotValid(value, isVideoPlaylistPrivacyValid, 'privacy'))@Column- privacy: VideoPlaylistPrivacyType+ declare privacy: VideoPlaylistPrivacyType@AllowNull(false)@Is('VideoPlaylistUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_PLAYLISTS.URL.max))- url: string+ declare url: string@AllowNull(false)@Default(DataType.UUIDV4)@IsUUID(4)@Column(DataType.UUID)- uuid: string+ declare uuid: string@AllowNull(false)@Default(VideoPlaylistType.REGULAR)@Column- type: VideoPlaylistType_Type+ declare type: VideoPlaylistType_Type@AllowNull(true)@Column- videoChannelPosition: number+ declare videoChannelPosition: number@ForeignKey(() => AccountModel)@Column- ownerAccountId: number+ declare ownerAccountId: number@BelongsTo(() => AccountModel, {foreignKey: {@@ -341,11 +341,11 @@ export class VideoPlaylistModel extends SequelizeModel<VideoPlaylistModel> {},onDelete: 'CASCADE'})- OwnerAccount: Awaited<AccountModel>+ declare OwnerAccount: Awaited<AccountModel>@ForeignKey(() => VideoChannelModel)@Column- videoChannelId: number+ declare videoChannelId: number@BelongsTo(() => VideoChannelModel, {foreignKey: {@@ -353,7 +353,7 @@ export class VideoPlaylistModel extends SequelizeModel<VideoPlaylistModel> {},onDelete: 'CASCADE'})- VideoChannel: Awaited<VideoChannelModel>+ declare VideoChannel: Awaited<VideoChannelModel>@HasMany(() => VideoPlaylistElementModel, {foreignKey: {@@ -362,7 +362,7 @@ export class VideoPlaylistModel extends SequelizeModel<VideoPlaylistModel> {},onDelete: 'CASCADE'})- VideoPlaylistElements: Awaited<VideoPlaylistElementModel>[]+ declare VideoPlaylistElements: Awaited<VideoPlaylistElementModel>[]@HasOne(() => ThumbnailModel, {foreignKey: {@@ -372,7 +372,7 @@ export class VideoPlaylistModel extends SequelizeModel<VideoPlaylistModel> {onDelete: 'CASCADE',hooks: true})- Thumbnail: Awaited<ThumbnailModel>+ declare Thumbnail: Awaited<ThumbnailModel>static listForApi (options: AvailableForListOptions & {diff --git a/server/core/models/video/video-share.ts b/server/core/models/video/video-share.tsindex be367595ca..029f308fe9 100644--- a/server/core/models/video/video-share.ts+++ b/server/core/models/video/video-share.ts@@ -52,21 +52,20 @@ enum ScopeNames {]})export class VideoShareModel extends SequelizeModel<VideoShareModel> {-@AllowNull(false)@Is('VideoShareUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_SHARE.URL.max))- url: string+ declare url: string@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => ActorModel)@Column- actorId: number+ declare actorId: number@BelongsTo(() => ActorModel, {foreignKey: {@@ -74,11 +73,11 @@ export class VideoShareModel extends SequelizeModel<VideoShareModel> {},onDelete: 'cascade'})- Actor: Awaited<ActorModel>+ declare Actor: Awaited<ActorModel>@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@BelongsTo(() => VideoModel, {foreignKey: {@@ -86,7 +85,7 @@ export class VideoShareModel extends SequelizeModel<VideoShareModel> {},onDelete: 'cascade'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>static load (actorId: number | string, videoId: number | string, t?: Transaction): Promise<MVideoShareActor> {return VideoShareModel.scope(ScopeNames.WITH_ACTOR).findOne({@@ -109,9 +108,9 @@ export class VideoShareModel extends SequelizeModel<VideoShareModel> {static listActorIdsAndFollowerUrlsByShare (videoId: number, t: Transaction) {const query = `SELECT "actor"."id" AS "id", "actor"."followersUrl" AS "followersUrl" ` +- `FROM "videoShare" ` +- `INNER JOIN "actor" ON "actor"."id" = "videoShare"."actorId" ` +- `WHERE "videoShare"."videoId" = :videoId`+ `FROM "videoShare" ` ++ `INNER JOIN "actor" ON "actor"."id" = "videoShare"."actorId" ` ++ `WHERE "videoShare"."videoId" = :videoId`const options = {type: QueryTypes.SELECT as QueryTypes.SELECT,@@ -131,13 +130,13 @@ export class VideoShareModel extends SequelizeModel<VideoShareModel> {[Op.and]: [literal(`EXISTS (` +- ` SELECT 1 FROM "videoShare" ` +- ` INNER JOIN "video" ON "videoShare"."videoId" = "video"."id" ` +- ` INNER JOIN "videoChannel" ON "videoChannel"."id" = "video"."channelId" ` +- ` INNER JOIN "account" ON "account"."id" = "videoChannel"."accountId" ` +- ` WHERE "videoShare"."actorId" = "ActorModel"."id" AND "account"."actorId" = ${safeOwnerId} ` +- ` LIMIT 1` +- `)`+ ` SELECT 1 FROM "videoShare" ` ++ ` INNER JOIN "video" ON "videoShare"."videoId" = "video"."id" ` ++ ` INNER JOIN "videoChannel" ON "videoChannel"."id" = "video"."channelId" ` ++ ` INNER JOIN "account" ON "account"."id" = "videoChannel"."accountId" ` ++ ` WHERE "videoShare"."actorId" = "ActorModel"."id" AND "account"."actorId" = ${safeOwnerId} ` ++ ` LIMIT 1` ++ `)`)]},@@ -156,11 +155,11 @@ export class VideoShareModel extends SequelizeModel<VideoShareModel> {[Op.and]: [literal(`EXISTS (` +- ` SELECT 1 FROM "videoShare" ` +- ` INNER JOIN "video" ON "videoShare"."videoId" = "video"."id" ` +- ` WHERE "videoShare"."actorId" = "ActorModel"."id" AND "video"."channelId" = ${safeChannelId} ` +- ` LIMIT 1` +- `)`+ ` SELECT 1 FROM "videoShare" ` ++ ` INNER JOIN "video" ON "videoShare"."videoId" = "video"."id" ` ++ ` WHERE "videoShare"."actorId" = "ActorModel"."id" AND "video"."channelId" = ${safeChannelId} ` ++ ` LIMIT 1` ++ `)`)]},diff --git a/server/core/models/video/video-source.ts b/server/core/models/video/video-source.tsindex de809322f8..61af15e2d1 100644--- a/server/core/models/video/video-source.ts+++ b/server/core/models/video/video-source.ts@@ -26,54 +26,54 @@ import { VideoModel } from './video.js'})export class VideoSourceModel extends SequelizeModel<VideoSourceModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@AllowNull(false)@Column- inputFilename: string+ declare inputFilename: string@AllowNull(true)@Column- keptOriginalFilename: string+ declare keptOriginalFilename: string@AllowNull(true)@Column- resolution: number+ declare resolution: number@AllowNull(true)@Column- width: number+ declare width: number@AllowNull(true)@Column- height: number+ declare height: number@AllowNull(true)@Column- fps: number+ declare fps: number@AllowNull(true)@Column(DataType.BIGINT)- size: number+ declare size: number@AllowNull(true)@Column(DataType.JSONB)- metadata: any+ declare metadata: any@AllowNull(true)@Column- storage: FileStorageType+ declare storage: FileStorageType@AllowNull(true)@Column- fileUrl: string+ declare fileUrl: string@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@BelongsTo(() => VideoModel, {foreignKey: {@@ -81,7 +81,7 @@ export class VideoSourceModel extends SequelizeModel<VideoSourceModel> {},onDelete: 'cascade'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>static loadLatest (videoId: number, transaction?: Transaction) {return VideoSourceModel.findOne<MVideoSource>({diff --git a/server/core/models/video/video-streaming-playlist.ts b/server/core/models/video/video-streaming-playlist.tsindex 802993819f..bd78566970 100644--- a/server/core/models/video/video-streaming-playlist.ts+++ b/server/core/models/video/video-streaming-playlist.ts@@ -56,48 +56,48 @@ import { VideoModel } from './video.js'})export class VideoStreamingPlaylistModel extends SequelizeModel<VideoStreamingPlaylistModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@AllowNull(false)@Column- type: VideoStreamingPlaylistType_Type+ declare type: VideoStreamingPlaylistType_Type@AllowNull(false)@Column- playlistFilename: string+ declare playlistFilename: string@AllowNull(true)@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS.URL.max))- playlistUrl: string+ declare playlistUrl: string@AllowNull(false)@Is('VideoStreamingPlaylistInfoHashes', value => throwIfNotValid(value, v => isArrayOf(v, isVideoFileInfoHashValid), 'info hashes'))@Column(DataType.ARRAY(DataType.STRING))- p2pMediaLoaderInfohashes: string[]+ declare p2pMediaLoaderInfohashes: string[]@AllowNull(false)@Column- p2pMediaLoaderPeerVersion: number+ declare p2pMediaLoaderPeerVersion: number@AllowNull(true)@Column- segmentsSha256Filename: string+ declare segmentsSha256Filename: string@AllowNull(true)@Column- segmentsSha256Url: string+ declare segmentsSha256Url: string@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@AllowNull(false)@Default(FileStorage.FILE_SYSTEM)@Column- storage: FileStorageType+ declare storage: FileStorageType@BelongsTo(() => VideoModel, {foreignKey: {@@ -105,7 +105,7 @@ export class VideoStreamingPlaylistModel extends SequelizeModel<VideoStreamingPl},onDelete: 'CASCADE'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>@HasMany(() => VideoFileModel, {foreignKey: {@@ -113,7 +113,7 @@ export class VideoStreamingPlaylistModel extends SequelizeModel<VideoStreamingPl},onDelete: 'CASCADE'})- VideoFiles: Awaited<VideoFileModel>[]+ declare VideoFiles: Awaited<VideoFileModel>[]@HasMany(() => VideoRedundancyModel, {foreignKey: {@@ -122,7 +122,7 @@ export class VideoStreamingPlaylistModel extends SequelizeModel<VideoStreamingPlonDelete: 'CASCADE',hooks: true})- RedundancyVideos: Awaited<VideoRedundancyModel>[]+ declare RedundancyVideos: Awaited<VideoRedundancyModel>[]static doesInfohashExistCached = memoizee(VideoStreamingPlaylistModel.doesInfohashExist.bind(VideoStreamingPlaylistModel), {promise: true,diff --git a/server/core/models/video/video-tag.ts b/server/core/models/video/video-tag.tsindex 1b5540d2b4..5ed543873a 100644--- a/server/core/models/video/video-tag.ts+++ b/server/core/models/video/video-tag.ts@@ -16,16 +16,16 @@ import { SequelizeModel } from '../shared/index.js'})export class VideoTagModel extends SequelizeModel<VideoTagModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@ForeignKey(() => TagModel)@Column- tagId: number+ declare tagId: number}diff --git a/server/core/models/video/video.ts b/server/core/models/video/video.tsindex 953e5aa2a9..864cc62f8b 100644--- a/server/core/models/video/video.ts+++ b/server/core/models/video/video.ts@@ -439,156 +439,156 @@ export class VideoModel extends SequelizeModel<VideoModel> {@Default(DataType.UUIDV4)@IsUUID(4)@Column(DataType.UUID)- uuid: string+ declare uuid: string@AllowNull(false)@Is('VideoName', value => throwIfNotValid(value, isVideoNameValid, 'name'))@Column- name: string+ declare name: string@AllowNull(true)@Default(null)@Column- category: number+ declare category: number@AllowNull(true)@Default(null)@Column- licence: number+ declare licence: number@AllowNull(true)@Default(null)@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS.LANGUAGE.max))- language: string+ declare language: string@AllowNull(false)@Is('VideoPrivacy', value => throwIfNotValid(value, isVideoPrivacyValid, 'privacy'))@Column(DataType.INTEGER)- privacy: VideoPrivacyType+ declare privacy: VideoPrivacyType@AllowNull(false)@Is('VideoNSFW', value => throwIfNotValid(value, isBooleanValid, 'NSFW boolean'))@Column- nsfw: boolean+ declare nsfw: boolean@AllowNull(false)@Default(0)@Is('VideoNSFWFlags', value => throwIfNotValid(value, isNSFWFlagsValid, 'NSFW flags'))@Column- nsfwFlags: number // NSFWFlagType+ declare nsfwFlags: number // NSFWFlagType@AllowNull(true)@Default(null)@Is('VideoNSFWSummary', value => throwIfNotValid(value, isNSFWSummaryValid, 'NSFW summary'))@Column- nsfwSummary: string+ declare nsfwSummary: string@AllowNull(true)@Default(null)@Is('VideoDescription', value => throwIfNotValid(value, isVideoDescriptionValid, 'description', true))@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS.DESCRIPTION.max))- description: string+ declare description: string@AllowNull(true)@Default(null)@Is('VideoSupport', value => throwIfNotValid(value, isVideoSupportValid, 'support', true))@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS.SUPPORT.max))- support: string+ declare support: string@AllowNull(false)@Is('VideoDuration', value => throwIfNotValid(value, isVideoDurationValid, 'duration'))@Column- duration: number+ declare duration: number@AllowNull(false)@Default(0)@IsInt@Min(0)@Column- views: number+ declare views: number@AllowNull(false)@Default(0)@IsInt@Min(0)@Column- likes: number+ declare likes: number@AllowNull(false)@Default(0)@IsInt@Min(0)@Column- dislikes: number+ declare dislikes: number@AllowNull(false)@Default(0)@IsInt@Min(0)@Column- comments: number+ declare comments: number@AllowNull(false)@Column- remote: boolean+ declare remote: boolean@AllowNull(false)@Default(false)@Column- isLive: boolean+ declare isLive: boolean@AllowNull(false)@Is('VideoUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS.URL.max))- url: string+ declare url: string@AllowNull(false)@Column- commentsPolicy: VideoCommentPolicyType+ declare commentsPolicy: VideoCommentPolicyType@AllowNull(false)@Column- downloadEnabled: boolean+ declare downloadEnabled: boolean@AllowNull(false)@Column- waitTranscoding: boolean+ declare waitTranscoding: boolean@AllowNull(false)@Default(null)@Is('VideoState', value => throwIfNotValid(value, isVideoStateValid, 'state'))@Column- state: VideoStateType+ declare state: VideoStateType@AllowNull(true)@Column(DataType.FLOAT)- aspectRatio: number+ declare aspectRatio: number// We already have the information in videoSource table for local videos, but we prefer to normalize it for performance// And also to store the info from remote instances@AllowNull(true)@Column- inputFileUpdatedAt: Date+ declare inputFileUpdatedAt: Date@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@AllowNull(false)@Default(DataType.NOW)@Column- publishedAt: Date+ declare publishedAt: Date@AllowNull(true)@Default(null)@Column- originallyPublishedAt: Date+ declare originallyPublishedAt: Date@ForeignKey(() => VideoChannelModel)@Column- channelId: number+ declare channelId: number@BelongsTo(() => VideoChannelModel, {foreignKey: {@@ -596,21 +596,21 @@ export class VideoModel extends SequelizeModel<VideoModel> {},onDelete: 'cascade'})- VideoChannel: Awaited<VideoChannelModel>+ declare VideoChannel: Awaited<VideoChannelModel>@BelongsToMany(() => TagModel, {foreignKey: 'videoId',through: () => VideoTagModel,onDelete: 'CASCADE'})- Tags: Awaited<TagModel>[]+ declare Tags: Awaited<TagModel>[]@BelongsToMany(() => TrackerModel, {foreignKey: 'videoId',through: () => VideoTrackerModel,onDelete: 'CASCADE'})- Trackers: Awaited<TrackerModel>[]+ declare Trackers: Awaited<TrackerModel>[]@HasMany(() => ThumbnailModel, {foreignKey: {@@ -620,7 +620,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {hooks: true,onDelete: 'cascade'})- Thumbnails: Awaited<ThumbnailModel>[]+ declare Thumbnails: Awaited<ThumbnailModel>[]@HasMany(() => VideoPlaylistElementModel, {foreignKey: {@@ -629,7 +629,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {},onDelete: 'set null'})- VideoPlaylistElements: Awaited<VideoPlaylistElementModel>[]+ declare VideoPlaylistElements: Awaited<VideoPlaylistElementModel>[]@HasOne(() => VideoSourceModel, {foreignKey: {@@ -638,7 +638,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {},onDelete: 'CASCADE'})- VideoSource: Awaited<VideoSourceModel>+ declare VideoSource: Awaited<VideoSourceModel>@HasMany(() => VideoAbuseModel, {foreignKey: {@@ -647,7 +647,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {},onDelete: 'set null'})- VideoAbuses: Awaited<VideoAbuseModel>[]+ declare VideoAbuses: Awaited<VideoAbuseModel>[]@HasMany(() => VideoFileModel, {foreignKey: {@@ -656,7 +656,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {},onDelete: 'cascade'})- VideoFiles: Awaited<VideoFileModel>[]+ declare VideoFiles: Awaited<VideoFileModel>[]@HasMany(() => VideoStreamingPlaylistModel, {foreignKey: {@@ -665,7 +665,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {},onDelete: 'cascade'})- VideoStreamingPlaylists: Awaited<VideoStreamingPlaylistModel>[]+ declare VideoStreamingPlaylists: Awaited<VideoStreamingPlaylistModel>[]@HasMany(() => VideoShareModel, {foreignKey: {@@ -674,7 +674,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {},onDelete: 'cascade'})- VideoShares: Awaited<VideoShareModel>[]+ declare VideoShares: Awaited<VideoShareModel>[]@HasMany(() => AccountVideoRateModel, {foreignKey: {@@ -683,7 +683,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {},onDelete: 'cascade'})- AccountVideoRates: Awaited<AccountVideoRateModel>[]+ declare AccountVideoRates: Awaited<AccountVideoRateModel>[]@HasMany(() => VideoCommentModel, {foreignKey: {@@ -693,7 +693,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {onDelete: 'cascade',hooks: true})- VideoComments: Awaited<VideoCommentModel>[]+ declare VideoComments: Awaited<VideoCommentModel>[]@HasMany(() => VideoViewModel, {foreignKey: {@@ -702,7 +702,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {},onDelete: 'cascade'})- VideoViews: Awaited<VideoViewModel>[]+ declare VideoViews: Awaited<VideoViewModel>[]@HasMany(() => UserVideoHistoryModel, {foreignKey: {@@ -711,7 +711,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {},onDelete: 'cascade'})- UserVideoHistories: Awaited<UserVideoHistoryModel>[]+ declare UserVideoHistories: Awaited<UserVideoHistoryModel>[]@HasOne(() => ScheduleVideoUpdateModel, {foreignKey: {@@ -720,7 +720,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {},onDelete: 'cascade'})- ScheduleVideoUpdate: Awaited<ScheduleVideoUpdateModel>+ declare ScheduleVideoUpdate: Awaited<ScheduleVideoUpdateModel>@HasOne(() => VideoBlacklistModel, {foreignKey: {@@ -729,7 +729,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {},onDelete: 'cascade'})- VideoBlacklist: Awaited<VideoBlacklistModel>+ declare VideoBlacklist: Awaited<VideoBlacklistModel>@HasOne(() => VideoLiveModel, {foreignKey: {@@ -739,7 +739,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {hooks: true,onDelete: 'cascade'})- VideoLive: Awaited<VideoLiveModel>+ declare VideoLive: Awaited<VideoLiveModel>@HasOne(() => VideoImportModel, {foreignKey: {@@ -748,7 +748,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {},onDelete: 'set null'})- VideoImport: Awaited<VideoImportModel>+ declare VideoImport: Awaited<VideoImportModel>@HasMany(() => VideoCaptionModel, {foreignKey: {@@ -759,7 +759,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {hooks: true,['separate' as any]: true})- VideoCaptions: Awaited<VideoCaptionModel>[]+ declare VideoCaptions: Awaited<VideoCaptionModel>[]@HasMany(() => VideoPasswordModel, {foreignKey: {@@ -768,13 +768,13 @@ export class VideoModel extends SequelizeModel<VideoModel> {},onDelete: 'cascade'})- VideoPasswords: Awaited<VideoPasswordModel>[]+ declare VideoPasswords: Awaited<VideoPasswordModel>[]@HasMany(() => VideoAutomaticTagModel, {foreignKey: 'videoId',onDelete: 'CASCADE'})- VideoAutomaticTags: Awaited<VideoAutomaticTagModel>[]+ declare VideoAutomaticTags: Awaited<VideoAutomaticTagModel>[]@HasOne(() => VideoJobInfoModel, {foreignKey: {@@ -783,7 +783,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {},onDelete: 'cascade'})- VideoJobInfo: Awaited<VideoJobInfoModel>+ declare VideoJobInfo: Awaited<VideoJobInfoModel>@HasOne(() => StoryboardModel, {foreignKey: {@@ -793,7 +793,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {onDelete: 'cascade',hooks: true})- Storyboard: Awaited<StoryboardModel>+ declare Storyboard: Awaited<StoryboardModel>@AfterCreatestatic notifyCreate (video: MVideo) {diff --git a/server/core/models/view/local-video-viewer-watch-section.ts b/server/core/models/view/local-video-viewer-watch-section.tsindex ae7f83bcaa..821c85d8ad 100644--- a/server/core/models/view/local-video-viewer-watch-section.ts+++ b/server/core/models/view/local-video-viewer-watch-section.ts@@ -15,19 +15,19 @@ import { LocalVideoViewerModel } from './local-video-viewer.js'})export class LocalVideoViewerWatchSectionModel extends SequelizeModel<LocalVideoViewerWatchSectionModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@AllowNull(false)@Column- watchStart: number+ declare watchStart: number@AllowNull(false)@Column- watchEnd: number+ declare watchEnd: number@ForeignKey(() => LocalVideoViewerModel)@Column- localVideoViewerId: number+ declare localVideoViewerId: number@BelongsTo(() => LocalVideoViewerModel, {foreignKey: {@@ -35,7 +35,7 @@ export class LocalVideoViewerWatchSectionModel extends SequelizeModel<LocalVideo},onDelete: 'CASCADE'})- LocalVideoViewer: Awaited<LocalVideoViewerModel>+ declare LocalVideoViewer: Awaited<LocalVideoViewerModel>static async bulkCreateSections (options: {localVideoViewerId: numberdiff --git a/server/core/models/view/local-video-viewer.ts b/server/core/models/view/local-video-viewer.tsindex feaa818d5c..fa39f7e344 100644--- a/server/core/models/view/local-video-viewer.ts+++ b/server/core/models/view/local-video-viewer.ts@@ -35,53 +35,53 @@ import { LocalVideoViewerWatchSectionModel } from './local-video-viewer-watch-se})export class LocalVideoViewerModel extends SequelizeModel<LocalVideoViewerModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@AllowNull(false)@Column(DataType.DATE)- startDate: Date+ declare startDate: Date@AllowNull(false)@Column(DataType.DATE)- endDate: Date+ declare endDate: Date@AllowNull(false)@Column- watchTime: number+ declare watchTime: number@AllowNull(true)@Column- client: string+ declare client: string@AllowNull(true)@Column- device: string+ declare device: string@AllowNull(true)@Column- operatingSystem: string+ declare operatingSystem: string@AllowNull(true)@Column- country: string+ declare country: string@AllowNull(true)@Column- subdivisionName: string+ declare subdivisionName: string@AllowNull(false)@Default(DataType.UUIDV4)@IsUUID(4)@Column(DataType.UUID)- uuid: string+ declare uuid: string@AllowNull(false)@Column- url: string+ declare url: string@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@BelongsTo(() => VideoModel, {foreignKey: {@@ -89,7 +89,7 @@ export class LocalVideoViewerModel extends SequelizeModel<LocalVideoViewerModel>},onDelete: 'CASCADE'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>@HasMany(() => LocalVideoViewerWatchSectionModel, {foreignKey: {@@ -97,7 +97,7 @@ export class LocalVideoViewerModel extends SequelizeModel<LocalVideoViewerModel>},onDelete: 'cascade'})- WatchSections: Awaited<LocalVideoViewerWatchSectionModel>[]+ declare WatchSections: Awaited<LocalVideoViewerWatchSectionModel>[]static loadByUrl (url: string): Promise<MLocalVideoViewer> {return this.findOne({diff --git a/server/core/models/view/video-view.ts b/server/core/models/view/video-view.tsindex f19b103d2c..c4239b1d6b 100644--- a/server/core/models/view/video-view.ts+++ b/server/core/models/view/video-view.ts@@ -4,10 +4,8 @@ import { VideoModel } from '../video/video.js'import { SequelizeModel } from '../shared/index.js'/**- ** Aggregate views of all videos federated with our instance* Mainly used by the trending/hot algorithms- **/@Table({@@ -24,23 +22,23 @@ import { SequelizeModel } from '../shared/index.js'})export class VideoViewModel extends SequelizeModel<VideoViewModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@AllowNull(false)@Column(DataType.DATE)- startDate: Date+ declare startDate: Date@AllowNull(false)@Column(DataType.DATE)- endDate: Date+ declare endDate: Date@AllowNull(false)@Column- views: number+ declare views: number@ForeignKey(() => VideoModel)@Column- videoId: number+ declare videoId: number@BelongsTo(() => VideoModel, {foreignKey: {@@ -48,7 +46,7 @@ export class VideoViewModel extends SequelizeModel<VideoViewModel> {},onDelete: 'CASCADE'})- Video: Awaited<VideoModel>+ declare Video: Awaited<VideoModel>static removeOldRemoteViewsHistory (beforeDate: string) {const query = {diff --git a/server/core/models/watched-words/watched-words-list.ts b/server/core/models/watched-words/watched-words-list.tsindex c579e50f4d..8ef567e049 100644--- a/server/core/models/watched-words/watched-words-list.ts+++ b/server/core/models/watched-words/watched-words-list.ts@@ -4,14 +4,7 @@ import { wordsToRegExp } from '@server/helpers/regexp.js'import { MAccountId, MWatchedWordsList } from '@server/types/models/index.js'import { LRUCache } from 'lru-cache'import { Transaction } from 'sequelize'-import {- AllowNull,- BelongsTo,- Column,- CreatedAt,- DataType, ForeignKey, Table,- UpdatedAt-} from 'sequelize-typescript'+import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Table, UpdatedAt } from 'sequelize-typescript'import { LRU_CACHE, USER_EXPORT_MAX_ITEMS } from '../../initializers/constants.js'import { AccountModel } from '../account/account.js'import { SequelizeModel, getSort } from '../shared/index.js'@@ -30,22 +23,22 @@ import { SequelizeModel, getSort } from '../shared/index.js'})export class WatchedWordsListModel extends SequelizeModel<WatchedWordsListModel> {@CreatedAt- createdAt: Date+ declare createdAt: Date@UpdatedAt- updatedAt: Date+ declare updatedAt: Date@AllowNull(false)@Column- listName: string+ declare listName: string@AllowNull(false)@Column(DataType.ARRAY(DataType.STRING))- words: string[]+ declare words: string[]@ForeignKey(() => AccountModel)@Column- accountId: number+ declare accountId: number@BelongsTo(() => AccountModel, {foreignKey: {@@ -53,7 +46,7 @@ export class WatchedWordsListModel extends SequelizeModel<WatchedWordsListModel>},onDelete: 'CASCADE'})- Account: Awaited<AccountModel>+ declare Account: Awaited<AccountModel>// accountId => reg expressionsprivate static readonly regexCache = new LRUCache<number, { listName: string, regex: RegExp }[]>({diff --git a/server/core/types/express.d.ts b/server/core/types/express.d.tsindex 91240eba47..d649a48cae 100644--- a/server/core/types/express.d.ts+++ b/server/core/types/express.d.ts@@ -1,4 +1,11 @@-import { HttpMethodType, PeerTubeProblemDocumentData, ServerErrorCodeType, ServerLogLevel, VideoCreate } from '@peertube/peertube-models'+import {+ HttpMethodType,+ HttpStatusCodeType,+ PeerTubeProblemDocumentData,+ ServerErrorCodeType,+ ServerLogLevel,+ VideoCreate+} from '@peertube/peertube-models'import { RegisterServerAuthExternalOptions } from '@server/types/index.js'import {MAbuseMessage,@@ -107,7 +114,7 @@ declare module 'express' {message: stringtitle?: string- status?: number+ status?: HttpStatusCodeTypetype?: ServerErrorCodeTypeinstance?: stringdiff --git a/tsconfig.base.json b/tsconfig.base.jsonindex 9ccf78d511..f3e8e9e976 100644--- a/tsconfig.base.json+++ b/tsconfig.base.json@@ -1,7 +1,7 @@{"compilerOptions": {"module": "NodeNext",- "target": "ES2017",+ "target": "ES2022","noImplicitAny": false,"sourceMap": true,"experimentalDecorators": true,@@ -17,7 +17,10 @@"es2016","es2017","es2018",- "es2019"+ "es2019",+ "es2020",+ "es2021",+ "es2022"],"resolveJsonModule": true,"strict": false,