aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/client.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-12 17:53:50 +0100
committerChocobozzz <me@florianbigard.com>2017-12-13 16:50:33 +0100
commit3fd3ab2d34d512b160a5e6084d7609be7b4f4452 (patch)
treee5ca358287fca6ecacce83defcf23af1e8e9f419 /server/controllers/client.ts
parentc893d4514e6ecbf282c7985fe5f82b8acd8a1137 (diff)
downloadPeerTube-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.ts12
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'
2import { join } from 'path' 2import { join } from 'path'
3import * as validator from 'validator' 3import * as validator from 'validator'
4import * as Bluebird from 'bluebird' 4import * as Bluebird from 'bluebird'
5
6import { database as db } from '../initializers/database'
7import { 5import {
8 CONFIG, 6 CONFIG,
9 STATIC_PATHS, 7 STATIC_PATHS,
@@ -13,7 +11,7 @@ import {
13} from '../initializers' 11} from '../initializers'
14import { root, readFileBufferPromise, escapeHTML } from '../helpers' 12import { root, readFileBufferPromise, escapeHTML } from '../helpers'
15import { asyncMiddleware } from '../middlewares' 13import { asyncMiddleware } from '../middlewares'
16import { VideoInstance } from '../models' 14import { VideoModel } from '../models/video/video'
17 15
18const clientsRouter = express.Router() 16const clientsRouter = express.Router()
19 17
@@ -49,7 +47,7 @@ export {
49 47
50// --------------------------------------------------------------------------- 48// ---------------------------------------------------------------------------
51 49
52function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoInstance) { 50function 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
109async function generateWatchHtmlPage (req: express.Request, res: express.Response, next: express.NextFunction) { 107async 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 }