diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-06-11 11:02:35 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-06-11 11:02:35 +0200 |
commit | 69f616ab3aeefd6ce330600604df90f2f48bfe3b (patch) | |
tree | 1b40d6005e645d97a7db9784f32cd90b156528fa /server | |
parent | 75fb0c0b2efe7fb952d45d2bf111e9594f7d5b42 (diff) | |
download | PeerTube-69f616ab3aeefd6ce330600604df90f2f48bfe3b.tar.gz PeerTube-69f616ab3aeefd6ce330600604df90f2f48bfe3b.tar.zst PeerTube-69f616ab3aeefd6ce330600604df90f2f48bfe3b.zip |
Use shared models
Diffstat (limited to 'server')
-rw-r--r-- | server/middlewares/validators/videos.ts | 4 | ||||
-rw-r--r-- | server/models/user.ts | 2 | ||||
-rw-r--r-- | server/models/video.ts | 4 |
3 files changed, 6 insertions, 4 deletions
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' | |||
8 | import { logger, isVideoDurationValid } from '../../helpers' | 8 | import { logger, isVideoDurationValid } from '../../helpers' |
9 | 9 | ||
10 | function videosAddValidator (req: express.Request, res: express.Response, next: express.NextFunction) { | 10 | function videosAddValidator (req: express.Request, res: express.Response, next: express.NextFunction) { |
11 | req.checkBody('videofile', 'Should have a valid file').isVideoFile(req.files) | 11 | // FIXME: Don't write an error message, it seems there is a bug with express-validator |
12 | // 'Should have a valid file' | ||
13 | req.checkBody('videofile').isVideoFile(req.files) | ||
12 | req.checkBody('name', 'Should have a valid name').isVideoNameValid() | 14 | req.checkBody('name', 'Should have a valid name').isVideoNameValid() |
13 | req.checkBody('category', 'Should have a valid category').isVideoCategoryValid() | 15 | req.checkBody('category', 'Should have a valid category').isVideoCategoryValid() |
14 | req.checkBody('licence', 'Should have a valid licence').isVideoLicenceValid() | 16 | 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 | |||
135 | return comparePassword(password, this.password, callback) | 135 | return comparePassword(password, this.password, callback) |
136 | } | 136 | } |
137 | 137 | ||
138 | toFormatedJSON = function () { | 138 | toFormatedJSON = function (this: UserInstance) { |
139 | return { | 139 | return { |
140 | id: this.id, | 140 | id: this.id, |
141 | username: this.username, | 141 | 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 () { | |||
447 | return this.remoteId === null | 447 | return this.remoteId === null |
448 | } | 448 | } |
449 | 449 | ||
450 | toFormatedJSON = function () { | 450 | toFormatedJSON = function (this: VideoInstance) { |
451 | let podHost | 451 | let podHost |
452 | 452 | ||
453 | if (this.Author.Pod) { | 453 | if (this.Author.Pod) { |
@@ -488,7 +488,7 @@ toFormatedJSON = function () { | |||
488 | views: this.views, | 488 | views: this.views, |
489 | likes: this.likes, | 489 | likes: this.likes, |
490 | dislikes: this.dislikes, | 490 | dislikes: this.dislikes, |
491 | tags: map(this.Tags, 'name'), | 491 | tags: map<VideoTagInstance, string>(this.Tags, 'name'), |
492 | thumbnailPath: join(STATIC_PATHS.THUMBNAILS, this.getThumbnailName()), | 492 | thumbnailPath: join(STATIC_PATHS.THUMBNAILS, this.getThumbnailName()), |
493 | createdAt: this.createdAt, | 493 | createdAt: this.createdAt, |
494 | updatedAt: this.updatedAt | 494 | updatedAt: this.updatedAt |