diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-12 17:53:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-13 16:50:33 +0100 |
commit | 3fd3ab2d34d512b160a5e6084d7609be7b4f4452 (patch) | |
tree | e5ca358287fca6ecacce83defcf23af1e8e9f419 /server/controllers/client.ts | |
parent | c893d4514e6ecbf282c7985fe5f82b8acd8a1137 (diff) | |
download | PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.gz PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.zst PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.zip |
Move models to typescript-sequelize
Diffstat (limited to 'server/controllers/client.ts')
-rw-r--r-- | server/controllers/client.ts | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/server/controllers/client.ts b/server/controllers/client.ts index 1b140b14a..9a72fe8e0 100644 --- a/server/controllers/client.ts +++ b/server/controllers/client.ts | |||
@@ -2,8 +2,6 @@ import * as express from 'express' | |||
2 | import { join } from 'path' | 2 | import { join } from 'path' |
3 | import * as validator from 'validator' | 3 | import * as validator from 'validator' |
4 | import * as Bluebird from 'bluebird' | 4 | import * as Bluebird from 'bluebird' |
5 | |||
6 | import { database as db } from '../initializers/database' | ||
7 | import { | 5 | import { |
8 | CONFIG, | 6 | CONFIG, |
9 | STATIC_PATHS, | 7 | STATIC_PATHS, |
@@ -13,7 +11,7 @@ import { | |||
13 | } from '../initializers' | 11 | } from '../initializers' |
14 | import { root, readFileBufferPromise, escapeHTML } from '../helpers' | 12 | import { root, readFileBufferPromise, escapeHTML } from '../helpers' |
15 | import { asyncMiddleware } from '../middlewares' | 13 | import { asyncMiddleware } from '../middlewares' |
16 | import { VideoInstance } from '../models' | 14 | import { VideoModel } from '../models/video/video' |
17 | 15 | ||
18 | const clientsRouter = express.Router() | 16 | const clientsRouter = express.Router() |
19 | 17 | ||
@@ -49,7 +47,7 @@ export { | |||
49 | 47 | ||
50 | // --------------------------------------------------------------------------- | 48 | // --------------------------------------------------------------------------- |
51 | 49 | ||
52 | function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoInstance) { | 50 | function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoModel) { |
53 | const previewUrl = CONFIG.WEBSERVER.URL + STATIC_PATHS.PREVIEWS + video.getPreviewName() | 51 | const previewUrl = CONFIG.WEBSERVER.URL + STATIC_PATHS.PREVIEWS + video.getPreviewName() |
54 | const videoUrl = CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid | 52 | const videoUrl = CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid |
55 | 53 | ||
@@ -108,13 +106,13 @@ function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoInstance | |||
108 | 106 | ||
109 | async function generateWatchHtmlPage (req: express.Request, res: express.Response, next: express.NextFunction) { | 107 | async function generateWatchHtmlPage (req: express.Request, res: express.Response, next: express.NextFunction) { |
110 | const videoId = '' + req.params.id | 108 | const videoId = '' + req.params.id |
111 | let videoPromise: Bluebird<VideoInstance> | 109 | let videoPromise: Bluebird<VideoModel> |
112 | 110 | ||
113 | // Let Angular application handle errors | 111 | // Let Angular application handle errors |
114 | if (validator.isUUID(videoId, 4)) { | 112 | if (validator.isUUID(videoId, 4)) { |
115 | videoPromise = db.Video.loadByUUIDAndPopulateAccountAndServerAndTags(videoId) | 113 | videoPromise = VideoModel.loadByUUIDAndPopulateAccountAndServerAndTags(videoId) |
116 | } else if (validator.isInt(videoId)) { | 114 | } else if (validator.isInt(videoId)) { |
117 | videoPromise = db.Video.loadAndPopulateAccountAndServerAndTags(+videoId) | 115 | videoPromise = VideoModel.loadAndPopulateAccountAndServerAndTags(+videoId) |
118 | } else { | 116 | } else { |
119 | return res.sendFile(indexPath) | 117 | return res.sendFile(indexPath) |
120 | } | 118 | } |