mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 19:42:24 +02:00
Better thumbnail error handling
* Had to upgrade to es2022 to use `cause` error * Had to declare class attributes with declare for sequelize models, so it still works as before
This commit is contained in:
parent
29a88c0dde
commit
13bceb5f40
77 changed files with 919 additions and 912 deletions
|
@ -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 { AfterViewInit, Component, ElementRef, OnDestroy, OnInit, inject, input, output, viewChild } from '@angular/core'
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
|
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 { 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 { 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 { 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 { NgbTooltip } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { UserVideoQuota, VideoPrivacyType } from '@peertube/peertube-models'
|
import { UserVideoQuota, VideoPrivacyType } from '@peertube/peertube-models'
|
||||||
import debug from 'debug'
|
import debug from 'debug'
|
||||||
|
@ -29,7 +29,7 @@ const debugLogger = debug('peertube:video-publish')
|
||||||
'./video-upload.component.scss'
|
'./video-upload.component.scss'
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
NgIf,
|
CommonModule,
|
||||||
DragDropDirective,
|
DragDropDirective,
|
||||||
GlobalIconComponent,
|
GlobalIconComponent,
|
||||||
NgbTooltip,
|
NgbTooltip,
|
||||||
|
@ -49,8 +49,6 @@ export class VideoUploadComponent implements OnInit, OnDestroy, AfterViewInit, C
|
||||||
private route = inject(ActivatedRoute)
|
private route = inject(ActivatedRoute)
|
||||||
private videoUploadService = inject(VideoUploadService)
|
private videoUploadService = inject(VideoUploadService)
|
||||||
private manageController = inject(VideoManageController)
|
private manageController = inject(VideoManageController)
|
||||||
private router = inject(Router)
|
|
||||||
private canDeactivateGuard = inject(CanDeactivateGuard)
|
|
||||||
|
|
||||||
readonly userChannels = input.required<SelectChannelItem[]>()
|
readonly userChannels = input.required<SelectChannelItem[]>()
|
||||||
readonly userQuota = input.required<UserVideoQuota>()
|
readonly userQuota = input.required<UserVideoQuota>()
|
||||||
|
@ -167,6 +165,7 @@ export class VideoUploadComponent implements OnInit, OnDestroy, AfterViewInit, C
|
||||||
this.firstStep = true
|
this.firstStep = true
|
||||||
this.videoEdit = undefined
|
this.videoEdit = undefined
|
||||||
this.uploadingAudioFile = false
|
this.uploadingAudioFile = false
|
||||||
|
this.audioPreviewFile = undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadAudio () {
|
uploadAudio () {
|
||||||
|
|
|
@ -29,7 +29,11 @@ export function getUploadXRetryConfig () {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function buildHTTPErrorResponse (state: UploadState): HttpErrorResponse {
|
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 {
|
return {
|
||||||
error: new Error(error),
|
error: new Error(error),
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
export * from './file-storage.enum.js'
|
export * from './file-storage.enum.js'
|
||||||
|
export * from './peertube-error.model.js'
|
||||||
export * from './result-list.model.js'
|
export * from './result-list.model.js'
|
||||||
export * from './simple-logger.model.js'
|
export * from './simple-logger.model.js'
|
||||||
|
|
26
packages/models/src/common/peertube-error.model.ts
Normal file
26
packages/models/src/common/peertube-error.model.ts
Normal file
|
@ -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
|
||||||
|
}
|
|
@ -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 {
|
import {
|
||||||
HttpStatusCode,
|
HttpStatusCode,
|
||||||
|
HttpStatusCodeType,
|
||||||
ServerErrorCode,
|
ServerErrorCode,
|
||||||
ThumbnailType,
|
ThumbnailType,
|
||||||
VideoImportCreate,
|
VideoImportCreate,
|
||||||
VideoImportPayload,
|
VideoImportPayload,
|
||||||
VideoImportState
|
VideoImportState
|
||||||
} from '@peertube/peertube-models'
|
} 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 { auditLoggerFactory, getAuditIdFromRes, VideoImportAuditView } from '../../../helpers/audit-logger.js'
|
||||||
import { isArray } from '../../../helpers/custom-validators/misc.js'
|
import { isArray } from '../../../helpers/custom-validators/misc.js'
|
||||||
import { cleanUpReqFiles, createReqFiles } from '../../../helpers/express-utils.js'
|
import { cleanUpReqFiles, createReqFiles } from '../../../helpers/express-utils.js'
|
||||||
|
@ -40,20 +41,23 @@ const reqVideoFileImport = createReqFiles(
|
||||||
{ ...MIMETYPES.TORRENT.MIMETYPE_EXT, ...MIMETYPES.IMAGE.MIMETYPE_EXT }
|
{ ...MIMETYPES.TORRENT.MIMETYPE_EXT, ...MIMETYPES.IMAGE.MIMETYPE_EXT }
|
||||||
)
|
)
|
||||||
|
|
||||||
videoImportsRouter.post('/imports',
|
videoImportsRouter.post(
|
||||||
|
'/imports',
|
||||||
authenticate,
|
authenticate,
|
||||||
reqVideoFileImport,
|
reqVideoFileImport,
|
||||||
asyncMiddleware(videoImportAddValidator),
|
asyncMiddleware(videoImportAddValidator),
|
||||||
asyncRetryTransactionMiddleware(handleVideoImport)
|
asyncRetryTransactionMiddleware(handleVideoImport)
|
||||||
)
|
)
|
||||||
|
|
||||||
videoImportsRouter.post('/imports/:id/cancel',
|
videoImportsRouter.post(
|
||||||
|
'/imports/:id/cancel',
|
||||||
authenticate,
|
authenticate,
|
||||||
asyncMiddleware(videoImportCancelValidator),
|
asyncMiddleware(videoImportCancelValidator),
|
||||||
asyncRetryTransactionMiddleware(cancelVideoImport)
|
asyncRetryTransactionMiddleware(cancelVideoImport)
|
||||||
)
|
)
|
||||||
|
|
||||||
videoImportsRouter.delete('/imports/:id',
|
videoImportsRouter.delete(
|
||||||
|
'/imports/:id',
|
||||||
authenticate,
|
authenticate,
|
||||||
asyncMiddleware(videoImportDeleteValidator),
|
asyncMiddleware(videoImportDeleteValidator),
|
||||||
asyncRetryTransactionMiddleware(deleteVideoImport)
|
asyncRetryTransactionMiddleware(deleteVideoImport)
|
||||||
|
@ -152,7 +156,7 @@ async function handleTorrentImport (req: express.Request, res: express.Response,
|
||||||
return res.json(videoImport.toFormattedJSON()).end()
|
return res.json(videoImport.toFormattedJSON()).end()
|
||||||
}
|
}
|
||||||
|
|
||||||
function statusFromYtDlImportError (err: YoutubeDlImportError): number {
|
function statusFromYtDlImportError (err: YoutubeDlImportError): HttpStatusCodeType {
|
||||||
switch (err.code) {
|
switch (err.code) {
|
||||||
case YoutubeDlImportError.CODE.NOT_ONLY_UNICAST_URL:
|
case YoutubeDlImportError.CODE.NOT_ONLY_UNICAST_URL:
|
||||||
return HttpStatusCode.FORBIDDEN_403
|
return HttpStatusCode.FORBIDDEN_403
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { ffprobePromise, getChaptersFromContainer } from '@peertube/peertube-ffmpeg'
|
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 { uuidToShort } from '@peertube/peertube-node-utils'
|
||||||
import { getResumableUploadPath } from '@server/helpers/upload.js'
|
import { getResumableUploadPath } from '@server/helpers/upload.js'
|
||||||
import { LocalVideoCreator } from '@server/lib/local-video-creator.js'
|
import { LocalVideoCreator } from '@server/lib/local-video-creator.js'
|
||||||
|
@ -38,7 +38,8 @@ const reqVideoFileAddResumable = createReqFiles(
|
||||||
getResumableUploadPath()
|
getResumableUploadPath()
|
||||||
)
|
)
|
||||||
|
|
||||||
uploadRouter.post('/upload',
|
uploadRouter.post(
|
||||||
|
'/upload',
|
||||||
openapiOperationDoc({ operationId: 'uploadLegacy' }),
|
openapiOperationDoc({ operationId: 'uploadLegacy' }),
|
||||||
authenticate,
|
authenticate,
|
||||||
setReqTimeout(1000 * 60 * 10), // Uploading the video could be long
|
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.metadata
|
const videoInfo = videoPhysicalFile.metadata
|
||||||
const files = { previewfile: videoInfo.previewfile, thumbnailfile: videoInfo.thumbnailfile }
|
const files = { previewfile: videoInfo.previewfile, thumbnailfile: videoInfo.thumbnailfile }
|
||||||
|
|
||||||
|
try {
|
||||||
const response = await addVideo({ req, res, videoPhysicalFile, videoInfo, files })
|
const response = await addVideo({ req, res, videoPhysicalFile, videoInfo, files })
|
||||||
await Redis.Instance.deleteUploadSession(req.query.upload_id)
|
|
||||||
await uploadx.storage.delete(res.locals.uploadVideoFileResumable)
|
|
||||||
|
|
||||||
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: {
|
async function addVideo (options: {
|
||||||
|
@ -157,6 +161,7 @@ async function addVideo (options: {
|
||||||
thumbnails
|
thumbnails
|
||||||
})
|
})
|
||||||
|
|
||||||
|
try {
|
||||||
const { video } = await localVideoCreator.create()
|
const { video } = await localVideoCreator.create()
|
||||||
|
|
||||||
auditLogger.create(getAuditIdFromRes(res), new VideoAuditView(video.toFormattedDetailsJSON()))
|
auditLogger.create(getAuditIdFromRes(res), new VideoAuditView(video.toFormattedDetailsJSON()))
|
||||||
|
@ -171,6 +176,17 @@ async function addVideo (options: {
|
||||||
uuid: 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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteUploadResumableCache (req: express.Request, res: express.Response, next: express.NextFunction) {
|
async function deleteUploadResumableCache (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ import {
|
||||||
LiveVideoCreate,
|
LiveVideoCreate,
|
||||||
LiveVideoLatencyMode,
|
LiveVideoLatencyMode,
|
||||||
NSFWFlag,
|
NSFWFlag,
|
||||||
|
PeerTubeError,
|
||||||
ThumbnailType,
|
ThumbnailType,
|
||||||
ThumbnailType_Type,
|
ThumbnailType_Type,
|
||||||
VideoCreate,
|
VideoCreate,
|
||||||
|
@ -258,6 +259,9 @@ export class LocalVideoCreator {
|
||||||
type,
|
type,
|
||||||
automaticallyGenerated: thumbnail.automaticallyGenerated || false,
|
automaticallyGenerated: thumbnail.automaticallyGenerated || false,
|
||||||
keepOriginal: thumbnail.keepOriginal
|
keepOriginal: thumbnail.keepOriginal
|
||||||
|
}).catch(err => {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/only-throw-error
|
||||||
|
throw PeerTubeError.fromError(err, 'INVALID_IMAGE_FILE')
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -19,25 +19,24 @@ import { AbuseModel } from './abuse.js'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AbuseMessageModel extends SequelizeModel<AbuseMessageModel> {
|
export class AbuseMessageModel extends SequelizeModel<AbuseMessageModel> {
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('AbuseMessage', value => throwIfNotValid(value, isAbuseMessageValid, 'message'))
|
@Is('AbuseMessage', value => throwIfNotValid(value, isAbuseMessageValid, 'message'))
|
||||||
@Column(DataType.TEXT)
|
@Column(DataType.TEXT)
|
||||||
message: string
|
declare message: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
byModerator: boolean
|
declare byModerator: boolean
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => AccountModel)
|
@ForeignKey(() => AccountModel)
|
||||||
@Column
|
@Column
|
||||||
accountId: number
|
declare accountId: number
|
||||||
|
|
||||||
@BelongsTo(() => AccountModel, {
|
@BelongsTo(() => AccountModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -46,11 +45,11 @@ export class AbuseMessageModel extends SequelizeModel<AbuseMessageModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'set null'
|
onDelete: 'set null'
|
||||||
})
|
})
|
||||||
Account: Awaited<AccountModel>
|
declare Account: Awaited<AccountModel>
|
||||||
|
|
||||||
@ForeignKey(() => AbuseModel)
|
@ForeignKey(() => AbuseModel)
|
||||||
@Column
|
@Column
|
||||||
abuseId: number
|
declare abuseId: number
|
||||||
|
|
||||||
@BelongsTo(() => AbuseModel, {
|
@BelongsTo(() => AbuseModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -59,7 +58,7 @@ export class AbuseMessageModel extends SequelizeModel<AbuseMessageModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Abuse: Awaited<AbuseModel>
|
declare Abuse: Awaited<AbuseModel>
|
||||||
|
|
||||||
static listForApi (abuseId: number) {
|
static listForApi (abuseId: number) {
|
||||||
const getQuery = (forCount: boolean) => {
|
const getQuery = (forCount: boolean) => {
|
||||||
|
|
|
@ -200,38 +200,38 @@ export class AbuseModel extends SequelizeModel<AbuseModel> {
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Is('AbuseReason', value => throwIfNotValid(value, isAbuseReasonValid, 'reason'))
|
@Is('AbuseReason', value => throwIfNotValid(value, isAbuseReasonValid, 'reason'))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ABUSES.REASON.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ABUSES.REASON.max))
|
||||||
reason: string
|
declare reason: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Is('AbuseState', value => throwIfNotValid(value, isAbuseStateValid, 'state'))
|
@Is('AbuseState', value => throwIfNotValid(value, isAbuseStateValid, 'state'))
|
||||||
@Column
|
@Column
|
||||||
state: AbuseStateType
|
declare state: AbuseStateType
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Is('AbuseModerationComment', value => throwIfNotValid(value, isAbuseModerationCommentValid, 'moderationComment', true))
|
@Is('AbuseModerationComment', value => throwIfNotValid(value, isAbuseModerationCommentValid, 'moderationComment', true))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ABUSES.MODERATION_COMMENT.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ABUSES.MODERATION_COMMENT.max))
|
||||||
moderationComment: string
|
declare moderationComment: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Column(DataType.ARRAY(DataType.INTEGER))
|
@Column(DataType.ARRAY(DataType.INTEGER))
|
||||||
predefinedReasons: AbusePredefinedReasonsType[]
|
declare predefinedReasons: AbusePredefinedReasonsType[]
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
processedAt: Date
|
declare processedAt: Date
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => AccountModel)
|
@ForeignKey(() => AccountModel)
|
||||||
@Column
|
@Column
|
||||||
reporterAccountId: number
|
declare reporterAccountId: number
|
||||||
|
|
||||||
@BelongsTo(() => AccountModel, {
|
@BelongsTo(() => AccountModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -241,11 +241,11 @@ export class AbuseModel extends SequelizeModel<AbuseModel> {
|
||||||
as: 'ReporterAccount',
|
as: 'ReporterAccount',
|
||||||
onDelete: 'set null'
|
onDelete: 'set null'
|
||||||
})
|
})
|
||||||
ReporterAccount: Awaited<AccountModel>
|
declare ReporterAccount: Awaited<AccountModel>
|
||||||
|
|
||||||
@ForeignKey(() => AccountModel)
|
@ForeignKey(() => AccountModel)
|
||||||
@Column
|
@Column
|
||||||
flaggedAccountId: number
|
declare flaggedAccountId: number
|
||||||
|
|
||||||
@BelongsTo(() => AccountModel, {
|
@BelongsTo(() => AccountModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -255,7 +255,7 @@ export class AbuseModel extends SequelizeModel<AbuseModel> {
|
||||||
as: 'FlaggedAccount',
|
as: 'FlaggedAccount',
|
||||||
onDelete: 'set null'
|
onDelete: 'set null'
|
||||||
})
|
})
|
||||||
FlaggedAccount: Awaited<AccountModel>
|
declare FlaggedAccount: Awaited<AccountModel>
|
||||||
|
|
||||||
@HasOne(() => VideoCommentAbuseModel, {
|
@HasOne(() => VideoCommentAbuseModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -264,7 +264,7 @@ export class AbuseModel extends SequelizeModel<AbuseModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
VideoCommentAbuse: Awaited<VideoCommentAbuseModel>
|
declare VideoCommentAbuse: Awaited<VideoCommentAbuseModel>
|
||||||
|
|
||||||
@HasOne(() => VideoAbuseModel, {
|
@HasOne(() => VideoAbuseModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -273,7 +273,7 @@ export class AbuseModel extends SequelizeModel<AbuseModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
VideoAbuse: Awaited<VideoAbuseModel>
|
declare VideoAbuse: Awaited<VideoAbuseModel>
|
||||||
|
|
||||||
static loadByIdWithReporter (id: number): Promise<MAbuseReporter> {
|
static loadByIdWithReporter (id: number): Promise<MAbuseReporter> {
|
||||||
const query = {
|
const query = {
|
||||||
|
|
|
@ -16,31 +16,30 @@ import { SequelizeModel } from '../shared/index.js'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class VideoAbuseModel extends SequelizeModel<VideoAbuseModel> {
|
export class VideoAbuseModel extends SequelizeModel<VideoAbuseModel> {
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Column
|
@Column
|
||||||
startAt: number
|
declare startAt: number
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Column
|
@Column
|
||||||
endAt: number
|
declare endAt: number
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Column(DataType.JSONB)
|
@Column(DataType.JSONB)
|
||||||
deletedVideo: VideoDetails
|
declare deletedVideo: VideoDetails
|
||||||
|
|
||||||
@ForeignKey(() => AbuseModel)
|
@ForeignKey(() => AbuseModel)
|
||||||
@Column
|
@Column
|
||||||
abuseId: number
|
declare abuseId: number
|
||||||
|
|
||||||
@BelongsTo(() => AbuseModel, {
|
@BelongsTo(() => AbuseModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -48,11 +47,11 @@ export class VideoAbuseModel extends SequelizeModel<VideoAbuseModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Abuse: Awaited<AbuseModel>
|
declare Abuse: Awaited<AbuseModel>
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -60,5 +59,5 @@ export class VideoAbuseModel extends SequelizeModel<VideoAbuseModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'set null'
|
onDelete: 'set null'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,16 +15,15 @@ import { SequelizeModel } from '../shared/index.js'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class VideoCommentAbuseModel extends SequelizeModel<VideoCommentAbuseModel> {
|
export class VideoCommentAbuseModel extends SequelizeModel<VideoCommentAbuseModel> {
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => AbuseModel)
|
@ForeignKey(() => AbuseModel)
|
||||||
@Column
|
@Column
|
||||||
abuseId: number
|
declare abuseId: number
|
||||||
|
|
||||||
@BelongsTo(() => AbuseModel, {
|
@BelongsTo(() => AbuseModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -32,11 +31,11 @@ export class VideoCommentAbuseModel extends SequelizeModel<VideoCommentAbuseMode
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Abuse: Awaited<AbuseModel>
|
declare Abuse: Awaited<AbuseModel>
|
||||||
|
|
||||||
@ForeignKey(() => VideoCommentModel)
|
@ForeignKey(() => VideoCommentModel)
|
||||||
@Column
|
@Column
|
||||||
videoCommentId: number
|
declare videoCommentId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoCommentModel, {
|
@BelongsTo(() => VideoCommentModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -44,5 +43,5 @@ export class VideoCommentAbuseModel extends SequelizeModel<VideoCommentAbuseMode
|
||||||
},
|
},
|
||||||
onDelete: 'set null'
|
onDelete: 'set null'
|
||||||
})
|
})
|
||||||
VideoComment: Awaited<VideoCommentModel>
|
declare VideoComment: Awaited<VideoCommentModel>
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,16 +22,15 @@ import { WEBSERVER } from '@server/initializers/constants.js'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AccountBlocklistModel extends SequelizeModel<AccountBlocklistModel> {
|
export class AccountBlocklistModel extends SequelizeModel<AccountBlocklistModel> {
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => AccountModel)
|
@ForeignKey(() => AccountModel)
|
||||||
@Column
|
@Column
|
||||||
accountId: number
|
declare accountId: number
|
||||||
|
|
||||||
@BelongsTo(() => AccountModel, {
|
@BelongsTo(() => AccountModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -41,11 +40,11 @@ export class AccountBlocklistModel extends SequelizeModel<AccountBlocklistModel>
|
||||||
as: 'ByAccount',
|
as: 'ByAccount',
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
ByAccount: Awaited<AccountModel>
|
declare ByAccount: Awaited<AccountModel>
|
||||||
|
|
||||||
@ForeignKey(() => AccountModel)
|
@ForeignKey(() => AccountModel)
|
||||||
@Column
|
@Column
|
||||||
targetAccountId: number
|
declare targetAccountId: number
|
||||||
|
|
||||||
@BelongsTo(() => AccountModel, {
|
@BelongsTo(() => AccountModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -55,7 +54,7 @@ export class AccountBlocklistModel extends SequelizeModel<AccountBlocklistModel>
|
||||||
as: 'BlockedAccount',
|
as: 'BlockedAccount',
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
BlockedAccount: Awaited<AccountModel>
|
declare BlockedAccount: Awaited<AccountModel>
|
||||||
|
|
||||||
static isAccountMutedByAccounts (accountIds: number[], targetAccountId: number) {
|
static isAccountMutedByAccounts (accountIds: number[], targetAccountId: number) {
|
||||||
const query = {
|
const query = {
|
||||||
|
@ -206,7 +205,7 @@ export class AccountBlocklistModel extends SequelizeModel<AccountBlocklistModel>
|
||||||
.map(h => h.name)
|
.map(h => h.name)
|
||||||
|
|
||||||
const remoteHandles = sanitizedHandles.filter(h => !!h.host)
|
const remoteHandles = sanitizedHandles.filter(h => !!h.host)
|
||||||
.map(h => ([ h.name, h.host ]))
|
.map(h => [ h.name, h.host ])
|
||||||
|
|
||||||
const handlesWhere: string[] = []
|
const handlesWhere: string[] = []
|
||||||
|
|
||||||
|
|
|
@ -42,25 +42,24 @@ import { AccountModel } from './account.js'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AccountVideoRateModel extends SequelizeModel<AccountVideoRateModel> {
|
export class AccountVideoRateModel extends SequelizeModel<AccountVideoRateModel> {
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column(DataType.ENUM(...Object.values(VIDEO_RATE_TYPES)))
|
@Column(DataType.ENUM(...Object.values(VIDEO_RATE_TYPES)))
|
||||||
type: VideoRateType
|
declare type: VideoRateType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('AccountVideoRateUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))
|
@Is('AccountVideoRateUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_RATES.URL.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_RATES.URL.max))
|
||||||
url: string
|
declare url: string
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -68,11 +67,11 @@ export class AccountVideoRateModel extends SequelizeModel<AccountVideoRateModel>
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
|
|
||||||
@ForeignKey(() => AccountModel)
|
@ForeignKey(() => AccountModel)
|
||||||
@Column
|
@Column
|
||||||
accountId: number
|
declare accountId: number
|
||||||
|
|
||||||
@BelongsTo(() => AccountModel, {
|
@BelongsTo(() => AccountModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -80,7 +79,7 @@ export class AccountVideoRateModel extends SequelizeModel<AccountVideoRateModel>
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
Account: Awaited<AccountModel>
|
declare Account: Awaited<AccountModel>
|
||||||
|
|
||||||
static load (accountId: number, videoId: number, transaction?: Transaction): Promise<MAccountVideoRate> {
|
static load (accountId: number, videoId: number, transaction?: Transaction): Promise<MAccountVideoRate> {
|
||||||
const options: FindOptions = {
|
const options: FindOptions = {
|
||||||
|
|
|
@ -151,23 +151,23 @@ export type SummaryOptions = {
|
||||||
export class AccountModel extends SequelizeModel<AccountModel> {
|
export class AccountModel extends SequelizeModel<AccountModel> {
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
name: string
|
declare name: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Is('AccountDescription', value => throwIfNotValid(value, isAccountDescriptionValid, 'description', true))
|
@Is('AccountDescription', value => throwIfNotValid(value, isAccountDescriptionValid, 'description', true))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.USERS.DESCRIPTION.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.USERS.DESCRIPTION.max))
|
||||||
description: string
|
declare description: string
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => ActorModel)
|
@ForeignKey(() => ActorModel)
|
||||||
@Column
|
@Column
|
||||||
actorId: number
|
declare actorId: number
|
||||||
|
|
||||||
@BelongsTo(() => ActorModel, {
|
@BelongsTo(() => ActorModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -175,11 +175,11 @@ export class AccountModel extends SequelizeModel<AccountModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Actor: Awaited<ActorModel>
|
declare Actor: Awaited<ActorModel>
|
||||||
|
|
||||||
@ForeignKey(() => UserModel)
|
@ForeignKey(() => UserModel)
|
||||||
@Column
|
@Column
|
||||||
userId: number
|
declare userId: number
|
||||||
|
|
||||||
@BelongsTo(() => UserModel, {
|
@BelongsTo(() => UserModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -187,11 +187,11 @@ export class AccountModel extends SequelizeModel<AccountModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
User: Awaited<UserModel>
|
declare User: Awaited<UserModel>
|
||||||
|
|
||||||
@ForeignKey(() => ApplicationModel)
|
@ForeignKey(() => ApplicationModel)
|
||||||
@Column
|
@Column
|
||||||
applicationId: number
|
declare applicationId: number
|
||||||
|
|
||||||
@BelongsTo(() => ApplicationModel, {
|
@BelongsTo(() => ApplicationModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -199,7 +199,7 @@ export class AccountModel extends SequelizeModel<AccountModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Application: Awaited<ApplicationModel>
|
declare Application: Awaited<ApplicationModel>
|
||||||
|
|
||||||
@HasMany(() => VideoChannelModel, {
|
@HasMany(() => VideoChannelModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -208,7 +208,7 @@ export class AccountModel extends SequelizeModel<AccountModel> {
|
||||||
onDelete: 'cascade',
|
onDelete: 'cascade',
|
||||||
hooks: true
|
hooks: true
|
||||||
})
|
})
|
||||||
VideoChannels: Awaited<VideoChannelModel>[]
|
declare VideoChannels: Awaited<VideoChannelModel>[]
|
||||||
|
|
||||||
@HasMany(() => VideoPlaylistModel, {
|
@HasMany(() => VideoPlaylistModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -217,7 +217,7 @@ export class AccountModel extends SequelizeModel<AccountModel> {
|
||||||
onDelete: 'cascade',
|
onDelete: 'cascade',
|
||||||
hooks: true
|
hooks: true
|
||||||
})
|
})
|
||||||
VideoPlaylists: Awaited<VideoPlaylistModel>[]
|
declare VideoPlaylists: Awaited<VideoPlaylistModel>[]
|
||||||
|
|
||||||
@HasMany(() => VideoCommentModel, {
|
@HasMany(() => VideoCommentModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -226,7 +226,7 @@ export class AccountModel extends SequelizeModel<AccountModel> {
|
||||||
onDelete: 'cascade',
|
onDelete: 'cascade',
|
||||||
hooks: true
|
hooks: true
|
||||||
})
|
})
|
||||||
VideoComments: Awaited<VideoCommentModel>[]
|
declare VideoComments: Awaited<VideoCommentModel>[]
|
||||||
|
|
||||||
@HasMany(() => AccountBlocklistModel, {
|
@HasMany(() => AccountBlocklistModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -236,7 +236,7 @@ export class AccountModel extends SequelizeModel<AccountModel> {
|
||||||
as: 'BlockedBy',
|
as: 'BlockedBy',
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
BlockedBy: Awaited<AccountBlocklistModel>[]
|
declare BlockedBy: Awaited<AccountBlocklistModel>[]
|
||||||
|
|
||||||
@HasMany(() => AccountAutomaticTagPolicyModel, {
|
@HasMany(() => AccountAutomaticTagPolicyModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -245,19 +245,19 @@ export class AccountModel extends SequelizeModel<AccountModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
AccountAutomaticTagPolicies: Awaited<AccountAutomaticTagPolicyModel>[]
|
declare AccountAutomaticTagPolicies: Awaited<AccountAutomaticTagPolicyModel>[]
|
||||||
|
|
||||||
@HasMany(() => CommentAutomaticTagModel, {
|
@HasMany(() => CommentAutomaticTagModel, {
|
||||||
foreignKey: 'accountId',
|
foreignKey: 'accountId',
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
CommentAutomaticTags: Awaited<CommentAutomaticTagModel>[]
|
declare CommentAutomaticTags: Awaited<CommentAutomaticTagModel>[]
|
||||||
|
|
||||||
@HasMany(() => VideoAutomaticTagModel, {
|
@HasMany(() => VideoAutomaticTagModel, {
|
||||||
foreignKey: 'accountId',
|
foreignKey: 'accountId',
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
VideoAutomaticTags: Awaited<VideoAutomaticTagModel>[]
|
declare VideoAutomaticTags: Awaited<VideoAutomaticTagModel>[]
|
||||||
|
|
||||||
@BeforeDestroy
|
@BeforeDestroy
|
||||||
static async sendDeleteIfOwned (instance: AccountModel, options) {
|
static async sendDeleteIfOwned (instance: AccountModel, options) {
|
||||||
|
|
|
@ -14,24 +14,23 @@ import { SequelizeModel } from '../shared/index.js'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class ActorCustomPageModel extends SequelizeModel<ActorCustomPageModel> {
|
export class ActorCustomPageModel extends SequelizeModel<ActorCustomPageModel> {
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column(DataType.TEXT)
|
@Column(DataType.TEXT)
|
||||||
content: string
|
declare content: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
type: 'homepage'
|
declare type: 'homepage'
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => ActorModel)
|
@ForeignKey(() => ActorModel)
|
||||||
@Column
|
@Column
|
||||||
actorId: number
|
declare actorId: number
|
||||||
|
|
||||||
@BelongsTo(() => ActorModel, {
|
@BelongsTo(() => ActorModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -40,7 +39,7 @@ export class ActorCustomPageModel extends SequelizeModel<ActorCustomPageModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Actor: Awaited<ActorModel>
|
declare Actor: Awaited<ActorModel>
|
||||||
|
|
||||||
static async updateInstanceHomepage (content: string) {
|
static async updateInstanceHomepage (content: string) {
|
||||||
const serverActor = await getServerActor()
|
const serverActor = await getServerActor()
|
||||||
|
|
|
@ -73,30 +73,30 @@ import { InstanceListFollowingQueryBuilder, ListFollowingOptions } from './sql/i
|
||||||
export class ActorFollowModel extends SequelizeModel<ActorFollowModel> {
|
export class ActorFollowModel extends SequelizeModel<ActorFollowModel> {
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column(DataType.ENUM(...Object.values(FOLLOW_STATES)))
|
@Column(DataType.ENUM(...Object.values(FOLLOW_STATES)))
|
||||||
state: FollowState
|
declare state: FollowState
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(ACTOR_FOLLOW_SCORE.BASE)
|
@Default(ACTOR_FOLLOW_SCORE.BASE)
|
||||||
@IsInt
|
@IsInt
|
||||||
@Max(ACTOR_FOLLOW_SCORE.MAX)
|
@Max(ACTOR_FOLLOW_SCORE.MAX)
|
||||||
@Column
|
@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
|
// Allow null because we added this column in PeerTube v3, and don't want to generate fake URLs of remote follows
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Is('ActorFollowUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))
|
@Is('ActorFollowUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.COMMONS.URL.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.COMMONS.URL.max))
|
||||||
url: string
|
declare url: string
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => ActorModel)
|
@ForeignKey(() => ActorModel)
|
||||||
@Column
|
@Column
|
||||||
actorId: number
|
declare actorId: number
|
||||||
|
|
||||||
@BelongsTo(() => ActorModel, {
|
@BelongsTo(() => ActorModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -106,11 +106,11 @@ export class ActorFollowModel extends SequelizeModel<ActorFollowModel> {
|
||||||
as: 'ActorFollower',
|
as: 'ActorFollower',
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
ActorFollower: Awaited<ActorModel>
|
declare ActorFollower: Awaited<ActorModel>
|
||||||
|
|
||||||
@ForeignKey(() => ActorModel)
|
@ForeignKey(() => ActorModel)
|
||||||
@Column
|
@Column
|
||||||
targetActorId: number
|
declare targetActorId: number
|
||||||
|
|
||||||
@BelongsTo(() => ActorModel, {
|
@BelongsTo(() => ActorModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -120,7 +120,7 @@ export class ActorFollowModel extends SequelizeModel<ActorFollowModel> {
|
||||||
as: 'ActorFollowing',
|
as: 'ActorFollowing',
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
ActorFollowing: Awaited<ActorModel>
|
declare ActorFollowing: Awaited<ActorModel>
|
||||||
|
|
||||||
@AfterCreate
|
@AfterCreate
|
||||||
static incrementFollowerAndFollowingCount (instance: ActorFollowModel, options: any) {
|
static incrementFollowerAndFollowingCount (instance: ActorFollowModel, options: any) {
|
||||||
|
|
|
@ -27,39 +27,39 @@ import { ActorModel } from './actor.js'
|
||||||
export class ActorImageModel extends SequelizeModel<ActorImageModel> {
|
export class ActorImageModel extends SequelizeModel<ActorImageModel> {
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
filename: string
|
declare filename: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Column
|
@Column
|
||||||
height: number
|
declare height: number
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Column
|
@Column
|
||||||
width: number
|
declare width: number
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
fileUrl: string
|
declare fileUrl: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
onDisk: boolean
|
declare onDisk: boolean
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
type: ActorImageType_Type
|
declare type: ActorImageType_Type
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => ActorModel)
|
@ForeignKey(() => ActorModel)
|
||||||
@Column
|
@Column
|
||||||
actorId: number
|
declare actorId: number
|
||||||
|
|
||||||
@BelongsTo(() => ActorModel, {
|
@BelongsTo(() => ActorModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -67,7 +67,7 @@ export class ActorImageModel extends SequelizeModel<ActorImageModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
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
|
||||||
|
|
||||||
@AfterDestroy
|
@AfterDestroy
|
||||||
static removeFile (instance: ActorImageModel) {
|
static removeFile (instance: ActorImageModel) {
|
||||||
|
|
|
@ -158,72 +158,72 @@ export const unusedActorAttributesForAPI: (keyof AttributesOnly<ActorModel>)[] =
|
||||||
export class ActorModel extends SequelizeModel<ActorModel> {
|
export class ActorModel extends SequelizeModel<ActorModel> {
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column(DataType.ENUM(...Object.values(ACTIVITY_PUB_ACTOR_TYPES)))
|
@Column(DataType.ENUM(...Object.values(ACTIVITY_PUB_ACTOR_TYPES)))
|
||||||
type: ActivityPubActorType
|
declare type: ActivityPubActorType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('ActorPreferredUsername', value => throwIfNotValid(value, isActorPreferredUsernameValid, 'actor preferred username'))
|
@Is('ActorPreferredUsername', value => throwIfNotValid(value, isActorPreferredUsernameValid, 'actor preferred username'))
|
||||||
@Column
|
@Column
|
||||||
preferredUsername: string
|
declare preferredUsername: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('ActorUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))
|
@Is('ActorUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))
|
||||||
url: string
|
declare url: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Is('ActorPublicKey', value => throwIfNotValid(value, isActorPublicKeyValid, 'public key', true))
|
@Is('ActorPublicKey', value => throwIfNotValid(value, isActorPublicKeyValid, 'public key', true))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.PUBLIC_KEY.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.PUBLIC_KEY.max))
|
||||||
publicKey: string
|
declare publicKey: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Is('ActorPublicKey', value => throwIfNotValid(value, isActorPrivateKeyValid, 'private key', true))
|
@Is('ActorPublicKey', value => throwIfNotValid(value, isActorPrivateKeyValid, 'private key', true))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.PRIVATE_KEY.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.PRIVATE_KEY.max))
|
||||||
privateKey: string
|
declare privateKey: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('ActorFollowersCount', value => throwIfNotValid(value, isActorFollowersCountValid, 'followers count'))
|
@Is('ActorFollowersCount', value => throwIfNotValid(value, isActorFollowersCountValid, 'followers count'))
|
||||||
@Column
|
@Column
|
||||||
followersCount: number
|
declare followersCount: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('ActorFollowersCount', value => throwIfNotValid(value, isActorFollowingCountValid, 'following count'))
|
@Is('ActorFollowersCount', value => throwIfNotValid(value, isActorFollowingCountValid, 'following count'))
|
||||||
@Column
|
@Column
|
||||||
followingCount: number
|
declare followingCount: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('ActorInboxUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'inbox url'))
|
@Is('ActorInboxUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'inbox url'))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))
|
||||||
inboxUrl: string
|
declare inboxUrl: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Is('ActorOutboxUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'outbox url', true))
|
@Is('ActorOutboxUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'outbox url', true))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))
|
||||||
outboxUrl: string
|
declare outboxUrl: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Is('ActorSharedInboxUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'shared inbox url', true))
|
@Is('ActorSharedInboxUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'shared inbox url', true))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))
|
||||||
sharedInboxUrl: string
|
declare sharedInboxUrl: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Is('ActorFollowersUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'followers url', true))
|
@Is('ActorFollowersUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'followers url', true))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))
|
||||||
followersUrl: string
|
declare followersUrl: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Is('ActorFollowingUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'following url', true))
|
@Is('ActorFollowingUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'following url', true))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))
|
||||||
followingUrl: string
|
declare followingUrl: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
remoteCreatedAt: Date
|
declare remoteCreatedAt: Date
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@HasMany(() => ActorImageModel, {
|
@HasMany(() => ActorImageModel, {
|
||||||
as: 'Avatars',
|
as: 'Avatars',
|
||||||
|
@ -236,7 +236,7 @@ export class ActorModel extends SequelizeModel<ActorModel> {
|
||||||
type: ActorImageType.AVATAR
|
type: ActorImageType.AVATAR
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Avatars: Awaited<ActorImageModel>[]
|
declare Avatars: Awaited<ActorImageModel>[]
|
||||||
|
|
||||||
@HasMany(() => ActorImageModel, {
|
@HasMany(() => ActorImageModel, {
|
||||||
as: 'Banners',
|
as: 'Banners',
|
||||||
|
@ -249,7 +249,7 @@ export class ActorModel extends SequelizeModel<ActorModel> {
|
||||||
type: ActorImageType.BANNER
|
type: ActorImageType.BANNER
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Banners: Awaited<ActorImageModel>[]
|
declare Banners: Awaited<ActorImageModel>[]
|
||||||
|
|
||||||
@HasMany(() => UploadImageModel, {
|
@HasMany(() => UploadImageModel, {
|
||||||
as: 'UploadImages',
|
as: 'UploadImages',
|
||||||
|
@ -259,7 +259,7 @@ export class ActorModel extends SequelizeModel<ActorModel> {
|
||||||
allowNull: false
|
allowNull: false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
UploadImages: Awaited<UploadImageModel>[]
|
declare UploadImages: Awaited<UploadImageModel>[]
|
||||||
|
|
||||||
@HasMany(() => ActorFollowModel, {
|
@HasMany(() => ActorFollowModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -269,7 +269,7 @@ export class ActorModel extends SequelizeModel<ActorModel> {
|
||||||
as: 'ActorFollowings',
|
as: 'ActorFollowings',
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
ActorFollowing: Awaited<ActorFollowModel>[]
|
declare ActorFollowing: Awaited<ActorFollowModel>[]
|
||||||
|
|
||||||
@HasMany(() => ActorFollowModel, {
|
@HasMany(() => ActorFollowModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -279,11 +279,11 @@ export class ActorModel extends SequelizeModel<ActorModel> {
|
||||||
as: 'ActorFollowers',
|
as: 'ActorFollowers',
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
ActorFollowers: Awaited<ActorFollowModel>[]
|
declare ActorFollowers: Awaited<ActorFollowModel>[]
|
||||||
|
|
||||||
@ForeignKey(() => ServerModel)
|
@ForeignKey(() => ServerModel)
|
||||||
@Column
|
@Column
|
||||||
serverId: number
|
declare serverId: number
|
||||||
|
|
||||||
@BelongsTo(() => ServerModel, {
|
@BelongsTo(() => ServerModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -291,7 +291,7 @@ export class ActorModel extends SequelizeModel<ActorModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Server: Awaited<ServerModel>
|
declare Server: Awaited<ServerModel>
|
||||||
|
|
||||||
@HasOne(() => AccountModel, {
|
@HasOne(() => AccountModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -300,7 +300,7 @@ export class ActorModel extends SequelizeModel<ActorModel> {
|
||||||
onDelete: 'cascade',
|
onDelete: 'cascade',
|
||||||
hooks: true
|
hooks: true
|
||||||
})
|
})
|
||||||
Account: Awaited<AccountModel>
|
declare Account: Awaited<AccountModel>
|
||||||
|
|
||||||
@HasOne(() => VideoChannelModel, {
|
@HasOne(() => VideoChannelModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -309,7 +309,7 @@ export class ActorModel extends SequelizeModel<ActorModel> {
|
||||||
onDelete: 'cascade',
|
onDelete: 'cascade',
|
||||||
hooks: true
|
hooks: true
|
||||||
})
|
})
|
||||||
VideoChannel: Awaited<VideoChannelModel>
|
declare VideoChannel: Awaited<VideoChannelModel>
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -40,19 +40,19 @@ export class ApplicationModel extends SequelizeModel<ApplicationModel> {
|
||||||
@Default(0)
|
@Default(0)
|
||||||
@IsInt
|
@IsInt
|
||||||
@Column
|
@Column
|
||||||
migrationVersion: number
|
declare migrationVersion: number
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
latestPeerTubeVersion: string
|
declare latestPeerTubeVersion: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
nodeVersion: string
|
declare nodeVersion: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
nodeABIVersion: number
|
declare nodeABIVersion: number
|
||||||
|
|
||||||
@HasOne(() => AccountModel, {
|
@HasOne(() => AccountModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -60,7 +60,7 @@ export class ApplicationModel extends SequelizeModel<ApplicationModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Account: Awaited<AccountModel>
|
declare Account: Awaited<AccountModel>
|
||||||
|
|
||||||
static countTotal () {
|
static countTotal () {
|
||||||
return ApplicationModel.count()
|
return ApplicationModel.count()
|
||||||
|
|
|
@ -28,35 +28,35 @@ import { SequelizeModel } from '../shared/index.js'
|
||||||
export class UploadImageModel extends SequelizeModel<UploadImageModel> {
|
export class UploadImageModel extends SequelizeModel<UploadImageModel> {
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
filename: string
|
declare filename: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Column
|
@Column
|
||||||
height: number
|
declare height: number
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Column
|
@Column
|
||||||
width: number
|
declare width: number
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
fileUrl: string
|
declare fileUrl: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
type: UploadImageType_Type
|
declare type: UploadImageType_Type
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => ActorModel)
|
@ForeignKey(() => ActorModel)
|
||||||
@Column
|
@Column
|
||||||
actorId: number
|
declare actorId: number
|
||||||
|
|
||||||
@BelongsTo(() => ActorModel, {
|
@BelongsTo(() => ActorModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -64,7 +64,7 @@ export class UploadImageModel extends SequelizeModel<UploadImageModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
Actor: Awaited<ActorModel>
|
declare Actor: Awaited<ActorModel>
|
||||||
|
|
||||||
@AfterDestroy
|
@AfterDestroy
|
||||||
static removeFile (instance: UploadImageModel) {
|
static removeFile (instance: UploadImageModel) {
|
||||||
|
|
|
@ -17,18 +17,18 @@ import { AutomaticTagModel } from './automatic-tag.js'
|
||||||
})
|
})
|
||||||
export class AccountAutomaticTagPolicyModel extends SequelizeModel<AccountAutomaticTagPolicyModel> {
|
export class AccountAutomaticTagPolicyModel extends SequelizeModel<AccountAutomaticTagPolicyModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column(DataType.INTEGER)
|
@Column(DataType.INTEGER)
|
||||||
policy: AutomaticTagPolicyType
|
declare policy: AutomaticTagPolicyType
|
||||||
|
|
||||||
@ForeignKey(() => AccountModel)
|
@ForeignKey(() => AccountModel)
|
||||||
@Column
|
@Column
|
||||||
accountId: number
|
declare accountId: number
|
||||||
|
|
||||||
@BelongsTo(() => AccountModel, {
|
@BelongsTo(() => AccountModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -36,11 +36,11 @@ export class AccountAutomaticTagPolicyModel extends SequelizeModel<AccountAutoma
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Account: Awaited<AccountModel>
|
declare Account: Awaited<AccountModel>
|
||||||
|
|
||||||
@ForeignKey(() => AutomaticTagModel)
|
@ForeignKey(() => AutomaticTagModel)
|
||||||
@Column
|
@Column
|
||||||
automaticTagId: number
|
declare automaticTagId: number
|
||||||
|
|
||||||
@BelongsTo(() => AutomaticTagModel, {
|
@BelongsTo(() => AutomaticTagModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -48,7 +48,7 @@ export class AccountAutomaticTagPolicyModel extends SequelizeModel<AccountAutoma
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
AutomaticTag: Awaited<AutomaticTagModel>
|
declare AutomaticTag: Awaited<AutomaticTagModel>
|
||||||
|
|
||||||
static async listOfAccount (account: MAccountId) {
|
static async listOfAccount (account: MAccountId) {
|
||||||
const rows = await this.findAll({
|
const rows = await this.findAll({
|
||||||
|
|
|
@ -21,22 +21,21 @@ import { VideoAutomaticTagModel } from './video-automatic-tag.js'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AutomaticTagModel extends SequelizeModel<AutomaticTagModel> {
|
export class AutomaticTagModel extends SequelizeModel<AutomaticTagModel> {
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
name: string
|
declare name: string
|
||||||
|
|
||||||
@HasMany(() => CommentAutomaticTagModel, {
|
@HasMany(() => CommentAutomaticTagModel, {
|
||||||
foreignKey: 'automaticTagId',
|
foreignKey: 'automaticTagId',
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
CommentAutomaticTags: Awaited<CommentAutomaticTagModel>[]
|
declare CommentAutomaticTags: Awaited<CommentAutomaticTagModel>[]
|
||||||
|
|
||||||
@HasMany(() => VideoAutomaticTagModel, {
|
@HasMany(() => VideoAutomaticTagModel, {
|
||||||
foreignKey: 'automaticTagId',
|
foreignKey: 'automaticTagId',
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
VideoAutomaticTags: Awaited<VideoAutomaticTagModel>[]
|
declare VideoAutomaticTags: Awaited<VideoAutomaticTagModel>[]
|
||||||
|
|
||||||
@HasMany(() => AccountAutomaticTagPolicyModel, {
|
@HasMany(() => AccountAutomaticTagPolicyModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -45,7 +44,7 @@ export class AutomaticTagModel extends SequelizeModel<AutomaticTagModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
AccountAutomaticTagPolicies: Awaited<AccountAutomaticTagPolicyModel>[]
|
declare AccountAutomaticTagPolicies: Awaited<AccountAutomaticTagPolicyModel>[]
|
||||||
|
|
||||||
static findOrCreateAutomaticTag (options: {
|
static findOrCreateAutomaticTag (options: {
|
||||||
tag: string
|
tag: string
|
||||||
|
|
|
@ -6,10 +6,8 @@ import { AutomaticTagModel } from './automatic-tag.js'
|
||||||
import { Transaction } from 'sequelize'
|
import { Transaction } from 'sequelize'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Sequelize doesn't seem to support many to many relation using BelongsToMany with 3 tables
|
* 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
|
* So we reproduce the behaviour with classic BelongsTo/HasMany relations
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Table({
|
@Table({
|
||||||
|
@ -17,25 +15,25 @@ import { Transaction } from 'sequelize'
|
||||||
})
|
})
|
||||||
export class CommentAutomaticTagModel extends SequelizeModel<CommentAutomaticTagModel> {
|
export class CommentAutomaticTagModel extends SequelizeModel<CommentAutomaticTagModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => VideoCommentModel)
|
@ForeignKey(() => VideoCommentModel)
|
||||||
@PrimaryKey
|
@PrimaryKey
|
||||||
@Column
|
@Column
|
||||||
commentId: number
|
declare commentId: number
|
||||||
|
|
||||||
@ForeignKey(() => AutomaticTagModel)
|
@ForeignKey(() => AutomaticTagModel)
|
||||||
@PrimaryKey
|
@PrimaryKey
|
||||||
@Column
|
@Column
|
||||||
automaticTagId: number
|
declare automaticTagId: number
|
||||||
|
|
||||||
@ForeignKey(() => AccountModel)
|
@ForeignKey(() => AccountModel)
|
||||||
@PrimaryKey
|
@PrimaryKey
|
||||||
@Column
|
@Column
|
||||||
accountId: number
|
declare accountId: number
|
||||||
|
|
||||||
@BelongsTo(() => AccountModel, {
|
@BelongsTo(() => AccountModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -43,7 +41,7 @@ export class CommentAutomaticTagModel extends SequelizeModel<CommentAutomaticTag
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
Account: Awaited<AccountModel>
|
declare Account: Awaited<AccountModel>
|
||||||
|
|
||||||
@BelongsTo(() => AutomaticTagModel, {
|
@BelongsTo(() => AutomaticTagModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -51,7 +49,7 @@ export class CommentAutomaticTagModel extends SequelizeModel<CommentAutomaticTag
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
AutomaticTag: Awaited<AutomaticTagModel>
|
declare AutomaticTag: Awaited<AutomaticTagModel>
|
||||||
|
|
||||||
@BelongsTo(() => VideoCommentModel, {
|
@BelongsTo(() => VideoCommentModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -59,7 +57,7 @@ export class CommentAutomaticTagModel extends SequelizeModel<CommentAutomaticTag
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
VideoComment: Awaited<VideoCommentModel>
|
declare VideoComment: Awaited<VideoCommentModel>
|
||||||
|
|
||||||
static deleteAllOfAccountAndComment (options: {
|
static deleteAllOfAccountAndComment (options: {
|
||||||
accountId: number
|
accountId: number
|
||||||
|
|
|
@ -6,10 +6,8 @@ import { VideoModel } from '../video/video.js'
|
||||||
import { AutomaticTagModel } from './automatic-tag.js'
|
import { AutomaticTagModel } from './automatic-tag.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Sequelize doesn't seem to support many to many relation using BelongsToMany with 3 tables
|
* 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
|
* So we reproduce the behaviour with classic BelongsTo/HasMany relations
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Table({
|
@Table({
|
||||||
|
@ -17,25 +15,25 @@ import { AutomaticTagModel } from './automatic-tag.js'
|
||||||
})
|
})
|
||||||
export class VideoAutomaticTagModel extends SequelizeModel<VideoAutomaticTagModel> {
|
export class VideoAutomaticTagModel extends SequelizeModel<VideoAutomaticTagModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@PrimaryKey
|
@PrimaryKey
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@ForeignKey(() => AutomaticTagModel)
|
@ForeignKey(() => AutomaticTagModel)
|
||||||
@PrimaryKey
|
@PrimaryKey
|
||||||
@Column
|
@Column
|
||||||
automaticTagId: number
|
declare automaticTagId: number
|
||||||
|
|
||||||
@ForeignKey(() => AccountModel)
|
@ForeignKey(() => AccountModel)
|
||||||
@PrimaryKey
|
@PrimaryKey
|
||||||
@Column
|
@Column
|
||||||
accountId: number
|
declare accountId: number
|
||||||
|
|
||||||
@BelongsTo(() => AccountModel, {
|
@BelongsTo(() => AccountModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -43,7 +41,7 @@ export class VideoAutomaticTagModel extends SequelizeModel<VideoAutomaticTagMode
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
Account: Awaited<AccountModel>
|
declare Account: Awaited<AccountModel>
|
||||||
|
|
||||||
@BelongsTo(() => AutomaticTagModel, {
|
@BelongsTo(() => AutomaticTagModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -51,7 +49,7 @@ export class VideoAutomaticTagModel extends SequelizeModel<VideoAutomaticTagMode
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
AutomaticTag: Awaited<AutomaticTagModel>
|
declare AutomaticTag: Awaited<AutomaticTagModel>
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -59,7 +57,7 @@ export class VideoAutomaticTagModel extends SequelizeModel<VideoAutomaticTagMode
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
|
|
||||||
static deleteAllOfAccountAndVideo (options: {
|
static deleteAllOfAccountAndVideo (options: {
|
||||||
accountId: number
|
accountId: number
|
||||||
|
|
|
@ -16,31 +16,30 @@ import { SequelizeModel } from '../shared/index.js'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class OAuthClientModel extends SequelizeModel<OAuthClientModel> {
|
export class OAuthClientModel extends SequelizeModel<OAuthClientModel> {
|
||||||
|
@AllowNull(false)
|
||||||
|
@Column
|
||||||
|
declare clientId: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
clientId: string
|
declare clientSecret: string
|
||||||
|
|
||||||
@AllowNull(false)
|
|
||||||
@Column
|
|
||||||
clientSecret: string
|
|
||||||
|
|
||||||
@Column(DataType.ARRAY(DataType.STRING))
|
@Column(DataType.ARRAY(DataType.STRING))
|
||||||
grants: string[]
|
declare grants: string[]
|
||||||
|
|
||||||
@Column(DataType.ARRAY(DataType.STRING))
|
@Column(DataType.ARRAY(DataType.STRING))
|
||||||
redirectUris: string[]
|
declare redirectUris: string[]
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@HasMany(() => OAuthTokenModel, {
|
@HasMany(() => OAuthTokenModel, {
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
OAuthTokens: Awaited<OAuthTokenModel>[]
|
declare OAuthTokens: Awaited<OAuthTokenModel>[]
|
||||||
|
|
||||||
static countTotal () {
|
static countTotal () {
|
||||||
return OAuthClientModel.count()
|
return OAuthClientModel.count()
|
||||||
|
|
|
@ -6,7 +6,8 @@ import {
|
||||||
BelongsTo,
|
BelongsTo,
|
||||||
Column,
|
Column,
|
||||||
CreatedAt,
|
CreatedAt,
|
||||||
ForeignKey, Scopes,
|
ForeignKey,
|
||||||
|
Scopes,
|
||||||
Table,
|
Table,
|
||||||
UpdatedAt
|
UpdatedAt
|
||||||
} from 'sequelize-typescript'
|
} from 'sequelize-typescript'
|
||||||
|
@ -79,35 +80,34 @@ enum ScopeNames {
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class OAuthTokenModel extends SequelizeModel<OAuthTokenModel> {
|
export class OAuthTokenModel extends SequelizeModel<OAuthTokenModel> {
|
||||||
|
@AllowNull(false)
|
||||||
|
@Column
|
||||||
|
declare accessToken: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
accessToken: string
|
declare accessTokenExpiresAt: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
accessTokenExpiresAt: Date
|
declare refreshToken: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
refreshToken: string
|
declare refreshTokenExpiresAt: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
|
||||||
@Column
|
|
||||||
refreshTokenExpiresAt: Date
|
|
||||||
|
|
||||||
@Column
|
@Column
|
||||||
authName: string
|
declare authName: string
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => UserModel)
|
@ForeignKey(() => UserModel)
|
||||||
@Column
|
@Column
|
||||||
userId: number
|
declare userId: number
|
||||||
|
|
||||||
@BelongsTo(() => UserModel, {
|
@BelongsTo(() => UserModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -115,11 +115,11 @@ export class OAuthTokenModel extends SequelizeModel<OAuthTokenModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
User: Awaited<UserModel>
|
declare User: Awaited<UserModel>
|
||||||
|
|
||||||
@ForeignKey(() => OAuthClientModel)
|
@ForeignKey(() => OAuthClientModel)
|
||||||
@Column
|
@Column
|
||||||
oAuthClientId: number
|
declare oAuthClientId: number
|
||||||
|
|
||||||
@BelongsTo(() => OAuthClientModel, {
|
@BelongsTo(() => OAuthClientModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -127,7 +127,7 @@ export class OAuthTokenModel extends SequelizeModel<OAuthTokenModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
OAuthClients: Awaited<OAuthClientModel>[]
|
declare OAuthClients: Awaited<OAuthClientModel>[]
|
||||||
|
|
||||||
@AfterUpdate
|
@AfterUpdate
|
||||||
@AfterDestroy
|
@AfterDestroy
|
||||||
|
|
|
@ -78,31 +78,31 @@ export enum ScopeNames {
|
||||||
})
|
})
|
||||||
export class VideoRedundancyModel extends SequelizeModel<VideoRedundancyModel> {
|
export class VideoRedundancyModel extends SequelizeModel<VideoRedundancyModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
expiresOn: Date
|
declare expiresOn: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS_REDUNDANCY.URL.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS_REDUNDANCY.URL.max))
|
||||||
fileUrl: string
|
declare fileUrl: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('VideoRedundancyUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))
|
@Is('VideoRedundancyUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS_REDUNDANCY.URL.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS_REDUNDANCY.URL.max))
|
||||||
url: string
|
declare url: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
strategy: string // Only used by us
|
declare strategy: string // Only used by us
|
||||||
|
|
||||||
@ForeignKey(() => VideoStreamingPlaylistModel)
|
@ForeignKey(() => VideoStreamingPlaylistModel)
|
||||||
@Column
|
@Column
|
||||||
videoStreamingPlaylistId: number
|
declare videoStreamingPlaylistId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoStreamingPlaylistModel, {
|
@BelongsTo(() => VideoStreamingPlaylistModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -110,11 +110,11 @@ export class VideoRedundancyModel extends SequelizeModel<VideoRedundancyModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
VideoStreamingPlaylist: Awaited<VideoStreamingPlaylistModel>
|
declare VideoStreamingPlaylist: Awaited<VideoStreamingPlaylistModel>
|
||||||
|
|
||||||
@ForeignKey(() => ActorModel)
|
@ForeignKey(() => ActorModel)
|
||||||
@Column
|
@Column
|
||||||
actorId: number
|
declare actorId: number
|
||||||
|
|
||||||
@BelongsTo(() => ActorModel, {
|
@BelongsTo(() => ActorModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -122,7 +122,7 @@ export class VideoRedundancyModel extends SequelizeModel<VideoRedundancyModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Actor: Awaited<ActorModel>
|
declare Actor: Awaited<ActorModel>
|
||||||
|
|
||||||
@BeforeDestroy
|
@BeforeDestroy
|
||||||
static async removeFile (instance: VideoRedundancyModel) {
|
static async removeFile (instance: VideoRedundancyModel) {
|
||||||
|
|
|
@ -19,7 +19,8 @@ import {
|
||||||
DataType,
|
DataType,
|
||||||
Default,
|
Default,
|
||||||
ForeignKey,
|
ForeignKey,
|
||||||
IsUUID, Scopes,
|
IsUUID,
|
||||||
|
Scopes,
|
||||||
Table,
|
Table,
|
||||||
UpdatedAt
|
UpdatedAt
|
||||||
} from 'sequelize-typescript'
|
} from 'sequelize-typescript'
|
||||||
|
@ -66,68 +67,67 @@ enum ScopeNames {
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class RunnerJobModel extends SequelizeModel<RunnerJobModel> {
|
export class RunnerJobModel extends SequelizeModel<RunnerJobModel> {
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@IsUUID(4)
|
@IsUUID(4)
|
||||||
@Column(DataType.UUID)
|
@Column(DataType.UUID)
|
||||||
uuid: string
|
declare uuid: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
type: RunnerJobType
|
declare type: RunnerJobType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column(DataType.JSONB)
|
@Column(DataType.JSONB)
|
||||||
payload: RunnerJobPayload
|
declare payload: RunnerJobPayload
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column(DataType.JSONB)
|
@Column(DataType.JSONB)
|
||||||
privatePayload: RunnerJobPrivatePayload
|
declare privatePayload: RunnerJobPrivatePayload
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
state: RunnerJobStateType
|
declare state: RunnerJobStateType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(0)
|
@Default(0)
|
||||||
@Column
|
@Column
|
||||||
failures: number
|
declare failures: number
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.RUNNER_JOBS.ERROR_MESSAGE.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.RUNNER_JOBS.ERROR_MESSAGE.max))
|
||||||
error: string
|
declare error: string
|
||||||
|
|
||||||
// Less has priority
|
// Less has priority
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
priority: number
|
declare priority: number
|
||||||
|
|
||||||
// Used to fetch the appropriate job when the runner wants to post the result
|
// Used to fetch the appropriate job when the runner wants to post the result
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
processingJobToken: string
|
declare processingJobToken: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
progress: number
|
declare progress: number
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
startedAt: Date
|
declare startedAt: Date
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
finishedAt: Date
|
declare finishedAt: Date
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => RunnerJobModel)
|
@ForeignKey(() => RunnerJobModel)
|
||||||
@Column
|
@Column
|
||||||
dependsOnRunnerJobId: number
|
declare dependsOnRunnerJobId: number
|
||||||
|
|
||||||
@BelongsTo(() => RunnerJobModel, {
|
@BelongsTo(() => RunnerJobModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -136,11 +136,11 @@ export class RunnerJobModel extends SequelizeModel<RunnerJobModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
DependsOnRunnerJob: Awaited<RunnerJobModel>
|
declare DependsOnRunnerJob: Awaited<RunnerJobModel>
|
||||||
|
|
||||||
@ForeignKey(() => RunnerModel)
|
@ForeignKey(() => RunnerModel)
|
||||||
@Column
|
@Column
|
||||||
runnerId: number
|
declare runnerId: number
|
||||||
|
|
||||||
@BelongsTo(() => RunnerModel, {
|
@BelongsTo(() => RunnerModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -149,7 +149,7 @@ export class RunnerJobModel extends SequelizeModel<RunnerJobModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'SET NULL'
|
onDelete: 'SET NULL'
|
||||||
})
|
})
|
||||||
Runner: Awaited<RunnerModel>
|
declare Runner: Awaited<RunnerModel>
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -309,7 +309,11 @@ export class RunnerJobModel extends SequelizeModel<RunnerJobModel> {
|
||||||
|
|
||||||
setToErrorOrCancel (
|
setToErrorOrCancel (
|
||||||
// eslint-disable-next-line max-len
|
// 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 = state
|
this.state = state
|
||||||
this.processingJobToken = null
|
this.processingJobToken = null
|
||||||
|
|
|
@ -6,9 +6,7 @@ import { SequelizeModel, getSort } from '../shared/index.js'
|
||||||
import { RunnerModel } from './runner.js'
|
import { RunnerModel } from './runner.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Tokens used by PeerTube runners to register themselves to the PeerTube instance
|
* Tokens used by PeerTube runners to register themselves to the PeerTube instance
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Table({
|
@Table({
|
||||||
|
@ -21,16 +19,15 @@ import { RunnerModel } from './runner.js'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class RunnerRegistrationTokenModel extends SequelizeModel<RunnerRegistrationTokenModel> {
|
export class RunnerRegistrationTokenModel extends SequelizeModel<RunnerRegistrationTokenModel> {
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
registrationToken: string
|
declare registrationToken: string
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@HasMany(() => RunnerModel, {
|
@HasMany(() => RunnerModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -38,7 +35,7 @@ export class RunnerRegistrationTokenModel extends SequelizeModel<RunnerRegistrat
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Runners: Awaited<RunnerModel>[]
|
declare Runners: Awaited<RunnerModel>[]
|
||||||
|
|
||||||
static load (id: number) {
|
static load (id: number) {
|
||||||
return RunnerRegistrationTokenModel.findByPk(id)
|
return RunnerRegistrationTokenModel.findByPk(id)
|
||||||
|
|
|
@ -23,37 +23,36 @@ import { CONSTRAINTS_FIELDS } from '@server/initializers/constants.js'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class RunnerModel extends SequelizeModel<RunnerModel> {
|
export class RunnerModel extends SequelizeModel<RunnerModel> {
|
||||||
|
|
||||||
// Used to identify the appropriate runner when it uses the runner REST API
|
// Used to identify the appropriate runner when it uses the runner REST API
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
runnerToken: string
|
declare runnerToken: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
name: string
|
declare name: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.RUNNERS.DESCRIPTION.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.RUNNERS.DESCRIPTION.max))
|
||||||
description: string
|
declare description: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
lastContact: Date
|
declare lastContact: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
ip: string
|
declare ip: string
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => RunnerRegistrationTokenModel)
|
@ForeignKey(() => RunnerRegistrationTokenModel)
|
||||||
@Column
|
@Column
|
||||||
runnerRegistrationTokenId: number
|
declare runnerRegistrationTokenId: number
|
||||||
|
|
||||||
@BelongsTo(() => RunnerRegistrationTokenModel, {
|
@BelongsTo(() => RunnerRegistrationTokenModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -61,7 +60,7 @@ export class RunnerModel extends SequelizeModel<RunnerModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
RunnerRegistrationToken: Awaited<RunnerRegistrationTokenModel>
|
declare RunnerRegistrationToken: Awaited<RunnerRegistrationTokenModel>
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@ import { SequelizeModel, getSort, throwIfNotValid } from '../shared/index.js'
|
||||||
exclude: [ 'storage' ]
|
exclude: [ 'storage' ]
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
@Table({
|
@Table({
|
||||||
tableName: 'plugin',
|
tableName: 'plugin',
|
||||||
indexes: [
|
indexes: [
|
||||||
|
@ -35,62 +34,61 @@ import { SequelizeModel, getSort, throwIfNotValid } from '../shared/index.js'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class PluginModel extends SequelizeModel<PluginModel> {
|
export class PluginModel extends SequelizeModel<PluginModel> {
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('PluginName', value => throwIfNotValid(value, isPluginNameValid, 'name'))
|
@Is('PluginName', value => throwIfNotValid(value, isPluginNameValid, 'name'))
|
||||||
@Column
|
@Column
|
||||||
name: string
|
declare name: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('PluginType', value => throwIfNotValid(value, isPluginTypeValid, 'type'))
|
@Is('PluginType', value => throwIfNotValid(value, isPluginTypeValid, 'type'))
|
||||||
@Column
|
@Column
|
||||||
type: PluginType_Type
|
declare type: PluginType_Type
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('PluginVersion', value => throwIfNotValid(value, isPluginStableOrUnstableVersionValid, 'version'))
|
@Is('PluginVersion', value => throwIfNotValid(value, isPluginStableOrUnstableVersionValid, 'version'))
|
||||||
@Column
|
@Column
|
||||||
version: string
|
declare version: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Is('PluginLatestVersion', value => throwIfNotValid(value, isPluginStableVersionValid, 'version'))
|
@Is('PluginLatestVersion', value => throwIfNotValid(value, isPluginStableVersionValid, 'version'))
|
||||||
@Column
|
@Column
|
||||||
latestVersion: string
|
declare latestVersion: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
enabled: boolean
|
declare enabled: boolean
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
uninstalled: boolean
|
declare uninstalled: boolean
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
peertubeEngine: string
|
declare peertubeEngine: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Is('PluginDescription', value => throwIfNotValid(value, isPluginDescriptionValid, 'description'))
|
@Is('PluginDescription', value => throwIfNotValid(value, isPluginDescriptionValid, 'description'))
|
||||||
@Column
|
@Column
|
||||||
description: string
|
declare description: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('PluginHomepage', value => throwIfNotValid(value, isPluginHomepage, 'homepage'))
|
@Is('PluginHomepage', value => throwIfNotValid(value, isPluginHomepage, 'homepage'))
|
||||||
@Column
|
@Column
|
||||||
homepage: string
|
declare homepage: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column(DataType.JSONB)
|
@Column(DataType.JSONB)
|
||||||
settings: any
|
declare settings: any
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column(DataType.JSONB)
|
@Column(DataType.JSONB)
|
||||||
storage: any
|
declare storage: any
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
static listEnabledPluginsAndThemes (): Promise<MPlugin[]> {
|
static listEnabledPluginsAndThemes (): Promise<MPlugin[]> {
|
||||||
const query = {
|
const query = {
|
||||||
|
@ -312,5 +310,4 @@ export class PluginModel extends SequelizeModel<PluginModel> {
|
||||||
updatedAt: this.updatedAt
|
updatedAt: this.updatedAt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@ enum ScopeNames {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
@Table({
|
@Table({
|
||||||
tableName: 'serverBlocklist',
|
tableName: 'serverBlocklist',
|
||||||
indexes: [
|
indexes: [
|
||||||
|
@ -43,16 +42,15 @@ enum ScopeNames {
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class ServerBlocklistModel extends SequelizeModel<ServerBlocklistModel> {
|
export class ServerBlocklistModel extends SequelizeModel<ServerBlocklistModel> {
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => AccountModel)
|
@ForeignKey(() => AccountModel)
|
||||||
@Column
|
@Column
|
||||||
accountId: number
|
declare accountId: number
|
||||||
|
|
||||||
@BelongsTo(() => AccountModel, {
|
@BelongsTo(() => AccountModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -61,11 +59,11 @@ export class ServerBlocklistModel extends SequelizeModel<ServerBlocklistModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
ByAccount: Awaited<AccountModel>
|
declare ByAccount: Awaited<AccountModel>
|
||||||
|
|
||||||
@ForeignKey(() => ServerModel)
|
@ForeignKey(() => ServerModel)
|
||||||
@Column
|
@Column
|
||||||
targetServerId: number
|
declare targetServerId: number
|
||||||
|
|
||||||
@BelongsTo(() => ServerModel, {
|
@BelongsTo(() => ServerModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -73,7 +71,7 @@ export class ServerBlocklistModel extends SequelizeModel<ServerBlocklistModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
BlockedServer: Awaited<ServerModel>
|
declare BlockedServer: Awaited<ServerModel>
|
||||||
|
|
||||||
static isServerMutedByAccounts (accountIds: number[], targetServerId: number) {
|
static isServerMutedByAccounts (accountIds: number[], targetServerId: number) {
|
||||||
const query = {
|
const query = {
|
||||||
|
|
|
@ -16,22 +16,21 @@ import { ServerBlocklistModel } from './server-blocklist.js'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class ServerModel extends SequelizeModel<ServerModel> {
|
export class ServerModel extends SequelizeModel<ServerModel> {
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('Host', value => throwIfNotValid(value, isHostValid, 'valid host'))
|
@Is('Host', value => throwIfNotValid(value, isHostValid, 'valid host'))
|
||||||
@Column
|
@Column
|
||||||
host: string
|
declare host: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(false)
|
@Default(false)
|
||||||
@Column
|
@Column
|
||||||
redundancyAllowed: boolean
|
declare redundancyAllowed: boolean
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@HasMany(() => ActorModel, {
|
@HasMany(() => ActorModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -41,7 +40,7 @@ export class ServerModel extends SequelizeModel<ServerModel> {
|
||||||
onDelete: 'CASCADE',
|
onDelete: 'CASCADE',
|
||||||
hooks: true
|
hooks: true
|
||||||
})
|
})
|
||||||
Actors: Awaited<ActorModel>[]
|
declare Actors: Awaited<ActorModel>[]
|
||||||
|
|
||||||
@HasMany(() => ServerBlocklistModel, {
|
@HasMany(() => ServerBlocklistModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -49,7 +48,7 @@ export class ServerModel extends SequelizeModel<ServerModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
BlockedBy: Awaited<ServerBlocklistModel>[]
|
declare BlockedBy: Awaited<ServerBlocklistModel>[]
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -15,23 +15,22 @@ import { SequelizeModel } from '../shared/sequelize-type.js'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class TrackerModel extends SequelizeModel<TrackerModel> {
|
export class TrackerModel extends SequelizeModel<TrackerModel> {
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
url: string
|
declare url: string
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@BelongsToMany(() => VideoModel, {
|
@BelongsToMany(() => VideoModel, {
|
||||||
foreignKey: 'trackerId',
|
foreignKey: 'trackerId',
|
||||||
through: () => VideoTrackerModel,
|
through: () => VideoTrackerModel,
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
Videos: Awaited<VideoModel>[]
|
declare Videos: Awaited<VideoModel>[]
|
||||||
|
|
||||||
static listUrlsByVideoId (videoId: number) {
|
static listUrlsByVideoId (videoId: number) {
|
||||||
const query = {
|
const query = {
|
||||||
|
|
|
@ -16,16 +16,16 @@ import { SequelizeModel } from '../shared/index.js'
|
||||||
})
|
})
|
||||||
export class VideoTrackerModel extends SequelizeModel<VideoTrackerModel> {
|
export class VideoTrackerModel extends SequelizeModel<VideoTrackerModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@ForeignKey(() => TrackerModel)
|
@ForeignKey(() => TrackerModel)
|
||||||
@Column
|
@Column
|
||||||
trackerId: number
|
declare trackerId: number
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,5 +2,5 @@ import { AttributesOnly } from '@peertube/peertube-typescript-utils'
|
||||||
import { Model } from 'sequelize-typescript'
|
import { Model } from 'sequelize-typescript'
|
||||||
|
|
||||||
export abstract class SequelizeModel<T> extends Model<Partial<AttributesOnly<T>>> {
|
export abstract class SequelizeModel<T> extends Model<Partial<AttributesOnly<T>>> {
|
||||||
id: number
|
declare id: number
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,42 +35,42 @@ import { UserModel } from './user.js'
|
||||||
})
|
})
|
||||||
export class UserExportModel extends SequelizeModel<UserExportModel> {
|
export class UserExportModel extends SequelizeModel<UserExportModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
filename: string
|
declare filename: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
withVideoFiles: boolean
|
declare withVideoFiles: boolean
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
state: UserExportStateType
|
declare state: UserExportStateType
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column(DataType.TEXT)
|
@Column(DataType.TEXT)
|
||||||
error: string
|
declare error: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column(DataType.BIGINT)
|
@Column(DataType.BIGINT)
|
||||||
size: number
|
declare size: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
storage: FileStorageType
|
declare storage: FileStorageType
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
fileUrl: string
|
declare fileUrl: string
|
||||||
|
|
||||||
@ForeignKey(() => UserModel)
|
@ForeignKey(() => UserModel)
|
||||||
@Column
|
@Column
|
||||||
userId: number
|
declare userId: number
|
||||||
|
|
||||||
@BelongsTo(() => UserModel, {
|
@BelongsTo(() => UserModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -78,7 +78,7 @@ export class UserExportModel extends SequelizeModel<UserExportModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
User: Awaited<UserModel>
|
declare User: Awaited<UserModel>
|
||||||
|
|
||||||
@BeforeDestroy
|
@BeforeDestroy
|
||||||
static removeFile (instance: UserExportModel) {
|
static 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()
|
expiresOn: new Date(this.createdAt.getTime() + CONFIG.EXPORT.USERS.EXPORT_EXPIRATION).toISOString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,30 +20,30 @@ import { USER_IMPORT_STATES } from '@server/initializers/constants.js'
|
||||||
})
|
})
|
||||||
export class UserImportModel extends SequelizeModel<UserImportModel> {
|
export class UserImportModel extends SequelizeModel<UserImportModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
filename: string
|
declare filename: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
state: UserImportStateType
|
declare state: UserImportStateType
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column(DataType.TEXT)
|
@Column(DataType.TEXT)
|
||||||
error: string
|
declare error: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column(DataType.JSONB)
|
@Column(DataType.JSONB)
|
||||||
resultSummary: UserImportResultSummary
|
declare resultSummary: UserImportResultSummary
|
||||||
|
|
||||||
@ForeignKey(() => UserModel)
|
@ForeignKey(() => UserModel)
|
||||||
@Column
|
@Column
|
||||||
userId: number
|
declare userId: number
|
||||||
|
|
||||||
@BelongsTo(() => UserModel, {
|
@BelongsTo(() => UserModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -51,7 +51,7 @@ export class UserImportModel extends SequelizeModel<UserImportModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
User: Awaited<UserModel>
|
declare User: Awaited<UserModel>
|
||||||
|
|
||||||
static load (id: number | string) {
|
static load (id: number | string) {
|
||||||
return UserImportModel.findByPk<MUserImport>(id)
|
return UserImportModel.findByPk<MUserImport>(id)
|
||||||
|
|
|
@ -10,7 +10,8 @@ import {
|
||||||
CreatedAt,
|
CreatedAt,
|
||||||
Default,
|
Default,
|
||||||
ForeignKey,
|
ForeignKey,
|
||||||
Is, Table,
|
Is,
|
||||||
|
Table,
|
||||||
UpdatedAt
|
UpdatedAt
|
||||||
} from 'sequelize-typescript'
|
} from 'sequelize-typescript'
|
||||||
import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications.js'
|
import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications.js'
|
||||||
|
@ -27,7 +28,6 @@ import { UserModel } from './user.js'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class UserNotificationSettingModel extends SequelizeModel<UserNotificationSettingModel> {
|
export class UserNotificationSettingModel extends SequelizeModel<UserNotificationSettingModel> {
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Is(
|
@Is(
|
||||||
|
@ -35,7 +35,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatio
|
||||||
value => throwIfNotValid(value, isUserNotificationSettingValid, 'newVideoFromSubscription')
|
value => throwIfNotValid(value, isUserNotificationSettingValid, 'newVideoFromSubscription')
|
||||||
)
|
)
|
||||||
@Column
|
@Column
|
||||||
newVideoFromSubscription: UserNotificationSettingValueType
|
declare newVideoFromSubscription: UserNotificationSettingValueType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
|
@ -44,7 +44,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatio
|
||||||
value => throwIfNotValid(value, isUserNotificationSettingValid, 'newCommentOnMyVideo')
|
value => throwIfNotValid(value, isUserNotificationSettingValid, 'newCommentOnMyVideo')
|
||||||
)
|
)
|
||||||
@Column
|
@Column
|
||||||
newCommentOnMyVideo: UserNotificationSettingValueType
|
declare newCommentOnMyVideo: UserNotificationSettingValueType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
|
@ -53,7 +53,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatio
|
||||||
value => throwIfNotValid(value, isUserNotificationSettingValid, 'abuseAsModerator')
|
value => throwIfNotValid(value, isUserNotificationSettingValid, 'abuseAsModerator')
|
||||||
)
|
)
|
||||||
@Column
|
@Column
|
||||||
abuseAsModerator: UserNotificationSettingValueType
|
declare abuseAsModerator: UserNotificationSettingValueType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
|
@ -62,7 +62,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatio
|
||||||
value => throwIfNotValid(value, isUserNotificationSettingValid, 'videoAutoBlacklistAsModerator')
|
value => throwIfNotValid(value, isUserNotificationSettingValid, 'videoAutoBlacklistAsModerator')
|
||||||
)
|
)
|
||||||
@Column
|
@Column
|
||||||
videoAutoBlacklistAsModerator: UserNotificationSettingValueType
|
declare videoAutoBlacklistAsModerator: UserNotificationSettingValueType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
|
@ -71,7 +71,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatio
|
||||||
value => throwIfNotValid(value, isUserNotificationSettingValid, 'blacklistOnMyVideo')
|
value => throwIfNotValid(value, isUserNotificationSettingValid, 'blacklistOnMyVideo')
|
||||||
)
|
)
|
||||||
@Column
|
@Column
|
||||||
blacklistOnMyVideo: UserNotificationSettingValueType
|
declare blacklistOnMyVideo: UserNotificationSettingValueType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
|
@ -80,7 +80,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatio
|
||||||
value => throwIfNotValid(value, isUserNotificationSettingValid, 'myVideoPublished')
|
value => throwIfNotValid(value, isUserNotificationSettingValid, 'myVideoPublished')
|
||||||
)
|
)
|
||||||
@Column
|
@Column
|
||||||
myVideoPublished: UserNotificationSettingValueType
|
declare myVideoPublished: UserNotificationSettingValueType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
|
@ -89,7 +89,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatio
|
||||||
value => throwIfNotValid(value, isUserNotificationSettingValid, 'myVideoImportFinished')
|
value => throwIfNotValid(value, isUserNotificationSettingValid, 'myVideoImportFinished')
|
||||||
)
|
)
|
||||||
@Column
|
@Column
|
||||||
myVideoImportFinished: UserNotificationSettingValueType
|
declare myVideoImportFinished: UserNotificationSettingValueType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
|
@ -98,7 +98,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatio
|
||||||
value => throwIfNotValid(value, isUserNotificationSettingValid, 'newUserRegistration')
|
value => throwIfNotValid(value, isUserNotificationSettingValid, 'newUserRegistration')
|
||||||
)
|
)
|
||||||
@Column
|
@Column
|
||||||
newUserRegistration: UserNotificationSettingValueType
|
declare newUserRegistration: UserNotificationSettingValueType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
|
@ -107,7 +107,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatio
|
||||||
value => throwIfNotValid(value, isUserNotificationSettingValid, 'newInstanceFollower')
|
value => throwIfNotValid(value, isUserNotificationSettingValid, 'newInstanceFollower')
|
||||||
)
|
)
|
||||||
@Column
|
@Column
|
||||||
newInstanceFollower: UserNotificationSettingValueType
|
declare newInstanceFollower: UserNotificationSettingValueType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
|
@ -116,7 +116,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatio
|
||||||
value => throwIfNotValid(value, isUserNotificationSettingValid, 'autoInstanceFollowing')
|
value => throwIfNotValid(value, isUserNotificationSettingValid, 'autoInstanceFollowing')
|
||||||
)
|
)
|
||||||
@Column
|
@Column
|
||||||
autoInstanceFollowing: UserNotificationSettingValueType
|
declare autoInstanceFollowing: UserNotificationSettingValueType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
|
@ -125,7 +125,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatio
|
||||||
value => throwIfNotValid(value, isUserNotificationSettingValid, 'newFollow')
|
value => throwIfNotValid(value, isUserNotificationSettingValid, 'newFollow')
|
||||||
)
|
)
|
||||||
@Column
|
@Column
|
||||||
newFollow: UserNotificationSettingValueType
|
declare newFollow: UserNotificationSettingValueType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
|
@ -134,7 +134,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatio
|
||||||
value => throwIfNotValid(value, isUserNotificationSettingValid, 'commentMention')
|
value => throwIfNotValid(value, isUserNotificationSettingValid, 'commentMention')
|
||||||
)
|
)
|
||||||
@Column
|
@Column
|
||||||
commentMention: UserNotificationSettingValueType
|
declare commentMention: UserNotificationSettingValueType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
|
@ -143,7 +143,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatio
|
||||||
value => throwIfNotValid(value, isUserNotificationSettingValid, 'abuseStateChange')
|
value => throwIfNotValid(value, isUserNotificationSettingValid, 'abuseStateChange')
|
||||||
)
|
)
|
||||||
@Column
|
@Column
|
||||||
abuseStateChange: UserNotificationSettingValueType
|
declare abuseStateChange: UserNotificationSettingValueType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
|
@ -152,7 +152,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatio
|
||||||
value => throwIfNotValid(value, isUserNotificationSettingValid, 'abuseNewMessage')
|
value => throwIfNotValid(value, isUserNotificationSettingValid, 'abuseNewMessage')
|
||||||
)
|
)
|
||||||
@Column
|
@Column
|
||||||
abuseNewMessage: UserNotificationSettingValueType
|
declare abuseNewMessage: UserNotificationSettingValueType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
|
@ -161,7 +161,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatio
|
||||||
value => throwIfNotValid(value, isUserNotificationSettingValid, 'newPeerTubeVersion')
|
value => throwIfNotValid(value, isUserNotificationSettingValid, 'newPeerTubeVersion')
|
||||||
)
|
)
|
||||||
@Column
|
@Column
|
||||||
newPeerTubeVersion: UserNotificationSettingValueType
|
declare newPeerTubeVersion: UserNotificationSettingValueType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
|
@ -170,7 +170,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatio
|
||||||
value => throwIfNotValid(value, isUserNotificationSettingValid, 'newPluginVersion')
|
value => throwIfNotValid(value, isUserNotificationSettingValid, 'newPluginVersion')
|
||||||
)
|
)
|
||||||
@Column
|
@Column
|
||||||
newPluginVersion: UserNotificationSettingValueType
|
declare newPluginVersion: UserNotificationSettingValueType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
|
@ -179,7 +179,7 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatio
|
||||||
value => throwIfNotValid(value, isUserNotificationSettingValid, 'myVideoStudioEditionFinished')
|
value => throwIfNotValid(value, isUserNotificationSettingValid, 'myVideoStudioEditionFinished')
|
||||||
)
|
)
|
||||||
@Column
|
@Column
|
||||||
myVideoStudioEditionFinished: UserNotificationSettingValueType
|
declare myVideoStudioEditionFinished: UserNotificationSettingValueType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
|
@ -188,11 +188,11 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatio
|
||||||
value => throwIfNotValid(value, isUserNotificationSettingValid, 'myVideoTranscriptionGenerated')
|
value => throwIfNotValid(value, isUserNotificationSettingValid, 'myVideoTranscriptionGenerated')
|
||||||
)
|
)
|
||||||
@Column
|
@Column
|
||||||
myVideoTranscriptionGenerated: UserNotificationSettingValueType
|
declare myVideoTranscriptionGenerated: UserNotificationSettingValueType
|
||||||
|
|
||||||
@ForeignKey(() => UserModel)
|
@ForeignKey(() => UserModel)
|
||||||
@Column
|
@Column
|
||||||
userId: number
|
declare userId: number
|
||||||
|
|
||||||
@BelongsTo(() => UserModel, {
|
@BelongsTo(() => UserModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -200,13 +200,13 @@ export class UserNotificationSettingModel extends SequelizeModel<UserNotificatio
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
User: Awaited<UserModel>
|
declare User: Awaited<UserModel>
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@AfterUpdate
|
@AfterUpdate
|
||||||
@AfterDestroy
|
@AfterDestroy
|
||||||
|
|
|
@ -116,23 +116,23 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Is('UserNotificationType', value => throwIfNotValid(value, isUserNotificationTypeValid, 'type'))
|
@Is('UserNotificationType', value => throwIfNotValid(value, isUserNotificationTypeValid, 'type'))
|
||||||
@Column
|
@Column
|
||||||
type: UserNotificationType_Type
|
declare type: UserNotificationType_Type
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(false)
|
@Default(false)
|
||||||
@Is('UserNotificationRead', value => throwIfNotValid(value, isBooleanValid, 'read'))
|
@Is('UserNotificationRead', value => throwIfNotValid(value, isBooleanValid, 'read'))
|
||||||
@Column
|
@Column
|
||||||
read: boolean
|
declare read: boolean
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => UserModel)
|
@ForeignKey(() => UserModel)
|
||||||
@Column
|
@Column
|
||||||
userId: number
|
declare userId: number
|
||||||
|
|
||||||
@BelongsTo(() => UserModel, {
|
@BelongsTo(() => UserModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -140,11 +140,11 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
User: Awaited<UserModel>
|
declare User: Awaited<UserModel>
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -152,11 +152,11 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
|
|
||||||
@ForeignKey(() => VideoCommentModel)
|
@ForeignKey(() => VideoCommentModel)
|
||||||
@Column
|
@Column
|
||||||
commentId: number
|
declare commentId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoCommentModel, {
|
@BelongsTo(() => VideoCommentModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -164,11 +164,11 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
VideoComment: Awaited<VideoCommentModel>
|
declare VideoComment: Awaited<VideoCommentModel>
|
||||||
|
|
||||||
@ForeignKey(() => AbuseModel)
|
@ForeignKey(() => AbuseModel)
|
||||||
@Column
|
@Column
|
||||||
abuseId: number
|
declare abuseId: number
|
||||||
|
|
||||||
@BelongsTo(() => AbuseModel, {
|
@BelongsTo(() => AbuseModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -176,11 +176,11 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Abuse: Awaited<AbuseModel>
|
declare Abuse: Awaited<AbuseModel>
|
||||||
|
|
||||||
@ForeignKey(() => VideoBlacklistModel)
|
@ForeignKey(() => VideoBlacklistModel)
|
||||||
@Column
|
@Column
|
||||||
videoBlacklistId: number
|
declare videoBlacklistId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoBlacklistModel, {
|
@BelongsTo(() => VideoBlacklistModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -188,11 +188,11 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
VideoBlacklist: Awaited<VideoBlacklistModel>
|
declare VideoBlacklist: Awaited<VideoBlacklistModel>
|
||||||
|
|
||||||
@ForeignKey(() => VideoImportModel)
|
@ForeignKey(() => VideoImportModel)
|
||||||
@Column
|
@Column
|
||||||
videoImportId: number
|
declare videoImportId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoImportModel, {
|
@BelongsTo(() => VideoImportModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -200,11 +200,11 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
VideoImport: Awaited<VideoImportModel>
|
declare VideoImport: Awaited<VideoImportModel>
|
||||||
|
|
||||||
@ForeignKey(() => AccountModel)
|
@ForeignKey(() => AccountModel)
|
||||||
@Column
|
@Column
|
||||||
accountId: number
|
declare accountId: number
|
||||||
|
|
||||||
@BelongsTo(() => AccountModel, {
|
@BelongsTo(() => AccountModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -212,11 +212,11 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Account: Awaited<AccountModel>
|
declare Account: Awaited<AccountModel>
|
||||||
|
|
||||||
@ForeignKey(() => ActorFollowModel)
|
@ForeignKey(() => ActorFollowModel)
|
||||||
@Column
|
@Column
|
||||||
actorFollowId: number
|
declare actorFollowId: number
|
||||||
|
|
||||||
@BelongsTo(() => ActorFollowModel, {
|
@BelongsTo(() => ActorFollowModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -224,11 +224,11 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
ActorFollow: Awaited<ActorFollowModel>
|
declare ActorFollow: Awaited<ActorFollowModel>
|
||||||
|
|
||||||
@ForeignKey(() => PluginModel)
|
@ForeignKey(() => PluginModel)
|
||||||
@Column
|
@Column
|
||||||
pluginId: number
|
declare pluginId: number
|
||||||
|
|
||||||
@BelongsTo(() => PluginModel, {
|
@BelongsTo(() => PluginModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -236,11 +236,11 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Plugin: Awaited<PluginModel>
|
declare Plugin: Awaited<PluginModel>
|
||||||
|
|
||||||
@ForeignKey(() => ApplicationModel)
|
@ForeignKey(() => ApplicationModel)
|
||||||
@Column
|
@Column
|
||||||
applicationId: number
|
declare applicationId: number
|
||||||
|
|
||||||
@BelongsTo(() => ApplicationModel, {
|
@BelongsTo(() => ApplicationModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -248,11 +248,11 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Application: Awaited<ApplicationModel>
|
declare Application: Awaited<ApplicationModel>
|
||||||
|
|
||||||
@ForeignKey(() => UserRegistrationModel)
|
@ForeignKey(() => UserRegistrationModel)
|
||||||
@Column
|
@Column
|
||||||
userRegistrationId: number
|
declare userRegistrationId: number
|
||||||
|
|
||||||
@BelongsTo(() => UserRegistrationModel, {
|
@BelongsTo(() => UserRegistrationModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -260,11 +260,11 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
UserRegistration: Awaited<UserRegistrationModel>
|
declare UserRegistration: Awaited<UserRegistrationModel>
|
||||||
|
|
||||||
@ForeignKey(() => VideoCaptionModel)
|
@ForeignKey(() => VideoCaptionModel)
|
||||||
@Column
|
@Column
|
||||||
videoCaptionId: number
|
declare videoCaptionId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoCaptionModel, {
|
@BelongsTo(() => VideoCaptionModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -272,7 +272,7 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
VideoCaption: Awaited<VideoCaptionModel>
|
declare VideoCaption: Awaited<VideoCaptionModel>
|
||||||
|
|
||||||
static listForApi (options: {
|
static listForApi (options: {
|
||||||
userId: number
|
userId: number
|
||||||
|
|
|
@ -18,7 +18,8 @@ import {
|
||||||
DataType,
|
DataType,
|
||||||
ForeignKey,
|
ForeignKey,
|
||||||
Is,
|
Is,
|
||||||
IsEmail, Table,
|
IsEmail,
|
||||||
|
Table,
|
||||||
UpdatedAt
|
UpdatedAt
|
||||||
} from 'sequelize-typescript'
|
} from 'sequelize-typescript'
|
||||||
import { isUserDisplayNameValid, isUserEmailVerifiedValid, isUserPasswordValid } from '../../helpers/custom-validators/users.js'
|
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> {
|
export class UserRegistrationModel extends SequelizeModel<UserRegistrationModel> {
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('RegistrationState', value => throwIfNotValid(value, isRegistrationStateValid, 'state'))
|
@Is('RegistrationState', value => throwIfNotValid(value, isRegistrationStateValid, 'state'))
|
||||||
@Column
|
@Column
|
||||||
state: UserRegistrationStateType
|
declare state: UserRegistrationStateType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('RegistrationReason', value => throwIfNotValid(value, isRegistrationReasonValid, 'registration reason'))
|
@Is('RegistrationReason', value => throwIfNotValid(value, isRegistrationReasonValid, 'registration reason'))
|
||||||
@Column(DataType.TEXT)
|
@Column(DataType.TEXT)
|
||||||
registrationReason: string
|
declare registrationReason: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Is('RegistrationModerationResponse', value => throwIfNotValid(value, isRegistrationModerationResponseValid, 'moderation response', true))
|
@Is('RegistrationModerationResponse', value => throwIfNotValid(value, isRegistrationModerationResponseValid, 'moderation response', true))
|
||||||
@Column(DataType.TEXT)
|
@Column(DataType.TEXT)
|
||||||
moderationResponse: string
|
declare moderationResponse: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Is('RegistrationPassword', value => throwIfNotValid(value, isUserPasswordValid, 'registration password', true))
|
@Is('RegistrationPassword', value => throwIfNotValid(value, isUserPasswordValid, 'registration password', true))
|
||||||
@Column
|
@Column
|
||||||
password: string
|
declare password: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
username: string
|
declare username: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@IsEmail
|
@IsEmail
|
||||||
@Column(DataType.STRING(400))
|
@Column(DataType.STRING(400))
|
||||||
email: string
|
declare email: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Is('RegistrationEmailVerified', value => throwIfNotValid(value, isUserEmailVerifiedValid, 'email verified boolean', true))
|
@Is('RegistrationEmailVerified', value => throwIfNotValid(value, isUserEmailVerifiedValid, 'email verified boolean', true))
|
||||||
@Column
|
@Column
|
||||||
emailVerified: boolean
|
declare emailVerified: boolean
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Is('RegistrationAccountDisplayName', value => throwIfNotValid(value, isUserDisplayNameValid, 'account display name', true))
|
@Is('RegistrationAccountDisplayName', value => throwIfNotValid(value, isUserDisplayNameValid, 'account display name', true))
|
||||||
@Column
|
@Column
|
||||||
accountDisplayName: string
|
declare accountDisplayName: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Is('ChannelHandle', value => throwIfNotValid(value, isVideoChannelDisplayNameValid, 'channel handle', true))
|
@Is('ChannelHandle', value => throwIfNotValid(value, isVideoChannelDisplayNameValid, 'channel handle', true))
|
||||||
@Column
|
@Column
|
||||||
channelHandle: string
|
declare channelHandle: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Is('ChannelDisplayName', value => throwIfNotValid(value, isVideoChannelDisplayNameValid, 'channel display name', true))
|
@Is('ChannelDisplayName', value => throwIfNotValid(value, isVideoChannelDisplayNameValid, 'channel display name', true))
|
||||||
@Column
|
@Column
|
||||||
channelDisplayName: string
|
declare channelDisplayName: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
processedAt: Date
|
declare processedAt: Date
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => UserModel)
|
@ForeignKey(() => UserModel)
|
||||||
@Column
|
@Column
|
||||||
userId: number
|
declare userId: number
|
||||||
|
|
||||||
@BelongsTo(() => UserModel, {
|
@BelongsTo(() => UserModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -118,7 +118,7 @@ export class UserRegistrationModel extends SequelizeModel<UserRegistrationModel>
|
||||||
},
|
},
|
||||||
onDelete: 'SET NULL'
|
onDelete: 'SET NULL'
|
||||||
})
|
})
|
||||||
User: Awaited<UserModel>
|
declare User: Awaited<UserModel>
|
||||||
|
|
||||||
@BeforeCreate
|
@BeforeCreate
|
||||||
static async cryptPasswordIfNeeded (instance: UserRegistrationModel) {
|
static async cryptPasswordIfNeeded (instance: UserRegistrationModel) {
|
||||||
|
|
|
@ -25,19 +25,19 @@ import { getSort } from '../shared/sort.js'
|
||||||
})
|
})
|
||||||
export class UserVideoHistoryModel extends SequelizeModel<UserVideoHistoryModel> {
|
export class UserVideoHistoryModel extends SequelizeModel<UserVideoHistoryModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@IsInt
|
@IsInt
|
||||||
@Column
|
@Column
|
||||||
currentTime: number
|
declare currentTime: number
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -45,11 +45,11 @@ export class UserVideoHistoryModel extends SequelizeModel<UserVideoHistoryModel>
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
|
|
||||||
@ForeignKey(() => UserModel)
|
@ForeignKey(() => UserModel)
|
||||||
@Column
|
@Column
|
||||||
userId: number
|
declare userId: number
|
||||||
|
|
||||||
@BelongsTo(() => UserModel, {
|
@BelongsTo(() => UserModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -57,7 +57,7 @@ export class UserVideoHistoryModel extends SequelizeModel<UserVideoHistoryModel>
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
User: Awaited<UserModel>
|
declare User: Awaited<UserModel>
|
||||||
|
|
||||||
// FIXME: have to specify the result type to not break peertube typings generation
|
// FIXME: have to specify the result type to not break peertube typings generation
|
||||||
static listForApi (user: MUserAccountId, start: number, count: number, search?: string): Promise<ResultList<VideoModel>> {
|
static listForApi (user: MUserAccountId, start: number, count: number, search?: string): Promise<ResultList<VideoModel>> {
|
||||||
|
|
|
@ -292,79 +292,79 @@ export class UserModel extends SequelizeModel<UserModel> {
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Is('UserPassword', value => throwIfNotValid(value, isUserPasswordValid, 'user password', true))
|
@Is('UserPassword', value => throwIfNotValid(value, isUserPasswordValid, 'user password', true))
|
||||||
@Column
|
@Column
|
||||||
password: string
|
declare password: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
username: string
|
declare username: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@IsEmail
|
@IsEmail
|
||||||
@Column(DataType.STRING(400))
|
@Column(DataType.STRING(400))
|
||||||
email: string
|
declare email: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@IsEmail
|
@IsEmail
|
||||||
@Column(DataType.STRING(400))
|
@Column(DataType.STRING(400))
|
||||||
pendingEmail: string
|
declare pendingEmail: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Is('UserEmailVerified', value => throwIfNotValid(value, isUserEmailVerifiedValid, 'email verified boolean', true))
|
@Is('UserEmailVerified', value => throwIfNotValid(value, isUserEmailVerifiedValid, 'email verified boolean', true))
|
||||||
@Column
|
@Column
|
||||||
emailVerified: boolean
|
declare emailVerified: boolean
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('UserNSFWPolicy', value => throwIfNotValid(value, isUserNSFWPolicyValid, 'NSFW policy'))
|
@Is('UserNSFWPolicy', value => throwIfNotValid(value, isUserNSFWPolicyValid, 'NSFW policy'))
|
||||||
@Column(DataType.ENUM(...Object.values(NSFW_POLICY_TYPES)))
|
@Column(DataType.ENUM(...Object.values(NSFW_POLICY_TYPES)))
|
||||||
nsfwPolicy: NSFWPolicyType
|
declare nsfwPolicy: NSFWPolicyType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(0)
|
@Default(0)
|
||||||
@Is('UserNSFWFlagsDisplayed', value => throwIfNotValid(value, isNSFWFlagsValid, 'NSFW flags'))
|
@Is('UserNSFWFlagsDisplayed', value => throwIfNotValid(value, isNSFWFlagsValid, 'NSFW flags'))
|
||||||
@Column
|
@Column
|
||||||
nsfwFlagsDisplayed: number
|
declare nsfwFlagsDisplayed: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(0)
|
@Default(0)
|
||||||
@Is('UserNSFWFlagsHidden', value => throwIfNotValid(value, isNSFWFlagsValid, 'NSFW flags'))
|
@Is('UserNSFWFlagsHidden', value => throwIfNotValid(value, isNSFWFlagsValid, 'NSFW flags'))
|
||||||
@Column
|
@Column
|
||||||
nsfwFlagsHidden: number
|
declare nsfwFlagsHidden: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(0)
|
@Default(0)
|
||||||
@Is('nsfwFlagsBlurred', value => throwIfNotValid(value, isNSFWFlagsValid, 'NSFW flags'))
|
@Is('nsfwFlagsBlurred', value => throwIfNotValid(value, isNSFWFlagsValid, 'NSFW flags'))
|
||||||
@Column
|
@Column
|
||||||
nsfwFlagsBlurred: number
|
declare nsfwFlagsBlurred: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(0)
|
@Default(0)
|
||||||
@Is('UserNSFWFlagsWarned', value => throwIfNotValid(value, isNSFWFlagsValid, 'NSFW flags'))
|
@Is('UserNSFWFlagsWarned', value => throwIfNotValid(value, isNSFWFlagsValid, 'NSFW flags'))
|
||||||
@Column
|
@Column
|
||||||
nsfwFlagsWarned: number
|
declare nsfwFlagsWarned: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('p2pEnabled', value => throwIfNotValid(value, isUserP2PEnabledValid, 'P2P enabled'))
|
@Is('p2pEnabled', value => throwIfNotValid(value, isUserP2PEnabledValid, 'P2P enabled'))
|
||||||
@Column
|
@Column
|
||||||
p2pEnabled: boolean
|
declare p2pEnabled: boolean
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(true)
|
@Default(true)
|
||||||
@Is('UserVideosHistoryEnabled', value => throwIfNotValid(value, isUserVideosHistoryEnabledValid, 'Videos history enabled'))
|
@Is('UserVideosHistoryEnabled', value => throwIfNotValid(value, isUserVideosHistoryEnabledValid, 'Videos history enabled'))
|
||||||
@Column
|
@Column
|
||||||
videosHistoryEnabled: boolean
|
declare videosHistoryEnabled: boolean
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(true)
|
@Default(true)
|
||||||
@Is('UserAutoPlayVideo', value => throwIfNotValid(value, isUserAutoPlayVideoValid, 'auto play video boolean'))
|
@Is('UserAutoPlayVideo', value => throwIfNotValid(value, isUserAutoPlayVideoValid, 'auto play video boolean'))
|
||||||
@Column
|
@Column
|
||||||
autoPlayVideo: boolean
|
declare autoPlayVideo: boolean
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(false)
|
@Default(false)
|
||||||
@Is('UserAutoPlayNextVideo', value => throwIfNotValid(value, isUserAutoPlayNextVideoValid, 'auto play next video boolean'))
|
@Is('UserAutoPlayNextVideo', value => throwIfNotValid(value, isUserAutoPlayNextVideoValid, 'auto play next video boolean'))
|
||||||
@Column
|
@Column
|
||||||
autoPlayNextVideo: boolean
|
declare autoPlayNextVideo: boolean
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(true)
|
@Default(true)
|
||||||
|
@ -373,56 +373,56 @@ export class UserModel extends SequelizeModel<UserModel> {
|
||||||
value => throwIfNotValid(value, isUserAutoPlayNextVideoPlaylistValid, 'auto play next video for playlists boolean')
|
value => throwIfNotValid(value, isUserAutoPlayNextVideoPlaylistValid, 'auto play next video for playlists boolean')
|
||||||
)
|
)
|
||||||
@Column
|
@Column
|
||||||
autoPlayNextVideoPlaylist: boolean
|
declare autoPlayNextVideoPlaylist: boolean
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column(DataType.STRING)
|
@Column(DataType.STRING)
|
||||||
language: string
|
declare language: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Is('UserVideoLanguages', value => throwIfNotValid(value, isUserVideoLanguages, 'video languages'))
|
@Is('UserVideoLanguages', value => throwIfNotValid(value, isUserVideoLanguages, 'video languages'))
|
||||||
@Column(DataType.ARRAY(DataType.STRING))
|
@Column(DataType.ARRAY(DataType.STRING))
|
||||||
videoLanguages: string[]
|
declare videoLanguages: string[]
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(UserAdminFlag.NONE)
|
@Default(UserAdminFlag.NONE)
|
||||||
@Is('UserAdminFlags', value => throwIfNotValid(value, isUserAdminFlagsValid, 'user admin flags'))
|
@Is('UserAdminFlags', value => throwIfNotValid(value, isUserAdminFlagsValid, 'user admin flags'))
|
||||||
@Column
|
@Column
|
||||||
adminFlags: UserAdminFlagType
|
declare adminFlags: UserAdminFlagType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(false)
|
@Default(false)
|
||||||
@Is('UserBlocked', value => throwIfNotValid(value, isUserBlockedValid, 'blocked boolean'))
|
@Is('UserBlocked', value => throwIfNotValid(value, isUserBlockedValid, 'blocked boolean'))
|
||||||
@Column
|
@Column
|
||||||
blocked: boolean
|
declare blocked: boolean
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Is('UserBlockedReason', value => throwIfNotValid(value, isUserBlockedReasonValid, 'blocked reason', true))
|
@Is('UserBlockedReason', value => throwIfNotValid(value, isUserBlockedReasonValid, 'blocked reason', true))
|
||||||
@Column
|
@Column
|
||||||
blockedReason: string
|
declare blockedReason: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('UserRole', value => throwIfNotValid(value, isUserRoleValid, 'role'))
|
@Is('UserRole', value => throwIfNotValid(value, isUserRoleValid, 'role'))
|
||||||
@Column
|
@Column
|
||||||
role: UserRoleType
|
declare role: UserRoleType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('UserVideoQuota', value => throwIfNotValid(value, isUserVideoQuotaValid, 'video quota'))
|
@Is('UserVideoQuota', value => throwIfNotValid(value, isUserVideoQuotaValid, 'video quota'))
|
||||||
@Column(DataType.BIGINT)
|
@Column(DataType.BIGINT)
|
||||||
videoQuota: number
|
declare videoQuota: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('UserVideoQuotaDaily', value => throwIfNotValid(value, isUserVideoQuotaDailyValid, 'video quota daily'))
|
@Is('UserVideoQuotaDaily', value => throwIfNotValid(value, isUserVideoQuotaDailyValid, 'video quota daily'))
|
||||||
@Column(DataType.BIGINT)
|
@Column(DataType.BIGINT)
|
||||||
videoQuotaDaily: number
|
declare videoQuotaDaily: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(DEFAULT_USER_THEME_NAME)
|
@Default(DEFAULT_USER_THEME_NAME)
|
||||||
@Is('UserTheme', value => throwIfNotValid(value, isThemeNameValid, 'theme'))
|
@Is('UserTheme', value => throwIfNotValid(value, isThemeNameValid, 'theme'))
|
||||||
@Column
|
@Column
|
||||||
theme: string
|
declare theme: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(false)
|
@Default(false)
|
||||||
|
@ -431,7 +431,7 @@ export class UserModel extends SequelizeModel<UserModel> {
|
||||||
value => throwIfNotValid(value, isUserNoModal, 'no instance config warning modal')
|
value => throwIfNotValid(value, isUserNoModal, 'no instance config warning modal')
|
||||||
)
|
)
|
||||||
@Column
|
@Column
|
||||||
noInstanceConfigWarningModal: boolean
|
declare noInstanceConfigWarningModal: boolean
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(false)
|
@Default(false)
|
||||||
|
@ -440,7 +440,7 @@ export class UserModel extends SequelizeModel<UserModel> {
|
||||||
value => throwIfNotValid(value, isUserNoModal, 'no welcome modal')
|
value => throwIfNotValid(value, isUserNoModal, 'no welcome modal')
|
||||||
)
|
)
|
||||||
@Column
|
@Column
|
||||||
noWelcomeModal: boolean
|
declare noWelcomeModal: boolean
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(false)
|
@Default(false)
|
||||||
|
@ -449,72 +449,72 @@ export class UserModel extends SequelizeModel<UserModel> {
|
||||||
value => throwIfNotValid(value, isUserNoModal, 'no account setup warning modal')
|
value => throwIfNotValid(value, isUserNoModal, 'no account setup warning modal')
|
||||||
)
|
)
|
||||||
@Column
|
@Column
|
||||||
noAccountSetupWarningModal: boolean
|
declare noAccountSetupWarningModal: boolean
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Column
|
@Column
|
||||||
pluginAuth: string
|
declare pluginAuth: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(DataType.UUIDV4)
|
@Default(DataType.UUIDV4)
|
||||||
@IsUUID(4)
|
@IsUUID(4)
|
||||||
@Column(DataType.UUID)
|
@Column(DataType.UUID)
|
||||||
feedToken: string
|
declare feedToken: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Column
|
@Column
|
||||||
lastLoginDate: Date
|
declare lastLoginDate: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(false)
|
@Default(false)
|
||||||
@Column
|
@Column
|
||||||
emailPublic: boolean
|
declare emailPublic: boolean
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Column
|
@Column
|
||||||
otpSecret: string
|
declare otpSecret: string
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@HasOne(() => AccountModel, {
|
@HasOne(() => AccountModel, {
|
||||||
foreignKey: 'userId',
|
foreignKey: 'userId',
|
||||||
onDelete: 'cascade',
|
onDelete: 'cascade',
|
||||||
hooks: true
|
hooks: true
|
||||||
})
|
})
|
||||||
Account: Awaited<AccountModel>
|
declare Account: Awaited<AccountModel>
|
||||||
|
|
||||||
@HasOne(() => UserNotificationSettingModel, {
|
@HasOne(() => UserNotificationSettingModel, {
|
||||||
foreignKey: 'userId',
|
foreignKey: 'userId',
|
||||||
onDelete: 'cascade',
|
onDelete: 'cascade',
|
||||||
hooks: true
|
hooks: true
|
||||||
})
|
})
|
||||||
NotificationSetting: Awaited<UserNotificationSettingModel>
|
declare NotificationSetting: Awaited<UserNotificationSettingModel>
|
||||||
|
|
||||||
@HasMany(() => VideoImportModel, {
|
@HasMany(() => VideoImportModel, {
|
||||||
foreignKey: 'userId',
|
foreignKey: 'userId',
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
VideoImports: Awaited<VideoImportModel>[]
|
declare VideoImports: Awaited<VideoImportModel>[]
|
||||||
|
|
||||||
@HasMany(() => OAuthTokenModel, {
|
@HasMany(() => OAuthTokenModel, {
|
||||||
foreignKey: 'userId',
|
foreignKey: 'userId',
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
OAuthTokens: Awaited<OAuthTokenModel>[]
|
declare OAuthTokens: Awaited<OAuthTokenModel>[]
|
||||||
|
|
||||||
@HasMany(() => UserExportModel, {
|
@HasMany(() => UserExportModel, {
|
||||||
foreignKey: 'userId',
|
foreignKey: 'userId',
|
||||||
onDelete: 'cascade',
|
onDelete: 'cascade',
|
||||||
hooks: true
|
hooks: true
|
||||||
})
|
})
|
||||||
UserExports: Awaited<UserExportModel>[]
|
declare UserExports: Awaited<UserExportModel>[]
|
||||||
|
|
||||||
// Used if we already set an encrypted password in user model
|
// Used if we already set an encrypted password in user model
|
||||||
skipPasswordEncryption = false
|
skipPasswordEncryption = false
|
||||||
|
|
|
@ -18,26 +18,25 @@ import { SequelizeModel } from '../shared/index.js'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class ScheduleVideoUpdateModel extends SequelizeModel<ScheduleVideoUpdateModel> {
|
export class ScheduleVideoUpdateModel extends SequelizeModel<ScheduleVideoUpdateModel> {
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Column
|
@Column
|
||||||
updateAt: Date
|
declare updateAt: Date
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Column(DataType.INTEGER)
|
@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
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -45,7 +44,7 @@ export class ScheduleVideoUpdateModel extends SequelizeModel<ScheduleVideoUpdate
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
|
|
||||||
static areVideosToUpdate () {
|
static areVideosToUpdate () {
|
||||||
const query = {
|
const query = {
|
||||||
|
|
|
@ -13,14 +13,10 @@ export type FileQueryOptions = {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Fetch files (web videos and streaming playlist) according to a video
|
* Fetch files (web videos and streaming playlist) according to a video
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export class VideoFileQueryBuilder extends AbstractVideoQueryBuilder {
|
export class VideoFileQueryBuilder extends AbstractVideoQueryBuilder {
|
||||||
protected attributes: { [key: string]: string }
|
|
||||||
|
|
||||||
constructor (protected readonly sequelize: Sequelize) {
|
constructor (protected readonly sequelize: Sequelize) {
|
||||||
super(sequelize, 'get')
|
super(sequelize, 'get')
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,21 +6,19 @@ import { VideoModelBuilder } from './shared/video-model-builder.js'
|
||||||
import { VideoTableAttributes } from './shared/video-table-attributes.js'
|
import { VideoTableAttributes } from './shared/video-table-attributes.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Build a GET SQL query, fetch rows and create the video model
|
* Build a GET SQL query, fetch rows and create the video model
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export type GetType =
|
export type GetType =
|
||||||
'api' |
|
| 'api'
|
||||||
'full' |
|
| 'full'
|
||||||
'account-blacklist-files' |
|
| 'account-blacklist-files'
|
||||||
'account' |
|
| 'account'
|
||||||
'all-files' |
|
| 'all-files'
|
||||||
'thumbnails' |
|
| 'thumbnails'
|
||||||
'thumbnails-blacklist' |
|
| 'thumbnails-blacklist'
|
||||||
'id' |
|
| 'id'
|
||||||
'blacklist-rights'
|
| 'blacklist-rights'
|
||||||
|
|
||||||
export type BuildVideoGetQueryOptions = {
|
export type BuildVideoGetQueryOptions = {
|
||||||
id?: number | string
|
id?: number | string
|
||||||
|
@ -91,8 +89,6 @@ export class VideoModelGetQueryBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class VideosModelGetQuerySubBuilder extends AbstractVideoQueryBuilder {
|
export class VideosModelGetQuerySubBuilder extends AbstractVideoQueryBuilder {
|
||||||
protected attributes: { [key: string]: string }
|
|
||||||
|
|
||||||
protected webVideoFilesQuery: string
|
protected webVideoFilesQuery: string
|
||||||
protected streamingPlaylistFilesQuery: string
|
protected streamingPlaylistFilesQuery: string
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,18 @@
|
||||||
import { Sequelize } from 'sequelize'
|
|
||||||
import { pick } from '@peertube/peertube-core-utils'
|
import { pick } from '@peertube/peertube-core-utils'
|
||||||
import { VideoInclude } from '@peertube/peertube-models'
|
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 { AbstractVideoQueryBuilder } from './shared/abstract-video-query-builder.js'
|
||||||
import { VideoFileQueryBuilder } from './shared/video-file-query-builder.js'
|
import { VideoFileQueryBuilder } from './shared/video-file-query-builder.js'
|
||||||
import { VideoModelBuilder } from './shared/video-model-builder.js'
|
import { VideoModelBuilder } from './shared/video-model-builder.js'
|
||||||
import { BuildVideosListQueryOptions, VideosIdListQueryBuilder } from './videos-id-list-query-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
|
* Build videos list SQL query and create video models
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export class VideosModelListQueryBuilder extends AbstractVideoQueryBuilder {
|
export class VideosModelListQueryBuilder extends AbstractVideoQueryBuilder {
|
||||||
protected attributes: { [key: string]: string }
|
|
||||||
|
|
||||||
private innerQuery: string
|
private innerQuery: string
|
||||||
private innerSort: string
|
private innerSort: string
|
||||||
|
|
||||||
|
|
|
@ -24,38 +24,37 @@ import { SequelizeModel } from '../shared/index.js'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class StoryboardModel extends SequelizeModel<StoryboardModel> {
|
export class StoryboardModel extends SequelizeModel<StoryboardModel> {
|
||||||
|
@AllowNull(false)
|
||||||
|
@Column
|
||||||
|
declare filename: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
filename: string
|
declare totalHeight: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
totalHeight: number
|
declare totalWidth: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
totalWidth: number
|
declare spriteHeight: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
spriteHeight: number
|
declare spriteWidth: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
spriteWidth: number
|
declare spriteDuration: number
|
||||||
|
|
||||||
@AllowNull(false)
|
|
||||||
@Column
|
|
||||||
spriteDuration: number
|
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.COMMONS.URL.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.COMMONS.URL.max))
|
||||||
fileUrl: string
|
declare fileUrl: string
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -63,13 +62,13 @@ export class StoryboardModel extends SequelizeModel<StoryboardModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@AfterDestroy
|
@AfterDestroy
|
||||||
static removeInstanceFile (instance: StoryboardModel) {
|
static removeInstanceFile (instance: StoryboardModel) {
|
||||||
|
|
|
@ -22,18 +22,17 @@ import { VideoModel } from './video.js'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class TagModel extends SequelizeModel<TagModel> {
|
export class TagModel extends SequelizeModel<TagModel> {
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('VideoTag', value => throwIfNotValid(value, isVideoTagValid, 'tag'))
|
@Is('VideoTag', value => throwIfNotValid(value, isVideoTagValid, 'tag'))
|
||||||
@Column
|
@Column
|
||||||
name: string
|
declare name: string
|
||||||
|
|
||||||
@BelongsToMany(() => VideoModel, {
|
@BelongsToMany(() => VideoModel, {
|
||||||
foreignKey: 'tagId',
|
foreignKey: 'tagId',
|
||||||
through: () => VideoTagModel,
|
through: () => VideoTagModel,
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
Videos: Awaited<VideoModel>[]
|
declare Videos: Awaited<VideoModel>[]
|
||||||
|
|
||||||
// threshold corresponds to how many video the field should have to be returned
|
// threshold corresponds to how many video the field should have to be returned
|
||||||
static getRandomSamples (threshold: number, count: number): Promise<string[]> {
|
static getRandomSamples (threshold: number, count: number): Promise<string[]> {
|
||||||
|
|
|
@ -13,7 +13,8 @@ import {
|
||||||
CreatedAt,
|
CreatedAt,
|
||||||
DataType,
|
DataType,
|
||||||
Default,
|
Default,
|
||||||
ForeignKey, Table,
|
ForeignKey,
|
||||||
|
Table,
|
||||||
UpdatedAt
|
UpdatedAt
|
||||||
} from 'sequelize-typescript'
|
} from 'sequelize-typescript'
|
||||||
import { logger } from '../../helpers/logger.js'
|
import { logger } from '../../helpers/logger.js'
|
||||||
|
@ -40,40 +41,39 @@ import { SequelizeModel } from '../shared/sequelize-type.js'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class ThumbnailModel extends SequelizeModel<ThumbnailModel> {
|
export class ThumbnailModel extends SequelizeModel<ThumbnailModel> {
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
filename: string
|
declare filename: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Column
|
@Column
|
||||||
height: number
|
declare height: number
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Column
|
@Column
|
||||||
width: number
|
declare width: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
type: ThumbnailType_Type
|
declare type: ThumbnailType_Type
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.COMMONS.URL.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.COMMONS.URL.max))
|
||||||
fileUrl: string
|
declare fileUrl: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
automaticallyGenerated: boolean
|
declare automaticallyGenerated: boolean
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
onDisk: boolean
|
declare onDisk: boolean
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -81,11 +81,11 @@ export class ThumbnailModel extends SequelizeModel<ThumbnailModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
|
|
||||||
@ForeignKey(() => VideoPlaylistModel)
|
@ForeignKey(() => VideoPlaylistModel)
|
||||||
@Column
|
@Column
|
||||||
videoPlaylistId: number
|
declare videoPlaylistId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoPlaylistModel, {
|
@BelongsTo(() => VideoPlaylistModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -93,13 +93,13 @@ export class ThumbnailModel extends SequelizeModel<ThumbnailModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
VideoPlaylist: Awaited<VideoPlaylistModel>
|
declare VideoPlaylist: Awaited<VideoPlaylistModel>
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
// If this thumbnail replaced existing one, track the old name
|
// If this thumbnail replaced existing one, track the old name
|
||||||
previousThumbnailFilename: string
|
previousThumbnailFilename: string
|
||||||
|
|
|
@ -19,31 +19,30 @@ import { VideoModel } from './video.js'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class VideoBlacklistModel extends SequelizeModel<VideoBlacklistModel> {
|
export class VideoBlacklistModel extends SequelizeModel<VideoBlacklistModel> {
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Is('VideoBlacklistReason', value => throwIfNotValid(value, isVideoBlacklistReasonValid, 'reason', true))
|
@Is('VideoBlacklistReason', value => throwIfNotValid(value, isVideoBlacklistReasonValid, 'reason', true))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_BLACKLIST.REASON.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_BLACKLIST.REASON.max))
|
||||||
reason: string
|
declare reason: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
unfederated: boolean
|
declare unfederated: boolean
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Is('VideoBlacklistType', value => throwIfNotValid(value, isVideoBlacklistTypeValid, 'type'))
|
@Is('VideoBlacklistType', value => throwIfNotValid(value, isVideoBlacklistTypeValid, 'type'))
|
||||||
@Column
|
@Column
|
||||||
type: VideoBlacklistType_Type
|
declare type: VideoBlacklistType_Type
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -51,7 +50,7 @@ export class VideoBlacklistModel extends SequelizeModel<VideoBlacklistModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
|
|
||||||
static listForApi (parameters: {
|
static listForApi (parameters: {
|
||||||
start: number
|
start: number
|
||||||
|
|
|
@ -75,44 +75,44 @@ const videoAttributes = [ 'id', 'name', 'remote', 'uuid', 'url', 'state', 'priva
|
||||||
})
|
})
|
||||||
export class VideoCaptionModel extends SequelizeModel<VideoCaptionModel> {
|
export class VideoCaptionModel extends SequelizeModel<VideoCaptionModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('VideoCaptionLanguage', value => throwIfNotValid(value, isVideoCaptionLanguageValid, 'language'))
|
@Is('VideoCaptionLanguage', value => throwIfNotValid(value, isVideoCaptionLanguageValid, 'language'))
|
||||||
@Column
|
@Column
|
||||||
language: string
|
declare language: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
filename: string
|
declare filename: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
m3u8Filename: string
|
declare m3u8Filename: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(FileStorage.FILE_SYSTEM)
|
@Default(FileStorage.FILE_SYSTEM)
|
||||||
@Column
|
@Column
|
||||||
storage: FileStorageType
|
declare storage: FileStorageType
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.COMMONS.URL.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.COMMONS.URL.max))
|
||||||
fileUrl: string
|
declare fileUrl: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
m3u8Url: string
|
declare m3u8Url: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
automaticallyGenerated: boolean
|
declare automaticallyGenerated: boolean
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -120,7 +120,7 @@ export class VideoCaptionModel extends SequelizeModel<VideoCaptionModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
|
|
||||||
@BeforeDestroy
|
@BeforeDestroy
|
||||||
static async removeFiles (instance: VideoCaptionModel, options) {
|
static async removeFiles (instance: VideoCaptionModel, options) {
|
||||||
|
|
|
@ -55,18 +55,18 @@ enum ScopeNames {
|
||||||
}))
|
}))
|
||||||
export class VideoChangeOwnershipModel extends SequelizeModel<VideoChangeOwnershipModel> {
|
export class VideoChangeOwnershipModel extends SequelizeModel<VideoChangeOwnershipModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
status: VideoChangeOwnershipStatusType
|
declare status: VideoChangeOwnershipStatusType
|
||||||
|
|
||||||
@ForeignKey(() => AccountModel)
|
@ForeignKey(() => AccountModel)
|
||||||
@Column
|
@Column
|
||||||
initiatorAccountId: number
|
declare initiatorAccountId: number
|
||||||
|
|
||||||
@BelongsTo(() => AccountModel, {
|
@BelongsTo(() => AccountModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -75,11 +75,11 @@ export class VideoChangeOwnershipModel extends SequelizeModel<VideoChangeOwnersh
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Initiator: Awaited<AccountModel>
|
declare Initiator: Awaited<AccountModel>
|
||||||
|
|
||||||
@ForeignKey(() => AccountModel)
|
@ForeignKey(() => AccountModel)
|
||||||
@Column
|
@Column
|
||||||
nextOwnerAccountId: number
|
declare nextOwnerAccountId: number
|
||||||
|
|
||||||
@BelongsTo(() => AccountModel, {
|
@BelongsTo(() => AccountModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -88,11 +88,11 @@ export class VideoChangeOwnershipModel extends SequelizeModel<VideoChangeOwnersh
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
NextOwner: Awaited<AccountModel>
|
declare NextOwner: Awaited<AccountModel>
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -100,7 +100,7 @@ export class VideoChangeOwnershipModel extends SequelizeModel<VideoChangeOwnersh
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
|
|
||||||
static listForApi (nextOwnerId: number, start: number, count: number, sort: string) {
|
static listForApi (nextOwnerId: number, start: number, count: number, sort: string) {
|
||||||
const query = {
|
const query = {
|
||||||
|
|
|
@ -13,7 +13,8 @@ import {
|
||||||
Default,
|
Default,
|
||||||
DefaultScope,
|
DefaultScope,
|
||||||
ForeignKey,
|
ForeignKey,
|
||||||
Is, Table,
|
Is,
|
||||||
|
Table,
|
||||||
UpdatedAt
|
UpdatedAt
|
||||||
} from 'sequelize-typescript'
|
} from 'sequelize-typescript'
|
||||||
import { AccountModel } from '../account/account.js'
|
import { AccountModel } from '../account/account.js'
|
||||||
|
@ -38,32 +39,31 @@ import { VideoChannelModel } from './video-channel.js'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class VideoChannelSyncModel extends SequelizeModel<VideoChannelSyncModel> {
|
export class VideoChannelSyncModel extends SequelizeModel<VideoChannelSyncModel> {
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Is('VideoChannelExternalChannelUrl', value => throwIfNotValid(value, isUrlValid, 'externalChannelUrl', true))
|
@Is('VideoChannelExternalChannelUrl', value => throwIfNotValid(value, isUrlValid, 'externalChannelUrl', true))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_CHANNEL_SYNCS.EXTERNAL_CHANNEL_URL.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_CHANNEL_SYNCS.EXTERNAL_CHANNEL_URL.max))
|
||||||
externalChannelUrl: string
|
declare externalChannelUrl: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(VideoChannelSyncState.WAITING_FIRST_RUN)
|
@Default(VideoChannelSyncState.WAITING_FIRST_RUN)
|
||||||
@Is('VideoChannelSyncState', value => throwIfNotValid(value, isVideoChannelSyncStateValid, 'state'))
|
@Is('VideoChannelSyncState', value => throwIfNotValid(value, isVideoChannelSyncStateValid, 'state'))
|
||||||
@Column
|
@Column
|
||||||
state: VideoChannelSyncStateType
|
declare state: VideoChannelSyncStateType
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column(DataType.DATE)
|
@Column(DataType.DATE)
|
||||||
lastSyncAt: Date
|
declare lastSyncAt: Date
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => VideoChannelModel)
|
@ForeignKey(() => VideoChannelModel)
|
||||||
@Column
|
@Column
|
||||||
videoChannelId: number
|
declare videoChannelId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoChannelModel, {
|
@BelongsTo(() => VideoChannelModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -71,7 +71,7 @@ export class VideoChannelSyncModel extends SequelizeModel<VideoChannelSyncModel>
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
VideoChannel: Awaited<VideoChannelModel>
|
declare VideoChannel: Awaited<VideoChannelModel>
|
||||||
|
|
||||||
static listByAccountForAPI (options: {
|
static listByAccountForAPI (options: {
|
||||||
accountId: number
|
accountId: number
|
||||||
|
|
|
@ -357,29 +357,29 @@ export class VideoChannelModel extends SequelizeModel<VideoChannelModel> {
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('VideoChannelName', value => throwIfNotValid(value, isVideoChannelDisplayNameValid, 'name'))
|
@Is('VideoChannelName', value => throwIfNotValid(value, isVideoChannelDisplayNameValid, 'name'))
|
||||||
@Column
|
@Column
|
||||||
name: string
|
declare name: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Is('VideoChannelDescription', value => throwIfNotValid(value, isVideoChannelDescriptionValid, 'description', true))
|
@Is('VideoChannelDescription', value => throwIfNotValid(value, isVideoChannelDescriptionValid, 'description', true))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_CHANNELS.DESCRIPTION.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_CHANNELS.DESCRIPTION.max))
|
||||||
description: string
|
declare description: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Is('VideoChannelSupport', value => throwIfNotValid(value, isVideoChannelSupportValid, 'support', true))
|
@Is('VideoChannelSupport', value => throwIfNotValid(value, isVideoChannelSupportValid, 'support', true))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_CHANNELS.SUPPORT.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_CHANNELS.SUPPORT.max))
|
||||||
support: string
|
declare support: string
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => ActorModel)
|
@ForeignKey(() => ActorModel)
|
||||||
@Column
|
@Column
|
||||||
actorId: number
|
declare actorId: number
|
||||||
|
|
||||||
@BelongsTo(() => ActorModel, {
|
@BelongsTo(() => ActorModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -387,18 +387,18 @@ export class VideoChannelModel extends SequelizeModel<VideoChannelModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Actor: Awaited<ActorModel>
|
declare Actor: Awaited<ActorModel>
|
||||||
|
|
||||||
@ForeignKey(() => AccountModel)
|
@ForeignKey(() => AccountModel)
|
||||||
@Column
|
@Column
|
||||||
accountId: number
|
declare accountId: number
|
||||||
|
|
||||||
@BelongsTo(() => AccountModel, {
|
@BelongsTo(() => AccountModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
allowNull: false
|
allowNull: false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Account: Awaited<AccountModel>
|
declare Account: Awaited<AccountModel>
|
||||||
|
|
||||||
@HasMany(() => VideoModel, {
|
@HasMany(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -408,7 +408,7 @@ export class VideoChannelModel extends SequelizeModel<VideoChannelModel> {
|
||||||
onDelete: 'CASCADE',
|
onDelete: 'CASCADE',
|
||||||
hooks: true
|
hooks: true
|
||||||
})
|
})
|
||||||
Videos: Awaited<VideoModel>[]
|
declare Videos: Awaited<VideoModel>[]
|
||||||
|
|
||||||
@HasMany(() => VideoPlaylistModel, {
|
@HasMany(() => VideoPlaylistModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -417,7 +417,7 @@ export class VideoChannelModel extends SequelizeModel<VideoChannelModel> {
|
||||||
onDelete: 'CASCADE',
|
onDelete: 'CASCADE',
|
||||||
hooks: true
|
hooks: true
|
||||||
})
|
})
|
||||||
VideoPlaylists: Awaited<VideoPlaylistModel>[]
|
declare VideoPlaylists: Awaited<VideoPlaylistModel>[]
|
||||||
|
|
||||||
@AfterCreate
|
@AfterCreate
|
||||||
static notifyCreate (channel: MChannel) {
|
static notifyCreate (channel: MChannel) {
|
||||||
|
|
|
@ -16,18 +16,17 @@ import { SequelizeModel } from '../shared/sequelize-type.js'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class VideoChapterModel extends SequelizeModel<VideoChapterModel> {
|
export class VideoChapterModel extends SequelizeModel<VideoChapterModel> {
|
||||||
|
@AllowNull(false)
|
||||||
|
@Column
|
||||||
|
declare timecode: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
timecode: number
|
declare title: string
|
||||||
|
|
||||||
@AllowNull(false)
|
|
||||||
@Column
|
|
||||||
title: string
|
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -35,13 +34,13 @@ export class VideoChapterModel extends SequelizeModel<VideoChapterModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
static deleteChapters (videoId: number, transaction: Transaction) {
|
static deleteChapters (videoId: number, transaction: Transaction) {
|
||||||
const query = {
|
const query = {
|
||||||
|
|
|
@ -138,35 +138,35 @@ export enum ScopeNames {
|
||||||
})
|
})
|
||||||
export class VideoCommentModel extends SequelizeModel<VideoCommentModel> {
|
export class VideoCommentModel extends SequelizeModel<VideoCommentModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column(DataType.DATE)
|
@Column(DataType.DATE)
|
||||||
deletedAt: Date
|
declare deletedAt: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('VideoCommentUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))
|
@Is('VideoCommentUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS.URL.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS.URL.max))
|
||||||
url: string
|
declare url: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column(DataType.TEXT)
|
@Column(DataType.TEXT)
|
||||||
text: string
|
declare text: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
heldForReview: boolean
|
declare heldForReview: boolean
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
replyApproval: string
|
declare replyApproval: string
|
||||||
|
|
||||||
@ForeignKey(() => VideoCommentModel)
|
@ForeignKey(() => VideoCommentModel)
|
||||||
@Column
|
@Column
|
||||||
originCommentId: number
|
declare originCommentId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoCommentModel, {
|
@BelongsTo(() => VideoCommentModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -176,11 +176,11 @@ export class VideoCommentModel extends SequelizeModel<VideoCommentModel> {
|
||||||
as: 'OriginVideoComment',
|
as: 'OriginVideoComment',
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
OriginVideoComment: Awaited<VideoCommentModel>
|
declare OriginVideoComment: Awaited<VideoCommentModel>
|
||||||
|
|
||||||
@ForeignKey(() => VideoCommentModel)
|
@ForeignKey(() => VideoCommentModel)
|
||||||
@Column
|
@Column
|
||||||
inReplyToCommentId: number
|
declare inReplyToCommentId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoCommentModel, {
|
@BelongsTo(() => VideoCommentModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -190,11 +190,11 @@ export class VideoCommentModel extends SequelizeModel<VideoCommentModel> {
|
||||||
as: 'InReplyToVideoComment',
|
as: 'InReplyToVideoComment',
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
InReplyToVideoComment: Awaited<VideoCommentModel> | null
|
declare InReplyToVideoComment: Awaited<VideoCommentModel> | null
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -202,11 +202,11 @@ export class VideoCommentModel extends SequelizeModel<VideoCommentModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
|
|
||||||
@ForeignKey(() => AccountModel)
|
@ForeignKey(() => AccountModel)
|
||||||
@Column
|
@Column
|
||||||
accountId: number
|
declare accountId: number
|
||||||
|
|
||||||
@BelongsTo(() => AccountModel, {
|
@BelongsTo(() => AccountModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -214,7 +214,7 @@ export class VideoCommentModel extends SequelizeModel<VideoCommentModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
Account: Awaited<AccountModel>
|
declare Account: Awaited<AccountModel>
|
||||||
|
|
||||||
@HasMany(() => VideoCommentAbuseModel, {
|
@HasMany(() => VideoCommentAbuseModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -223,13 +223,13 @@ export class VideoCommentModel extends SequelizeModel<VideoCommentModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'set null'
|
onDelete: 'set null'
|
||||||
})
|
})
|
||||||
CommentAbuses: Awaited<VideoCommentAbuseModel>[]
|
declare CommentAbuses: Awaited<VideoCommentAbuseModel>[]
|
||||||
|
|
||||||
@HasMany(() => CommentAutomaticTagModel, {
|
@HasMany(() => CommentAutomaticTagModel, {
|
||||||
foreignKey: 'commentId',
|
foreignKey: 'commentId',
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
CommentAutomaticTags: Awaited<CommentAutomaticTagModel>[]
|
declare CommentAutomaticTags: Awaited<CommentAutomaticTagModel>[]
|
||||||
|
|
||||||
@AfterCreate
|
@AfterCreate
|
||||||
@AfterDestroy
|
@AfterDestroy
|
||||||
|
|
|
@ -12,11 +12,7 @@ import { logger } from '@server/helpers/logger.js'
|
||||||
import { extractVideo } from '@server/helpers/video.js'
|
import { extractVideo } from '@server/helpers/video.js'
|
||||||
import { CONFIG } from '@server/initializers/config.js'
|
import { CONFIG } from '@server/initializers/config.js'
|
||||||
import { buildRemoteUrl } from '@server/lib/activitypub/url.js'
|
import { buildRemoteUrl } from '@server/lib/activitypub/url.js'
|
||||||
import {
|
import { getHLSPrivateFileUrl, getObjectStoragePublicFileUrl, getWebVideoPrivateFileUrl } from '@server/lib/object-storage/index.js'
|
||||||
getHLSPrivateFileUrl,
|
|
||||||
getObjectStoragePublicFileUrl,
|
|
||||||
getWebVideoPrivateFileUrl
|
|
||||||
} from '@server/lib/object-storage/index.js'
|
|
||||||
import { getFSTorrentFilePath } from '@server/lib/paths.js'
|
import { getFSTorrentFilePath } from '@server/lib/paths.js'
|
||||||
import { getVideoFileMimeType } from '@server/lib/video-file.js'
|
import { getVideoFileMimeType } from '@server/lib/video-file.js'
|
||||||
import { isVideoInPrivateDirectory } from '@server/lib/video-privacy.js'
|
import { isVideoInPrivateDirectory } from '@server/lib/video-privacy.js'
|
||||||
|
@ -34,7 +30,8 @@ import {
|
||||||
Default,
|
Default,
|
||||||
DefaultScope,
|
DefaultScope,
|
||||||
ForeignKey,
|
ForeignKey,
|
||||||
Is, Scopes,
|
Is,
|
||||||
|
Scopes,
|
||||||
Table,
|
Table,
|
||||||
UpdatedAt
|
UpdatedAt
|
||||||
} from 'sequelize-typescript'
|
} from 'sequelize-typescript'
|
||||||
|
@ -46,14 +43,7 @@ import {
|
||||||
isVideoFileResolutionValid,
|
isVideoFileResolutionValid,
|
||||||
isVideoFileSizeValid
|
isVideoFileSizeValid
|
||||||
} from '../../helpers/custom-validators/videos.js'
|
} from '../../helpers/custom-validators/videos.js'
|
||||||
import {
|
import { DOWNLOAD_PATHS, LAZY_STATIC_PATHS, MEMOIZE_LENGTH, MEMOIZE_TTL, STATIC_PATHS, WEBSERVER } from '../../initializers/constants.js'
|
||||||
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 { MVideoFile, MVideoFileStreamingPlaylistVideo, MVideoFileVideo } from '../../types/models/video/video-file.js'
|
||||||
import { SequelizeModel, doesExist, parseAggregateResult, throwIfNotValid } from '../shared/index.js'
|
import { SequelizeModel, doesExist, parseAggregateResult, throwIfNotValid } from '../shared/index.js'
|
||||||
import { VideoStreamingPlaylistModel } from './video-streaming-playlist.js'
|
import { VideoStreamingPlaylistModel } from './video-streaming-playlist.js'
|
||||||
|
@ -146,89 +136,89 @@ export enum ScopeNames {
|
||||||
})
|
})
|
||||||
export class VideoFileModel extends SequelizeModel<VideoFileModel> {
|
export class VideoFileModel extends SequelizeModel<VideoFileModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('VideoFileResolution', value => throwIfNotValid(value, isVideoFileResolutionValid, 'resolution'))
|
@Is('VideoFileResolution', value => throwIfNotValid(value, isVideoFileResolutionValid, 'resolution'))
|
||||||
@Column
|
@Column
|
||||||
resolution: number
|
declare resolution: number
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
width: number
|
declare width: number
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
height: number
|
declare height: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('VideoFileSize', value => throwIfNotValid(value, isVideoFileSizeValid, 'size'))
|
@Is('VideoFileSize', value => throwIfNotValid(value, isVideoFileSizeValid, 'size'))
|
||||||
@Column(DataType.BIGINT)
|
@Column(DataType.BIGINT)
|
||||||
size: number
|
declare size: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('VideoFileExtname', value => throwIfNotValid(value, isVideoFileExtnameValid, 'extname'))
|
@Is('VideoFileExtname', value => throwIfNotValid(value, isVideoFileExtnameValid, 'extname'))
|
||||||
@Column
|
@Column
|
||||||
extname: string
|
declare extname: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Is('VideoFileInfohash', value => throwIfNotValid(value, isVideoFileInfoHashValid, 'info hash', true))
|
@Is('VideoFileInfohash', value => throwIfNotValid(value, isVideoFileInfoHashValid, 'info hash', true))
|
||||||
@Column
|
@Column
|
||||||
infoHash: string
|
declare infoHash: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(-1)
|
@Default(-1)
|
||||||
@Is('VideoFileFPS', value => throwIfNotValid(value, isVideoFPSResolutionValid, 'fps'))
|
@Is('VideoFileFPS', value => throwIfNotValid(value, isVideoFPSResolutionValid, 'fps'))
|
||||||
@Column
|
@Column
|
||||||
fps: number
|
declare fps: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
formatFlags: VideoFileFormatFlagType
|
declare formatFlags: VideoFileFormatFlagType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
streams: VideoFileStreamType
|
declare streams: VideoFileStreamType
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column(DataType.JSONB)
|
@Column(DataType.JSONB)
|
||||||
metadata: any
|
declare metadata: any
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
metadataUrl: string
|
declare metadataUrl: string
|
||||||
|
|
||||||
// Could be null for remote files
|
// Could be null for remote files
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
fileUrl: string
|
declare fileUrl: string
|
||||||
|
|
||||||
// Could be null for live files
|
// Could be null for live files
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
filename: string
|
declare filename: string
|
||||||
|
|
||||||
// Could be null for remote files
|
// Could be null for remote files
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
torrentUrl: string
|
declare torrentUrl: string
|
||||||
|
|
||||||
// Could be null for live files
|
// Could be null for live files
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
torrentFilename: string
|
declare torrentFilename: string
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(FileStorage.FILE_SYSTEM)
|
@Default(FileStorage.FILE_SYSTEM)
|
||||||
@Column
|
@Column
|
||||||
storage: FileStorageType
|
declare storage: FileStorageType
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -236,11 +226,11 @@ export class VideoFileModel extends SequelizeModel<VideoFileModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
|
|
||||||
@ForeignKey(() => VideoStreamingPlaylistModel)
|
@ForeignKey(() => VideoStreamingPlaylistModel)
|
||||||
@Column
|
@Column
|
||||||
videoStreamingPlaylistId: number
|
declare videoStreamingPlaylistId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoStreamingPlaylistModel, {
|
@BelongsTo(() => VideoStreamingPlaylistModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -248,7 +238,7 @@ export class VideoFileModel extends SequelizeModel<VideoFileModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
VideoStreamingPlaylist: Awaited<VideoStreamingPlaylistModel>
|
declare VideoStreamingPlaylist: Awaited<VideoStreamingPlaylistModel>
|
||||||
|
|
||||||
static doesInfohashExistCached = memoizee(VideoFileModel.doesInfohashExist.bind(VideoFileModel), {
|
static doesInfohashExistCached = memoizee(VideoFileModel.doesInfohashExist.bind(VideoFileModel), {
|
||||||
promise: true,
|
promise: true,
|
||||||
|
|
|
@ -62,42 +62,42 @@ const defaultVideoScope = () => {
|
||||||
})
|
})
|
||||||
export class VideoImportModel extends SequelizeModel<VideoImportModel> {
|
export class VideoImportModel extends SequelizeModel<VideoImportModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Is('VideoImportTargetUrl', value => throwIfNotValid(value, isVideoImportTargetUrlValid, 'targetUrl', true))
|
@Is('VideoImportTargetUrl', value => throwIfNotValid(value, isVideoImportTargetUrlValid, 'targetUrl', true))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_IMPORTS.URL.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_IMPORTS.URL.max))
|
||||||
targetUrl: string
|
declare targetUrl: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Is('VideoImportMagnetUri', value => throwIfNotValid(value, isVideoMagnetUriValid, 'magnetUri', true))
|
@Is('VideoImportMagnetUri', value => throwIfNotValid(value, isVideoMagnetUriValid, 'magnetUri', true))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_IMPORTS.URL.max)) // Use the same constraints than URLs
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_IMPORTS.URL.max)) // Use the same constraints than URLs
|
||||||
magnetUri: string
|
declare magnetUri: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_IMPORTS.TORRENT_NAME.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_IMPORTS.TORRENT_NAME.max))
|
||||||
torrentName: string
|
declare torrentName: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Is('VideoImportState', value => throwIfNotValid(value, isVideoImportStateValid, 'state'))
|
@Is('VideoImportState', value => throwIfNotValid(value, isVideoImportStateValid, 'state'))
|
||||||
@Column
|
@Column
|
||||||
state: VideoImportStateType
|
declare state: VideoImportStateType
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Column(DataType.TEXT)
|
@Column(DataType.TEXT)
|
||||||
error: string
|
declare error: string
|
||||||
|
|
||||||
@ForeignKey(() => UserModel)
|
@ForeignKey(() => UserModel)
|
||||||
@Column
|
@Column
|
||||||
userId: number
|
declare userId: number
|
||||||
|
|
||||||
@BelongsTo(() => UserModel, {
|
@BelongsTo(() => UserModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -105,11 +105,11 @@ export class VideoImportModel extends SequelizeModel<VideoImportModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
User: Awaited<UserModel>
|
declare User: Awaited<UserModel>
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -117,11 +117,11 @@ export class VideoImportModel extends SequelizeModel<VideoImportModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'set null'
|
onDelete: 'set null'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
|
|
||||||
@ForeignKey(() => VideoChannelSyncModel)
|
@ForeignKey(() => VideoChannelSyncModel)
|
||||||
@Column
|
@Column
|
||||||
videoChannelSyncId: number
|
declare videoChannelSyncId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoChannelSyncModel, {
|
@BelongsTo(() => VideoChannelSyncModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -129,7 +129,7 @@ export class VideoImportModel extends SequelizeModel<VideoImportModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'set null'
|
onDelete: 'set null'
|
||||||
})
|
})
|
||||||
VideoChannelSync: Awaited<VideoChannelSyncModel>
|
declare VideoChannelSync: Awaited<VideoChannelSyncModel>
|
||||||
|
|
||||||
@AfterUpdate
|
@AfterUpdate
|
||||||
static deleteVideoIfFailed (instance: VideoImportModel, options) {
|
static deleteVideoIfFailed (instance: VideoImportModel, options) {
|
||||||
|
|
|
@ -21,33 +21,33 @@ export type VideoJobInfoColumnType = 'pendingMove' | 'pendingTranscode' | 'pendi
|
||||||
})
|
})
|
||||||
export class VideoJobInfoModel extends SequelizeModel<VideoJobInfoModel> {
|
export class VideoJobInfoModel extends SequelizeModel<VideoJobInfoModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(0)
|
@Default(0)
|
||||||
@IsInt
|
@IsInt
|
||||||
@Column
|
@Column
|
||||||
pendingMove: number
|
declare pendingMove: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(0)
|
@Default(0)
|
||||||
@IsInt
|
@IsInt
|
||||||
@Column
|
@Column
|
||||||
pendingTranscode: number
|
declare pendingTranscode: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(0)
|
@Default(0)
|
||||||
@IsInt
|
@IsInt
|
||||||
@Column
|
@Column
|
||||||
pendingTranscription: number
|
declare pendingTranscription: number
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Unique
|
@Unique
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -55,7 +55,7 @@ export class VideoJobInfoModel extends SequelizeModel<VideoJobInfoModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
|
|
||||||
static load (videoId: number, transaction?: Transaction) {
|
static load (videoId: number, transaction?: Transaction) {
|
||||||
const where = {
|
const where = {
|
||||||
|
|
|
@ -10,17 +10,16 @@ import { SequelizeModel } from '../shared/index.js'
|
||||||
tableName: 'videoLiveReplaySetting'
|
tableName: 'videoLiveReplaySetting'
|
||||||
})
|
})
|
||||||
export class VideoLiveReplaySettingModel extends SequelizeModel<VideoLiveReplaySettingModel> {
|
export class VideoLiveReplaySettingModel extends SequelizeModel<VideoLiveReplaySettingModel> {
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('VideoPrivacy', value => throwIfNotValid(value, isVideoPrivacyValid, 'privacy'))
|
@Is('VideoPrivacy', value => throwIfNotValid(value, isVideoPrivacyValid, 'privacy'))
|
||||||
@Column
|
@Column
|
||||||
privacy: VideoPrivacyType
|
declare privacy: VideoPrivacyType
|
||||||
|
|
||||||
static load (id: number, transaction?: Transaction): Promise<MLiveReplaySetting> {
|
static load (id: number, transaction?: Transaction): Promise<MLiveReplaySetting> {
|
||||||
return VideoLiveReplaySettingModel.findOne({
|
return VideoLiveReplaySettingModel.findOne({
|
||||||
|
|
|
@ -56,34 +56,34 @@ export enum ScopeNames {
|
||||||
})
|
})
|
||||||
export class VideoLiveSessionModel extends SequelizeModel<VideoLiveSessionModel> {
|
export class VideoLiveSessionModel extends SequelizeModel<VideoLiveSessionModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column(DataType.DATE)
|
@Column(DataType.DATE)
|
||||||
startDate: Date
|
declare startDate: Date
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column(DataType.DATE)
|
@Column(DataType.DATE)
|
||||||
endDate: Date
|
declare endDate: Date
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
error: LiveVideoErrorType
|
declare error: LiveVideoErrorType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
saveReplay: boolean
|
declare saveReplay: boolean
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
endingProcessed: boolean
|
declare endingProcessed: boolean
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
replayVideoId: number
|
declare replayVideoId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -93,11 +93,11 @@ export class VideoLiveSessionModel extends SequelizeModel<VideoLiveSessionModel>
|
||||||
as: 'ReplayVideo',
|
as: 'ReplayVideo',
|
||||||
onDelete: 'set null'
|
onDelete: 'set null'
|
||||||
})
|
})
|
||||||
ReplayVideo: Awaited<VideoModel>
|
declare ReplayVideo: Awaited<VideoModel>
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
liveVideoId: number
|
declare liveVideoId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -107,11 +107,11 @@ export class VideoLiveSessionModel extends SequelizeModel<VideoLiveSessionModel>
|
||||||
as: 'LiveVideo',
|
as: 'LiveVideo',
|
||||||
onDelete: 'set null'
|
onDelete: 'set null'
|
||||||
})
|
})
|
||||||
LiveVideo: Awaited<VideoModel>
|
declare LiveVideo: Awaited<VideoModel>
|
||||||
|
|
||||||
@ForeignKey(() => VideoLiveReplaySettingModel)
|
@ForeignKey(() => VideoLiveReplaySettingModel)
|
||||||
@Column
|
@Column
|
||||||
replaySettingId: number
|
declare replaySettingId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoLiveReplaySettingModel, {
|
@BelongsTo(() => VideoLiveReplaySettingModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -119,7 +119,7 @@ export class VideoLiveSessionModel extends SequelizeModel<VideoLiveSessionModel>
|
||||||
},
|
},
|
||||||
onDelete: 'set null'
|
onDelete: 'set null'
|
||||||
})
|
})
|
||||||
ReplaySetting: Awaited<VideoLiveReplaySettingModel>
|
declare ReplaySetting: Awaited<VideoLiveReplaySettingModel>
|
||||||
|
|
||||||
@BeforeDestroy
|
@BeforeDestroy
|
||||||
static deleteReplaySetting (instance: VideoLiveSessionModel) {
|
static deleteReplaySetting (instance: VideoLiveSessionModel) {
|
||||||
|
|
|
@ -11,7 +11,8 @@ import {
|
||||||
CreatedAt,
|
CreatedAt,
|
||||||
DataType,
|
DataType,
|
||||||
DefaultScope,
|
DefaultScope,
|
||||||
ForeignKey, Table,
|
ForeignKey,
|
||||||
|
Table,
|
||||||
UpdatedAt
|
UpdatedAt
|
||||||
} from 'sequelize-typescript'
|
} from 'sequelize-typescript'
|
||||||
import { VideoBlacklistModel } from './video-blacklist.js'
|
import { VideoBlacklistModel } from './video-blacklist.js'
|
||||||
|
@ -51,32 +52,31 @@ import { SequelizeModel } from '../shared/index.js'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class VideoLiveModel extends SequelizeModel<VideoLiveModel> {
|
export class VideoLiveModel extends SequelizeModel<VideoLiveModel> {
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column(DataType.STRING)
|
@Column(DataType.STRING)
|
||||||
streamKey: string
|
declare streamKey: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
saveReplay: boolean
|
declare saveReplay: boolean
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
permanentLive: boolean
|
declare permanentLive: boolean
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
latencyMode: LiveVideoLatencyModeType
|
declare latencyMode: LiveVideoLatencyModeType
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -84,11 +84,11 @@ export class VideoLiveModel extends SequelizeModel<VideoLiveModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
|
|
||||||
@ForeignKey(() => VideoLiveReplaySettingModel)
|
@ForeignKey(() => VideoLiveReplaySettingModel)
|
||||||
@Column
|
@Column
|
||||||
replaySettingId: number
|
declare replaySettingId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoLiveReplaySettingModel, {
|
@BelongsTo(() => VideoLiveReplaySettingModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -96,7 +96,7 @@ export class VideoLiveModel extends SequelizeModel<VideoLiveModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'set null'
|
onDelete: 'set null'
|
||||||
})
|
})
|
||||||
ReplaySetting: Awaited<VideoLiveReplaySettingModel>
|
declare ReplaySetting: Awaited<VideoLiveReplaySettingModel>
|
||||||
|
|
||||||
@BeforeDestroy
|
@BeforeDestroy
|
||||||
static deleteReplaySetting (instance: VideoLiveModel, options: { transaction: Transaction }) {
|
static deleteReplaySetting (instance: VideoLiveModel, options: { transaction: Transaction }) {
|
||||||
|
|
|
@ -25,21 +25,20 @@ import { pick } from '@peertube/peertube-core-utils'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class VideoPasswordModel extends SequelizeModel<VideoPasswordModel> {
|
export class VideoPasswordModel extends SequelizeModel<VideoPasswordModel> {
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('VideoPassword', value => throwIfNotValid(value, isPasswordValid, 'videoPassword'))
|
@Is('VideoPassword', value => throwIfNotValid(value, isPasswordValid, 'videoPassword'))
|
||||||
@Column
|
@Column
|
||||||
password: string
|
declare password: string
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -47,7 +46,7 @@ export class VideoPasswordModel extends SequelizeModel<VideoPasswordModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
|
|
||||||
static async countByVideoId (videoId: number, t?: Transaction) {
|
static async countByVideoId (videoId: number, t?: Transaction) {
|
||||||
const query = {
|
const query = {
|
||||||
|
|
|
@ -55,38 +55,38 @@ import { ForAPIOptions, VideoModel, ScopeNames as VideoScopeNames } from './vide
|
||||||
})
|
})
|
||||||
export class VideoPlaylistElementModel extends SequelizeModel<VideoPlaylistElementModel> {
|
export class VideoPlaylistElementModel extends SequelizeModel<VideoPlaylistElementModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Is('VideoPlaylistUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url', true))
|
@Is('VideoPlaylistUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url', true))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_PLAYLISTS.URL.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_PLAYLISTS.URL.max))
|
||||||
url: string
|
declare url: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(1)
|
@Default(1)
|
||||||
@IsInt
|
@IsInt
|
||||||
@Min(1)
|
@Min(1)
|
||||||
@Column
|
@Column
|
||||||
position: number
|
declare position: number
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@IsInt
|
@IsInt
|
||||||
@Min(0)
|
@Min(0)
|
||||||
@Column
|
@Column
|
||||||
startTimestamp: number
|
declare startTimestamp: number
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@IsInt
|
@IsInt
|
||||||
@Min(0)
|
@Min(0)
|
||||||
@Column
|
@Column
|
||||||
stopTimestamp: number
|
declare stopTimestamp: number
|
||||||
|
|
||||||
@ForeignKey(() => VideoPlaylistModel)
|
@ForeignKey(() => VideoPlaylistModel)
|
||||||
@Column
|
@Column
|
||||||
videoPlaylistId: number
|
declare videoPlaylistId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoPlaylistModel, {
|
@BelongsTo(() => VideoPlaylistModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -94,11 +94,11 @@ export class VideoPlaylistElementModel extends SequelizeModel<VideoPlaylistEleme
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
VideoPlaylist: Awaited<VideoPlaylistModel>
|
declare VideoPlaylist: Awaited<VideoPlaylistModel>
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -106,7 +106,7 @@ export class VideoPlaylistElementModel extends SequelizeModel<VideoPlaylistEleme
|
||||||
},
|
},
|
||||||
onDelete: 'set null'
|
onDelete: 'set null'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
|
|
||||||
static deleteAllOf (videoPlaylistId: number, transaction?: Transaction) {
|
static deleteAllOf (videoPlaylistId: number, transaction?: Transaction) {
|
||||||
const query = {
|
const query = {
|
||||||
|
|
|
@ -291,49 +291,49 @@ function getVideoLengthSelect () {
|
||||||
})
|
})
|
||||||
export class VideoPlaylistModel extends SequelizeModel<VideoPlaylistModel> {
|
export class VideoPlaylistModel extends SequelizeModel<VideoPlaylistModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('VideoPlaylistName', value => throwIfNotValid(value, isVideoPlaylistNameValid, 'name'))
|
@Is('VideoPlaylistName', value => throwIfNotValid(value, isVideoPlaylistNameValid, 'name'))
|
||||||
@Column
|
@Column
|
||||||
name: string
|
declare name: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Is('VideoPlaylistDescription', value => throwIfNotValid(value, isVideoPlaylistDescriptionValid, 'description', true))
|
@Is('VideoPlaylistDescription', value => throwIfNotValid(value, isVideoPlaylistDescriptionValid, 'description', true))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_PLAYLISTS.DESCRIPTION.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_PLAYLISTS.DESCRIPTION.max))
|
||||||
description: string
|
declare description: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('VideoPlaylistPrivacy', value => throwIfNotValid(value, isVideoPlaylistPrivacyValid, 'privacy'))
|
@Is('VideoPlaylistPrivacy', value => throwIfNotValid(value, isVideoPlaylistPrivacyValid, 'privacy'))
|
||||||
@Column
|
@Column
|
||||||
privacy: VideoPlaylistPrivacyType
|
declare privacy: VideoPlaylistPrivacyType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('VideoPlaylistUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))
|
@Is('VideoPlaylistUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_PLAYLISTS.URL.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_PLAYLISTS.URL.max))
|
||||||
url: string
|
declare url: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(DataType.UUIDV4)
|
@Default(DataType.UUIDV4)
|
||||||
@IsUUID(4)
|
@IsUUID(4)
|
||||||
@Column(DataType.UUID)
|
@Column(DataType.UUID)
|
||||||
uuid: string
|
declare uuid: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(VideoPlaylistType.REGULAR)
|
@Default(VideoPlaylistType.REGULAR)
|
||||||
@Column
|
@Column
|
||||||
type: VideoPlaylistType_Type
|
declare type: VideoPlaylistType_Type
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
videoChannelPosition: number
|
declare videoChannelPosition: number
|
||||||
|
|
||||||
@ForeignKey(() => AccountModel)
|
@ForeignKey(() => AccountModel)
|
||||||
@Column
|
@Column
|
||||||
ownerAccountId: number
|
declare ownerAccountId: number
|
||||||
|
|
||||||
@BelongsTo(() => AccountModel, {
|
@BelongsTo(() => AccountModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -341,11 +341,11 @@ export class VideoPlaylistModel extends SequelizeModel<VideoPlaylistModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
OwnerAccount: Awaited<AccountModel>
|
declare OwnerAccount: Awaited<AccountModel>
|
||||||
|
|
||||||
@ForeignKey(() => VideoChannelModel)
|
@ForeignKey(() => VideoChannelModel)
|
||||||
@Column
|
@Column
|
||||||
videoChannelId: number
|
declare videoChannelId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoChannelModel, {
|
@BelongsTo(() => VideoChannelModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -353,7 +353,7 @@ export class VideoPlaylistModel extends SequelizeModel<VideoPlaylistModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
VideoChannel: Awaited<VideoChannelModel>
|
declare VideoChannel: Awaited<VideoChannelModel>
|
||||||
|
|
||||||
@HasMany(() => VideoPlaylistElementModel, {
|
@HasMany(() => VideoPlaylistElementModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -362,7 +362,7 @@ export class VideoPlaylistModel extends SequelizeModel<VideoPlaylistModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
VideoPlaylistElements: Awaited<VideoPlaylistElementModel>[]
|
declare VideoPlaylistElements: Awaited<VideoPlaylistElementModel>[]
|
||||||
|
|
||||||
@HasOne(() => ThumbnailModel, {
|
@HasOne(() => ThumbnailModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -372,7 +372,7 @@ export class VideoPlaylistModel extends SequelizeModel<VideoPlaylistModel> {
|
||||||
onDelete: 'CASCADE',
|
onDelete: 'CASCADE',
|
||||||
hooks: true
|
hooks: true
|
||||||
})
|
})
|
||||||
Thumbnail: Awaited<ThumbnailModel>
|
declare Thumbnail: Awaited<ThumbnailModel>
|
||||||
|
|
||||||
static listForApi (
|
static listForApi (
|
||||||
options: AvailableForListOptions & {
|
options: AvailableForListOptions & {
|
||||||
|
|
|
@ -52,21 +52,20 @@ enum ScopeNames {
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class VideoShareModel extends SequelizeModel<VideoShareModel> {
|
export class VideoShareModel extends SequelizeModel<VideoShareModel> {
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('VideoShareUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))
|
@Is('VideoShareUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_SHARE.URL.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_SHARE.URL.max))
|
||||||
url: string
|
declare url: string
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => ActorModel)
|
@ForeignKey(() => ActorModel)
|
||||||
@Column
|
@Column
|
||||||
actorId: number
|
declare actorId: number
|
||||||
|
|
||||||
@BelongsTo(() => ActorModel, {
|
@BelongsTo(() => ActorModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -74,11 +73,11 @@ export class VideoShareModel extends SequelizeModel<VideoShareModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Actor: Awaited<ActorModel>
|
declare Actor: Awaited<ActorModel>
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -86,7 +85,7 @@ export class VideoShareModel extends SequelizeModel<VideoShareModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
|
|
||||||
static load (actorId: number | string, videoId: number | string, t?: Transaction): Promise<MVideoShareActor> {
|
static load (actorId: number | string, videoId: number | string, t?: Transaction): Promise<MVideoShareActor> {
|
||||||
return VideoShareModel.scope(ScopeNames.WITH_ACTOR).findOne({
|
return VideoShareModel.scope(ScopeNames.WITH_ACTOR).findOne({
|
||||||
|
|
|
@ -26,54 +26,54 @@ import { VideoModel } from './video.js'
|
||||||
})
|
})
|
||||||
export class VideoSourceModel extends SequelizeModel<VideoSourceModel> {
|
export class VideoSourceModel extends SequelizeModel<VideoSourceModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
inputFilename: string
|
declare inputFilename: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
keptOriginalFilename: string
|
declare keptOriginalFilename: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
resolution: number
|
declare resolution: number
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
width: number
|
declare width: number
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
height: number
|
declare height: number
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
fps: number
|
declare fps: number
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column(DataType.BIGINT)
|
@Column(DataType.BIGINT)
|
||||||
size: number
|
declare size: number
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column(DataType.JSONB)
|
@Column(DataType.JSONB)
|
||||||
metadata: any
|
declare metadata: any
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
storage: FileStorageType
|
declare storage: FileStorageType
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
fileUrl: string
|
declare fileUrl: string
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -81,7 +81,7 @@ export class VideoSourceModel extends SequelizeModel<VideoSourceModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
|
|
||||||
static loadLatest (videoId: number, transaction?: Transaction) {
|
static loadLatest (videoId: number, transaction?: Transaction) {
|
||||||
return VideoSourceModel.findOne<MVideoSource>({
|
return VideoSourceModel.findOne<MVideoSource>({
|
||||||
|
|
|
@ -56,48 +56,48 @@ import { VideoModel } from './video.js'
|
||||||
})
|
})
|
||||||
export class VideoStreamingPlaylistModel extends SequelizeModel<VideoStreamingPlaylistModel> {
|
export class VideoStreamingPlaylistModel extends SequelizeModel<VideoStreamingPlaylistModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
type: VideoStreamingPlaylistType_Type
|
declare type: VideoStreamingPlaylistType_Type
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
playlistFilename: string
|
declare playlistFilename: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS.URL.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS.URL.max))
|
||||||
playlistUrl: string
|
declare playlistUrl: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('VideoStreamingPlaylistInfoHashes', value => throwIfNotValid(value, v => isArrayOf(v, isVideoFileInfoHashValid), 'info hashes'))
|
@Is('VideoStreamingPlaylistInfoHashes', value => throwIfNotValid(value, v => isArrayOf(v, isVideoFileInfoHashValid), 'info hashes'))
|
||||||
@Column(DataType.ARRAY(DataType.STRING))
|
@Column(DataType.ARRAY(DataType.STRING))
|
||||||
p2pMediaLoaderInfohashes: string[]
|
declare p2pMediaLoaderInfohashes: string[]
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
p2pMediaLoaderPeerVersion: number
|
declare p2pMediaLoaderPeerVersion: number
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
segmentsSha256Filename: string
|
declare segmentsSha256Filename: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
segmentsSha256Url: string
|
declare segmentsSha256Url: string
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(FileStorage.FILE_SYSTEM)
|
@Default(FileStorage.FILE_SYSTEM)
|
||||||
@Column
|
@Column
|
||||||
storage: FileStorageType
|
declare storage: FileStorageType
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -105,7 +105,7 @@ export class VideoStreamingPlaylistModel extends SequelizeModel<VideoStreamingPl
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
|
|
||||||
@HasMany(() => VideoFileModel, {
|
@HasMany(() => VideoFileModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -113,7 +113,7 @@ export class VideoStreamingPlaylistModel extends SequelizeModel<VideoStreamingPl
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
VideoFiles: Awaited<VideoFileModel>[]
|
declare VideoFiles: Awaited<VideoFileModel>[]
|
||||||
|
|
||||||
@HasMany(() => VideoRedundancyModel, {
|
@HasMany(() => VideoRedundancyModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -122,7 +122,7 @@ export class VideoStreamingPlaylistModel extends SequelizeModel<VideoStreamingPl
|
||||||
onDelete: 'CASCADE',
|
onDelete: 'CASCADE',
|
||||||
hooks: true
|
hooks: true
|
||||||
})
|
})
|
||||||
RedundancyVideos: Awaited<VideoRedundancyModel>[]
|
declare RedundancyVideos: Awaited<VideoRedundancyModel>[]
|
||||||
|
|
||||||
static doesInfohashExistCached = memoizee(VideoStreamingPlaylistModel.doesInfohashExist.bind(VideoStreamingPlaylistModel), {
|
static doesInfohashExistCached = memoizee(VideoStreamingPlaylistModel.doesInfohashExist.bind(VideoStreamingPlaylistModel), {
|
||||||
promise: true,
|
promise: true,
|
||||||
|
|
|
@ -16,16 +16,16 @@ import { SequelizeModel } from '../shared/index.js'
|
||||||
})
|
})
|
||||||
export class VideoTagModel extends SequelizeModel<VideoTagModel> {
|
export class VideoTagModel extends SequelizeModel<VideoTagModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@ForeignKey(() => TagModel)
|
@ForeignKey(() => TagModel)
|
||||||
@Column
|
@Column
|
||||||
tagId: number
|
declare tagId: number
|
||||||
}
|
}
|
||||||
|
|
|
@ -439,156 +439,156 @@ export class VideoModel extends SequelizeModel<VideoModel> {
|
||||||
@Default(DataType.UUIDV4)
|
@Default(DataType.UUIDV4)
|
||||||
@IsUUID(4)
|
@IsUUID(4)
|
||||||
@Column(DataType.UUID)
|
@Column(DataType.UUID)
|
||||||
uuid: string
|
declare uuid: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('VideoName', value => throwIfNotValid(value, isVideoNameValid, 'name'))
|
@Is('VideoName', value => throwIfNotValid(value, isVideoNameValid, 'name'))
|
||||||
@Column
|
@Column
|
||||||
name: string
|
declare name: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Column
|
@Column
|
||||||
category: number
|
declare category: number
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Column
|
@Column
|
||||||
licence: number
|
declare licence: number
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS.LANGUAGE.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS.LANGUAGE.max))
|
||||||
language: string
|
declare language: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('VideoPrivacy', value => throwIfNotValid(value, isVideoPrivacyValid, 'privacy'))
|
@Is('VideoPrivacy', value => throwIfNotValid(value, isVideoPrivacyValid, 'privacy'))
|
||||||
@Column(DataType.INTEGER)
|
@Column(DataType.INTEGER)
|
||||||
privacy: VideoPrivacyType
|
declare privacy: VideoPrivacyType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('VideoNSFW', value => throwIfNotValid(value, isBooleanValid, 'NSFW boolean'))
|
@Is('VideoNSFW', value => throwIfNotValid(value, isBooleanValid, 'NSFW boolean'))
|
||||||
@Column
|
@Column
|
||||||
nsfw: boolean
|
declare nsfw: boolean
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(0)
|
@Default(0)
|
||||||
@Is('VideoNSFWFlags', value => throwIfNotValid(value, isNSFWFlagsValid, 'NSFW flags'))
|
@Is('VideoNSFWFlags', value => throwIfNotValid(value, isNSFWFlagsValid, 'NSFW flags'))
|
||||||
@Column
|
@Column
|
||||||
nsfwFlags: number // NSFWFlagType
|
declare nsfwFlags: number // NSFWFlagType
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Is('VideoNSFWSummary', value => throwIfNotValid(value, isNSFWSummaryValid, 'NSFW summary'))
|
@Is('VideoNSFWSummary', value => throwIfNotValid(value, isNSFWSummaryValid, 'NSFW summary'))
|
||||||
@Column
|
@Column
|
||||||
nsfwSummary: string
|
declare nsfwSummary: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Is('VideoDescription', value => throwIfNotValid(value, isVideoDescriptionValid, 'description', true))
|
@Is('VideoDescription', value => throwIfNotValid(value, isVideoDescriptionValid, 'description', true))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS.DESCRIPTION.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS.DESCRIPTION.max))
|
||||||
description: string
|
declare description: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Is('VideoSupport', value => throwIfNotValid(value, isVideoSupportValid, 'support', true))
|
@Is('VideoSupport', value => throwIfNotValid(value, isVideoSupportValid, 'support', true))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS.SUPPORT.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS.SUPPORT.max))
|
||||||
support: string
|
declare support: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('VideoDuration', value => throwIfNotValid(value, isVideoDurationValid, 'duration'))
|
@Is('VideoDuration', value => throwIfNotValid(value, isVideoDurationValid, 'duration'))
|
||||||
@Column
|
@Column
|
||||||
duration: number
|
declare duration: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(0)
|
@Default(0)
|
||||||
@IsInt
|
@IsInt
|
||||||
@Min(0)
|
@Min(0)
|
||||||
@Column
|
@Column
|
||||||
views: number
|
declare views: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(0)
|
@Default(0)
|
||||||
@IsInt
|
@IsInt
|
||||||
@Min(0)
|
@Min(0)
|
||||||
@Column
|
@Column
|
||||||
likes: number
|
declare likes: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(0)
|
@Default(0)
|
||||||
@IsInt
|
@IsInt
|
||||||
@Min(0)
|
@Min(0)
|
||||||
@Column
|
@Column
|
||||||
dislikes: number
|
declare dislikes: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(0)
|
@Default(0)
|
||||||
@IsInt
|
@IsInt
|
||||||
@Min(0)
|
@Min(0)
|
||||||
@Column
|
@Column
|
||||||
comments: number
|
declare comments: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
remote: boolean
|
declare remote: boolean
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(false)
|
@Default(false)
|
||||||
@Column
|
@Column
|
||||||
isLive: boolean
|
declare isLive: boolean
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Is('VideoUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))
|
@Is('VideoUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))
|
||||||
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS.URL.max))
|
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEOS.URL.max))
|
||||||
url: string
|
declare url: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
commentsPolicy: VideoCommentPolicyType
|
declare commentsPolicy: VideoCommentPolicyType
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
downloadEnabled: boolean
|
declare downloadEnabled: boolean
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
waitTranscoding: boolean
|
declare waitTranscoding: boolean
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Is('VideoState', value => throwIfNotValid(value, isVideoStateValid, 'state'))
|
@Is('VideoState', value => throwIfNotValid(value, isVideoStateValid, 'state'))
|
||||||
@Column
|
@Column
|
||||||
state: VideoStateType
|
declare state: VideoStateType
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column(DataType.FLOAT)
|
@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
|
// 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
|
// And also to store the info from remote instances
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
inputFileUpdatedAt: Date
|
declare inputFileUpdatedAt: Date
|
||||||
|
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(DataType.NOW)
|
@Default(DataType.NOW)
|
||||||
@Column
|
@Column
|
||||||
publishedAt: Date
|
declare publishedAt: Date
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Default(null)
|
@Default(null)
|
||||||
@Column
|
@Column
|
||||||
originallyPublishedAt: Date
|
declare originallyPublishedAt: Date
|
||||||
|
|
||||||
@ForeignKey(() => VideoChannelModel)
|
@ForeignKey(() => VideoChannelModel)
|
||||||
@Column
|
@Column
|
||||||
channelId: number
|
declare channelId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoChannelModel, {
|
@BelongsTo(() => VideoChannelModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -596,21 +596,21 @@ export class VideoModel extends SequelizeModel<VideoModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
VideoChannel: Awaited<VideoChannelModel>
|
declare VideoChannel: Awaited<VideoChannelModel>
|
||||||
|
|
||||||
@BelongsToMany(() => TagModel, {
|
@BelongsToMany(() => TagModel, {
|
||||||
foreignKey: 'videoId',
|
foreignKey: 'videoId',
|
||||||
through: () => VideoTagModel,
|
through: () => VideoTagModel,
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
Tags: Awaited<TagModel>[]
|
declare Tags: Awaited<TagModel>[]
|
||||||
|
|
||||||
@BelongsToMany(() => TrackerModel, {
|
@BelongsToMany(() => TrackerModel, {
|
||||||
foreignKey: 'videoId',
|
foreignKey: 'videoId',
|
||||||
through: () => VideoTrackerModel,
|
through: () => VideoTrackerModel,
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
Trackers: Awaited<TrackerModel>[]
|
declare Trackers: Awaited<TrackerModel>[]
|
||||||
|
|
||||||
@HasMany(() => ThumbnailModel, {
|
@HasMany(() => ThumbnailModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -620,7 +620,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {
|
||||||
hooks: true,
|
hooks: true,
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
Thumbnails: Awaited<ThumbnailModel>[]
|
declare Thumbnails: Awaited<ThumbnailModel>[]
|
||||||
|
|
||||||
@HasMany(() => VideoPlaylistElementModel, {
|
@HasMany(() => VideoPlaylistElementModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -629,7 +629,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'set null'
|
onDelete: 'set null'
|
||||||
})
|
})
|
||||||
VideoPlaylistElements: Awaited<VideoPlaylistElementModel>[]
|
declare VideoPlaylistElements: Awaited<VideoPlaylistElementModel>[]
|
||||||
|
|
||||||
@HasOne(() => VideoSourceModel, {
|
@HasOne(() => VideoSourceModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -638,7 +638,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
VideoSource: Awaited<VideoSourceModel>
|
declare VideoSource: Awaited<VideoSourceModel>
|
||||||
|
|
||||||
@HasMany(() => VideoAbuseModel, {
|
@HasMany(() => VideoAbuseModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -647,7 +647,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'set null'
|
onDelete: 'set null'
|
||||||
})
|
})
|
||||||
VideoAbuses: Awaited<VideoAbuseModel>[]
|
declare VideoAbuses: Awaited<VideoAbuseModel>[]
|
||||||
|
|
||||||
@HasMany(() => VideoFileModel, {
|
@HasMany(() => VideoFileModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -656,7 +656,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
VideoFiles: Awaited<VideoFileModel>[]
|
declare VideoFiles: Awaited<VideoFileModel>[]
|
||||||
|
|
||||||
@HasMany(() => VideoStreamingPlaylistModel, {
|
@HasMany(() => VideoStreamingPlaylistModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -665,7 +665,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
VideoStreamingPlaylists: Awaited<VideoStreamingPlaylistModel>[]
|
declare VideoStreamingPlaylists: Awaited<VideoStreamingPlaylistModel>[]
|
||||||
|
|
||||||
@HasMany(() => VideoShareModel, {
|
@HasMany(() => VideoShareModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -674,7 +674,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
VideoShares: Awaited<VideoShareModel>[]
|
declare VideoShares: Awaited<VideoShareModel>[]
|
||||||
|
|
||||||
@HasMany(() => AccountVideoRateModel, {
|
@HasMany(() => AccountVideoRateModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -683,7 +683,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
AccountVideoRates: Awaited<AccountVideoRateModel>[]
|
declare AccountVideoRates: Awaited<AccountVideoRateModel>[]
|
||||||
|
|
||||||
@HasMany(() => VideoCommentModel, {
|
@HasMany(() => VideoCommentModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -693,7 +693,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {
|
||||||
onDelete: 'cascade',
|
onDelete: 'cascade',
|
||||||
hooks: true
|
hooks: true
|
||||||
})
|
})
|
||||||
VideoComments: Awaited<VideoCommentModel>[]
|
declare VideoComments: Awaited<VideoCommentModel>[]
|
||||||
|
|
||||||
@HasMany(() => VideoViewModel, {
|
@HasMany(() => VideoViewModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -702,7 +702,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
VideoViews: Awaited<VideoViewModel>[]
|
declare VideoViews: Awaited<VideoViewModel>[]
|
||||||
|
|
||||||
@HasMany(() => UserVideoHistoryModel, {
|
@HasMany(() => UserVideoHistoryModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -711,7 +711,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
UserVideoHistories: Awaited<UserVideoHistoryModel>[]
|
declare UserVideoHistories: Awaited<UserVideoHistoryModel>[]
|
||||||
|
|
||||||
@HasOne(() => ScheduleVideoUpdateModel, {
|
@HasOne(() => ScheduleVideoUpdateModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -720,7 +720,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
ScheduleVideoUpdate: Awaited<ScheduleVideoUpdateModel>
|
declare ScheduleVideoUpdate: Awaited<ScheduleVideoUpdateModel>
|
||||||
|
|
||||||
@HasOne(() => VideoBlacklistModel, {
|
@HasOne(() => VideoBlacklistModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -729,7 +729,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
VideoBlacklist: Awaited<VideoBlacklistModel>
|
declare VideoBlacklist: Awaited<VideoBlacklistModel>
|
||||||
|
|
||||||
@HasOne(() => VideoLiveModel, {
|
@HasOne(() => VideoLiveModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -739,7 +739,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {
|
||||||
hooks: true,
|
hooks: true,
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
VideoLive: Awaited<VideoLiveModel>
|
declare VideoLive: Awaited<VideoLiveModel>
|
||||||
|
|
||||||
@HasOne(() => VideoImportModel, {
|
@HasOne(() => VideoImportModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -748,7 +748,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'set null'
|
onDelete: 'set null'
|
||||||
})
|
})
|
||||||
VideoImport: Awaited<VideoImportModel>
|
declare VideoImport: Awaited<VideoImportModel>
|
||||||
|
|
||||||
@HasMany(() => VideoCaptionModel, {
|
@HasMany(() => VideoCaptionModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -759,7 +759,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {
|
||||||
hooks: true,
|
hooks: true,
|
||||||
['separate' as any]: true
|
['separate' as any]: true
|
||||||
})
|
})
|
||||||
VideoCaptions: Awaited<VideoCaptionModel>[]
|
declare VideoCaptions: Awaited<VideoCaptionModel>[]
|
||||||
|
|
||||||
@HasMany(() => VideoPasswordModel, {
|
@HasMany(() => VideoPasswordModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -768,13 +768,13 @@ export class VideoModel extends SequelizeModel<VideoModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
VideoPasswords: Awaited<VideoPasswordModel>[]
|
declare VideoPasswords: Awaited<VideoPasswordModel>[]
|
||||||
|
|
||||||
@HasMany(() => VideoAutomaticTagModel, {
|
@HasMany(() => VideoAutomaticTagModel, {
|
||||||
foreignKey: 'videoId',
|
foreignKey: 'videoId',
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
VideoAutomaticTags: Awaited<VideoAutomaticTagModel>[]
|
declare VideoAutomaticTags: Awaited<VideoAutomaticTagModel>[]
|
||||||
|
|
||||||
@HasOne(() => VideoJobInfoModel, {
|
@HasOne(() => VideoJobInfoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -783,7 +783,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
VideoJobInfo: Awaited<VideoJobInfoModel>
|
declare VideoJobInfo: Awaited<VideoJobInfoModel>
|
||||||
|
|
||||||
@HasOne(() => StoryboardModel, {
|
@HasOne(() => StoryboardModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -793,7 +793,7 @@ export class VideoModel extends SequelizeModel<VideoModel> {
|
||||||
onDelete: 'cascade',
|
onDelete: 'cascade',
|
||||||
hooks: true
|
hooks: true
|
||||||
})
|
})
|
||||||
Storyboard: Awaited<StoryboardModel>
|
declare Storyboard: Awaited<StoryboardModel>
|
||||||
|
|
||||||
@AfterCreate
|
@AfterCreate
|
||||||
static notifyCreate (video: MVideo) {
|
static notifyCreate (video: MVideo) {
|
||||||
|
|
|
@ -15,19 +15,19 @@ import { LocalVideoViewerModel } from './local-video-viewer.js'
|
||||||
})
|
})
|
||||||
export class LocalVideoViewerWatchSectionModel extends SequelizeModel<LocalVideoViewerWatchSectionModel> {
|
export class LocalVideoViewerWatchSectionModel extends SequelizeModel<LocalVideoViewerWatchSectionModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
watchStart: number
|
declare watchStart: number
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
watchEnd: number
|
declare watchEnd: number
|
||||||
|
|
||||||
@ForeignKey(() => LocalVideoViewerModel)
|
@ForeignKey(() => LocalVideoViewerModel)
|
||||||
@Column
|
@Column
|
||||||
localVideoViewerId: number
|
declare localVideoViewerId: number
|
||||||
|
|
||||||
@BelongsTo(() => LocalVideoViewerModel, {
|
@BelongsTo(() => LocalVideoViewerModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -35,7 +35,7 @@ export class LocalVideoViewerWatchSectionModel extends SequelizeModel<LocalVideo
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
LocalVideoViewer: Awaited<LocalVideoViewerModel>
|
declare LocalVideoViewer: Awaited<LocalVideoViewerModel>
|
||||||
|
|
||||||
static async bulkCreateSections (options: {
|
static async bulkCreateSections (options: {
|
||||||
localVideoViewerId: number
|
localVideoViewerId: number
|
||||||
|
|
|
@ -35,53 +35,53 @@ import { LocalVideoViewerWatchSectionModel } from './local-video-viewer-watch-se
|
||||||
})
|
})
|
||||||
export class LocalVideoViewerModel extends SequelizeModel<LocalVideoViewerModel> {
|
export class LocalVideoViewerModel extends SequelizeModel<LocalVideoViewerModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column(DataType.DATE)
|
@Column(DataType.DATE)
|
||||||
startDate: Date
|
declare startDate: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column(DataType.DATE)
|
@Column(DataType.DATE)
|
||||||
endDate: Date
|
declare endDate: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
watchTime: number
|
declare watchTime: number
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
client: string
|
declare client: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
device: string
|
declare device: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
operatingSystem: string
|
declare operatingSystem: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
country: string
|
declare country: string
|
||||||
|
|
||||||
@AllowNull(true)
|
@AllowNull(true)
|
||||||
@Column
|
@Column
|
||||||
subdivisionName: string
|
declare subdivisionName: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(DataType.UUIDV4)
|
@Default(DataType.UUIDV4)
|
||||||
@IsUUID(4)
|
@IsUUID(4)
|
||||||
@Column(DataType.UUID)
|
@Column(DataType.UUID)
|
||||||
uuid: string
|
declare uuid: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
url: string
|
declare url: string
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -89,7 +89,7 @@ export class LocalVideoViewerModel extends SequelizeModel<LocalVideoViewerModel>
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
|
|
||||||
@HasMany(() => LocalVideoViewerWatchSectionModel, {
|
@HasMany(() => LocalVideoViewerWatchSectionModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -97,7 +97,7 @@ export class LocalVideoViewerModel extends SequelizeModel<LocalVideoViewerModel>
|
||||||
},
|
},
|
||||||
onDelete: 'cascade'
|
onDelete: 'cascade'
|
||||||
})
|
})
|
||||||
WatchSections: Awaited<LocalVideoViewerWatchSectionModel>[]
|
declare WatchSections: Awaited<LocalVideoViewerWatchSectionModel>[]
|
||||||
|
|
||||||
static loadByUrl (url: string): Promise<MLocalVideoViewer> {
|
static loadByUrl (url: string): Promise<MLocalVideoViewer> {
|
||||||
return this.findOne({
|
return this.findOne({
|
||||||
|
|
|
@ -4,10 +4,8 @@ import { VideoModel } from '../video/video.js'
|
||||||
import { SequelizeModel } from '../shared/index.js'
|
import { SequelizeModel } from '../shared/index.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Aggregate views of all videos federated with our instance
|
* Aggregate views of all videos federated with our instance
|
||||||
* Mainly used by the trending/hot algorithms
|
* Mainly used by the trending/hot algorithms
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Table({
|
@Table({
|
||||||
|
@ -24,23 +22,23 @@ import { SequelizeModel } from '../shared/index.js'
|
||||||
})
|
})
|
||||||
export class VideoViewModel extends SequelizeModel<VideoViewModel> {
|
export class VideoViewModel extends SequelizeModel<VideoViewModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column(DataType.DATE)
|
@Column(DataType.DATE)
|
||||||
startDate: Date
|
declare startDate: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column(DataType.DATE)
|
@Column(DataType.DATE)
|
||||||
endDate: Date
|
declare endDate: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
views: number
|
declare views: number
|
||||||
|
|
||||||
@ForeignKey(() => VideoModel)
|
@ForeignKey(() => VideoModel)
|
||||||
@Column
|
@Column
|
||||||
videoId: number
|
declare videoId: number
|
||||||
|
|
||||||
@BelongsTo(() => VideoModel, {
|
@BelongsTo(() => VideoModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -48,7 +46,7 @@ export class VideoViewModel extends SequelizeModel<VideoViewModel> {
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
Video: Awaited<VideoModel>
|
declare Video: Awaited<VideoModel>
|
||||||
|
|
||||||
static removeOldRemoteViewsHistory (beforeDate: string) {
|
static removeOldRemoteViewsHistory (beforeDate: string) {
|
||||||
const query = {
|
const query = {
|
||||||
|
|
|
@ -4,14 +4,7 @@ import { wordsToRegExp } from '@server/helpers/regexp.js'
|
||||||
import { MAccountId, MWatchedWordsList } from '@server/types/models/index.js'
|
import { MAccountId, MWatchedWordsList } from '@server/types/models/index.js'
|
||||||
import { LRUCache } from 'lru-cache'
|
import { LRUCache } from 'lru-cache'
|
||||||
import { Transaction } from 'sequelize'
|
import { Transaction } from 'sequelize'
|
||||||
import {
|
import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Table, UpdatedAt } from 'sequelize-typescript'
|
||||||
AllowNull,
|
|
||||||
BelongsTo,
|
|
||||||
Column,
|
|
||||||
CreatedAt,
|
|
||||||
DataType, ForeignKey, Table,
|
|
||||||
UpdatedAt
|
|
||||||
} from 'sequelize-typescript'
|
|
||||||
import { LRU_CACHE, USER_EXPORT_MAX_ITEMS } from '../../initializers/constants.js'
|
import { LRU_CACHE, USER_EXPORT_MAX_ITEMS } from '../../initializers/constants.js'
|
||||||
import { AccountModel } from '../account/account.js'
|
import { AccountModel } from '../account/account.js'
|
||||||
import { SequelizeModel, getSort } from '../shared/index.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> {
|
export class WatchedWordsListModel extends SequelizeModel<WatchedWordsListModel> {
|
||||||
@CreatedAt
|
@CreatedAt
|
||||||
createdAt: Date
|
declare createdAt: Date
|
||||||
|
|
||||||
@UpdatedAt
|
@UpdatedAt
|
||||||
updatedAt: Date
|
declare updatedAt: Date
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column
|
@Column
|
||||||
listName: string
|
declare listName: string
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Column(DataType.ARRAY(DataType.STRING))
|
@Column(DataType.ARRAY(DataType.STRING))
|
||||||
words: string[]
|
declare words: string[]
|
||||||
|
|
||||||
@ForeignKey(() => AccountModel)
|
@ForeignKey(() => AccountModel)
|
||||||
@Column
|
@Column
|
||||||
accountId: number
|
declare accountId: number
|
||||||
|
|
||||||
@BelongsTo(() => AccountModel, {
|
@BelongsTo(() => AccountModel, {
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
|
@ -53,7 +46,7 @@ export class WatchedWordsListModel extends SequelizeModel<WatchedWordsListModel>
|
||||||
},
|
},
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
})
|
})
|
||||||
Account: Awaited<AccountModel>
|
declare Account: Awaited<AccountModel>
|
||||||
|
|
||||||
// accountId => reg expressions
|
// accountId => reg expressions
|
||||||
private static readonly regexCache = new LRUCache<number, { listName: string, regex: RegExp }[]>({
|
private static readonly regexCache = new LRUCache<number, { listName: string, regex: RegExp }[]>({
|
||||||
|
|
11
server/core/types/express.d.ts
vendored
11
server/core/types/express.d.ts
vendored
|
@ -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 { RegisterServerAuthExternalOptions } from '@server/types/index.js'
|
||||||
import {
|
import {
|
||||||
MAbuseMessage,
|
MAbuseMessage,
|
||||||
|
@ -107,7 +114,7 @@ declare module 'express' {
|
||||||
message: string
|
message: string
|
||||||
|
|
||||||
title?: string
|
title?: string
|
||||||
status?: number
|
status?: HttpStatusCodeType
|
||||||
type?: ServerErrorCodeType
|
type?: ServerErrorCodeType
|
||||||
instance?: string
|
instance?: string
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "NodeNext",
|
"module": "NodeNext",
|
||||||
"target": "ES2017",
|
"target": "ES2022",
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
|
@ -17,7 +17,10 @@
|
||||||
"es2016",
|
"es2016",
|
||||||
"es2017",
|
"es2017",
|
||||||
"es2018",
|
"es2018",
|
||||||
"es2019"
|
"es2019",
|
||||||
|
"es2020",
|
||||||
|
"es2021",
|
||||||
|
"es2022"
|
||||||
],
|
],
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"strict": false,
|
"strict": false,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue