1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Stricter models typing

This commit is contained in:
Chocobozzz 2021-05-12 14:09:04 +02:00
parent 9a320a06b6
commit 16c016e8b1
No known key found for this signature in database
GPG key ID: 583A612D890159BE
54 changed files with 148 additions and 95 deletions

View file

@ -5,6 +5,7 @@ import * as parseTorrent from 'parse-torrent'
import { join } from 'path'
import { getEnabledResolutions } from '@server/lib/config'
import { setVideoTags } from '@server/lib/video'
import { FilteredModelAttributes } from '@server/types'
import {
MChannelAccountDefault,
MThumbnail,
@ -15,7 +16,7 @@ import {
MVideoThumbnail,
MVideoWithBlacklistLight
} from '@server/types/models'
import { MVideoImport, MVideoImportFormattable } from '@server/types/models/video/video-import'
import { MVideoImportFormattable } from '@server/types/models/video/video-import'
import { ServerErrorCode, VideoImportCreate, VideoImportState, VideoPrivacy, VideoState } from '../../../../shared'
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type'
@ -253,7 +254,9 @@ function buildVideo (channelId: number, body: VideoImportCreate, importData: You
privacy: body.privacy || VideoPrivacy.PRIVATE,
duration: 0, // duration will be set by the import job
channelId: channelId,
originallyPublishedAt: body.originallyPublishedAt || importData.originallyPublishedAt
originallyPublishedAt: body.originallyPublishedAt
? new Date(body.originallyPublishedAt)
: importData.originallyPublishedAt
}
const video = new VideoModel(videoData)
video.url = getLocalVideoActivityPubUrl(video)
@ -317,7 +320,7 @@ async function insertIntoDB (parameters: {
previewModel: MThumbnail
videoChannel: MChannelAccountDefault
tags: string[]
videoImportAttributes: Partial<MVideoImport>
videoImportAttributes: FilteredModelAttributes<VideoImportModel>
user: MUser
}): Promise<MVideoImportFormattable> {
const { video, thumbnailModel, previewModel, videoChannel, tags, videoImportAttributes, user } = parameters