From 69f616ab3aeefd6ce330600604df90f2f48bfe3b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sun, 11 Jun 2017 11:02:35 +0200 Subject: Use shared models --- server/middlewares/validators/videos.ts | 4 +++- server/models/user.ts | 2 +- server/models/video.ts | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'server') diff --git a/server/middlewares/validators/videos.ts b/server/middlewares/validators/videos.ts index e99cdefb1..03742a522 100644 --- a/server/middlewares/validators/videos.ts +++ b/server/middlewares/validators/videos.ts @@ -8,7 +8,9 @@ import { CONSTRAINTS_FIELDS, SEARCHABLE_COLUMNS } from '../../initializers' import { logger, isVideoDurationValid } from '../../helpers' function videosAddValidator (req: express.Request, res: express.Response, next: express.NextFunction) { - req.checkBody('videofile', 'Should have a valid file').isVideoFile(req.files) + // FIXME: Don't write an error message, it seems there is a bug with express-validator + // 'Should have a valid file' + req.checkBody('videofile').isVideoFile(req.files) req.checkBody('name', 'Should have a valid name').isVideoNameValid() req.checkBody('category', 'Should have a valid category').isVideoCategoryValid() req.checkBody('licence', 'Should have a valid licence').isVideoLicenceValid() diff --git a/server/models/user.ts b/server/models/user.ts index 0fbfdda50..cd383a16a 100644 --- a/server/models/user.ts +++ b/server/models/user.ts @@ -135,7 +135,7 @@ isPasswordMatch = function (password: string, callback: UserMethods.IsPasswordMa return comparePassword(password, this.password, callback) } -toFormatedJSON = function () { +toFormatedJSON = function (this: UserInstance) { return { id: this.id, username: this.username, diff --git a/server/models/video.ts b/server/models/video.ts index 3f808b811..2234664f4 100644 --- a/server/models/video.ts +++ b/server/models/video.ts @@ -447,7 +447,7 @@ isOwned = function () { return this.remoteId === null } -toFormatedJSON = function () { +toFormatedJSON = function (this: VideoInstance) { let podHost if (this.Author.Pod) { @@ -488,7 +488,7 @@ toFormatedJSON = function () { views: this.views, likes: this.likes, dislikes: this.dislikes, - tags: map(this.Tags, 'name'), + tags: map(this.Tags, 'name'), thumbnailPath: join(STATIC_PATHS.THUMBNAILS, this.getThumbnailName()), createdAt: this.createdAt, updatedAt: this.updatedAt -- cgit v1.2.3