From 3fd3ab2d34d512b160a5e6084d7609be7b4f4452 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 12 Dec 2017 17:53:50 +0100 Subject: Move models to typescript-sequelize --- server/lib/cache/videos-preview-cache.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'server/lib/cache') diff --git a/server/lib/cache/videos-preview-cache.ts b/server/lib/cache/videos-preview-cache.ts index 7f352f361..c5bda8dd8 100644 --- a/server/lib/cache/videos-preview-cache.ts +++ b/server/lib/cache/videos-preview-cache.ts @@ -1,11 +1,10 @@ import * as asyncLRU from 'async-lru' -import { join } from 'path' import { createWriteStream } from 'fs' - -import { database as db, CONFIG, CACHE } from '../../initializers' +import { join } from 'path' import { logger, unlinkPromise } from '../../helpers' -import { VideoInstance } from '../../models' -import { fetchRemoteVideoPreview } from '../activitypub/videos' +import { CACHE, CONFIG } from '../../initializers' +import { VideoModel } from '../../models/video/video' +import { fetchRemoteVideoPreview } from '../activitypub' class VideosPreviewCache { @@ -43,7 +42,7 @@ class VideosPreviewCache { } private async loadPreviews (key: string) { - const video = await db.Video.loadByUUIDAndPopulateAccountAndServerAndTags(key) + const video = await VideoModel.loadByUUIDAndPopulateAccountAndServerAndTags(key) if (!video) return undefined if (video.isOwned()) return join(CONFIG.STORAGE.PREVIEWS_DIR, video.getPreviewName()) @@ -53,7 +52,7 @@ class VideosPreviewCache { return res } - private saveRemotePreviewAndReturnPath (video: VideoInstance) { + private saveRemotePreviewAndReturnPath (video: VideoModel) { const req = fetchRemoteVideoPreview(video) return new Promise((res, rej) => { -- cgit v1.2.3