From 96ca24f00e5ae5471dee9ee596489fe50af2b46f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 20 Aug 2019 10:22:05 +0200 Subject: Fix tests --- server/controllers/api/videos/import.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'server/controllers/api/videos/import.ts') diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts index adc2f9aa2..a058b37ef 100644 --- a/server/controllers/api/videos/import.ts +++ b/server/controllers/api/videos/import.ts @@ -28,6 +28,7 @@ import { MChannelActorAccountDefault, MThumbnail, MUser, + MVideoTag, MVideoThumbnailAccountDefault, MVideoWithBlacklistLight } from '@server/typings/models' @@ -244,7 +245,7 @@ function insertIntoDB (parameters: { const sequelizeOptions = { transaction: t } // Save video object in database - const videoCreated = await video.save(sequelizeOptions) as (MVideoThumbnailAccountDefault & MVideoWithBlacklistLight) + const videoCreated = await video.save(sequelizeOptions) as (MVideoThumbnailAccountDefault & MVideoWithBlacklistLight & MVideoTag) videoCreated.VideoChannel = videoChannel if (thumbnailModel) await videoCreated.addAndSaveThumbnail(thumbnailModel, t) @@ -264,6 +265,9 @@ function insertIntoDB (parameters: { const tagInstances = await TagModel.findOrCreateTags(tags, t) await videoCreated.$set('Tags', tagInstances, sequelizeOptions) + videoCreated.Tags = tagInstances + } else { + videoCreated.Tags = [] } // Create video import object in database -- cgit v1.2.3