aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-08-25 11:45:31 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-08-25 11:45:31 +0200
commit0aef76c479bc7fc758e70e1cd478ade46761b51b (patch)
treeed59eae3ee731c56d25cc35a382f4cc400d0dece
parent93e1258c7cbc0d1235ca6d2a1f7c1875985328b8 (diff)
downloadPeerTube-0aef76c479bc7fc758e70e1cd478ade46761b51b.tar.gz
PeerTube-0aef76c479bc7fc758e70e1cd478ade46761b51b.tar.zst
PeerTube-0aef76c479bc7fc758e70e1cd478ade46761b51b.zip
Formated -> Formatted
-rw-r--r--client/src/app/+admin/request-schedulers/shared/request-schedulers-stats-attributes.model.ts4
-rw-r--r--server/controllers/api/pods.ts6
-rw-r--r--server/controllers/api/users.ts10
-rw-r--r--server/controllers/api/videos/abuse.ts4
-rw-r--r--server/controllers/api/videos/index.ts8
-rw-r--r--server/helpers/utils.ts12
-rw-r--r--server/lib/friends.ts4
-rw-r--r--server/models/pod/pod-interface.ts6
-rw-r--r--server/models/pod/pod.ts6
-rw-r--r--server/models/user/user-interface.ts8
-rw-r--r--server/models/user/user.ts6
-rw-r--r--server/models/video/video-abuse-interface.ts6
-rw-r--r--server/models/video/video-abuse.ts6
-rw-r--r--server/models/video/video-blacklist-interface.ts8
-rw-r--r--server/models/video/video-blacklist.ts6
-rw-r--r--server/models/video/video-interface.ts20
-rw-r--r--server/models/video/video.ts6
17 files changed, 63 insertions, 63 deletions
diff --git a/client/src/app/+admin/request-schedulers/shared/request-schedulers-stats-attributes.model.ts b/client/src/app/+admin/request-schedulers/shared/request-schedulers-stats-attributes.model.ts
index 6e19a0e44..c4abf3d4d 100644
--- a/client/src/app/+admin/request-schedulers/shared/request-schedulers-stats-attributes.model.ts
+++ b/client/src/app/+admin/request-schedulers/shared/request-schedulers-stats-attributes.model.ts
@@ -1,11 +1,11 @@
1import { RequestSchedulerStatsAttributes as FormatedRequestSchedulerStatsAttributes } from '../../../../../../shared' 1import { RequestSchedulerStatsAttributes as FormattedRequestSchedulerStatsAttributes } from '../../../../../../shared'
2 2
3export interface Request { 3export interface Request {
4 request: any 4 request: any
5 to: any 5 to: any
6} 6}
7 7
8export class RequestSchedulerStatsAttributes implements FormatedRequestSchedulerStatsAttributes { 8export class RequestSchedulerStatsAttributes implements FormattedRequestSchedulerStatsAttributes {
9 requestsLimitPods: number 9 requestsLimitPods: number
10 requestsLimitPerPod: number 10 requestsLimitPerPod: number
11 milliSecondsInterval: number 11 milliSecondsInterval: number
diff --git a/server/controllers/api/pods.ts b/server/controllers/api/pods.ts
index 916b131d9..e1fa4b7e8 100644
--- a/server/controllers/api/pods.ts
+++ b/server/controllers/api/pods.ts
@@ -5,7 +5,7 @@ import { CONFIG } from '../../initializers'
5import { 5import {
6 logger, 6 logger,
7 getMyPublicCert, 7 getMyPublicCert,
8 getFormatedObjects 8 getFormattedObjects
9} from '../../helpers' 9} from '../../helpers'
10import { 10import {
11 sendOwnedVideosToPod, 11 sendOwnedVideosToPod,
@@ -25,7 +25,7 @@ import {
25import { 25import {
26 PodInstance 26 PodInstance
27} from '../../models' 27} from '../../models'
28import { Pod as FormatedPod } from '../../../shared' 28import { Pod as FormattedPod } from '../../../shared'
29 29
30const podsRouter = express.Router() 30const podsRouter = express.Router()
31 31
@@ -81,7 +81,7 @@ function addPods (req: express.Request, res: express.Response, next: express.Nex
81 81
82function listPods (req: express.Request, res: express.Response, next: express.NextFunction) { 82function listPods (req: express.Request, res: express.Response, next: express.NextFunction) {
83 db.Pod.list() 83 db.Pod.list()
84 .then(podsList => res.json(getFormatedObjects<FormatedPod, PodInstance>(podsList, podsList.length))) 84 .then(podsList => res.json(getFormattedObjects<FormattedPod, PodInstance>(podsList, podsList.length)))
85 .catch(err => next(err)) 85 .catch(err => next(err))
86} 86}
87 87
diff --git a/server/controllers/api/users.ts b/server/controllers/api/users.ts
index f50dbc9a3..04d885185 100644
--- a/server/controllers/api/users.ts
+++ b/server/controllers/api/users.ts
@@ -2,7 +2,7 @@ import * as express from 'express'
2 2
3import { database as db } from '../../initializers/database' 3import { database as db } from '../../initializers/database'
4import { USER_ROLES } from '../../initializers' 4import { USER_ROLES } from '../../initializers'
5import { logger, getFormatedObjects } from '../../helpers' 5import { logger, getFormattedObjects } from '../../helpers'
6import { 6import {
7 authenticate, 7 authenticate,
8 ensureIsAdmin, 8 ensureIsAdmin,
@@ -17,7 +17,7 @@ import {
17 setUsersSort, 17 setUsersSort,
18 token 18 token
19} from '../../middlewares' 19} from '../../middlewares'
20import { UserVideoRate as FormatedUserVideoRate, UserCreate, UserUpdate } from '../../../shared' 20import { UserVideoRate as FormattedUserVideoRate, UserCreate, UserUpdate } from '../../../shared'
21 21
22const usersRouter = express.Router() 22const usersRouter = express.Router()
23 23
@@ -95,7 +95,7 @@ function createUser (req: express.Request, res: express.Response, next: express.
95 95
96function getUserInformation (req: express.Request, res: express.Response, next: express.NextFunction) { 96function getUserInformation (req: express.Request, res: express.Response, next: express.NextFunction) {
97 db.User.loadByUsername(res.locals.oauth.token.user.username) 97 db.User.loadByUsername(res.locals.oauth.token.user.username)
98 .then(user => res.json(user.toFormatedJSON())) 98 .then(user => res.json(user.toFormattedJSON()))
99 .catch(err => next(err)) 99 .catch(err => next(err))
100} 100}
101 101
@@ -106,7 +106,7 @@ function getUserVideoRating (req: express.Request, res: express.Response, next:
106 db.UserVideoRate.load(userId, videoId, null) 106 db.UserVideoRate.load(userId, videoId, null)
107 .then(ratingObj => { 107 .then(ratingObj => {
108 const rating = ratingObj ? ratingObj.type : 'none' 108 const rating = ratingObj ? ratingObj.type : 'none'
109 const json: FormatedUserVideoRate = { 109 const json: FormattedUserVideoRate = {
110 videoId, 110 videoId,
111 rating 111 rating
112 } 112 }
@@ -118,7 +118,7 @@ function getUserVideoRating (req: express.Request, res: express.Response, next:
118function listUsers (req: express.Request, res: express.Response, next: express.NextFunction) { 118function listUsers (req: express.Request, res: express.Response, next: express.NextFunction) {
119 db.User.listForApi(req.query.start, req.query.count, req.query.sort) 119 db.User.listForApi(req.query.start, req.query.count, req.query.sort)
120 .then(resultList => { 120 .then(resultList => {
121 res.json(getFormatedObjects(resultList.data, resultList.total)) 121 res.json(getFormattedObjects(resultList.data, resultList.total))
122 }) 122 })
123 .catch(err => next(err)) 123 .catch(err => next(err))
124} 124}
diff --git a/server/controllers/api/videos/abuse.ts b/server/controllers/api/videos/abuse.ts
index 5cf0303fb..c9313d5f5 100644
--- a/server/controllers/api/videos/abuse.ts
+++ b/server/controllers/api/videos/abuse.ts
@@ -4,7 +4,7 @@ import { database as db } from '../../../initializers/database'
4import * as friends from '../../../lib/friends' 4import * as friends from '../../../lib/friends'
5import { 5import {
6 logger, 6 logger,
7 getFormatedObjects, 7 getFormattedObjects,
8 retryTransactionWrapper 8 retryTransactionWrapper
9} from '../../../helpers' 9} from '../../../helpers'
10import { 10import {
@@ -46,7 +46,7 @@ export {
46 46
47function listVideoAbuses (req: express.Request, res: express.Response, next: express.NextFunction) { 47function listVideoAbuses (req: express.Request, res: express.Response, next: express.NextFunction) {
48 db.VideoAbuse.listForApi(req.query.start, req.query.count, req.query.sort) 48 db.VideoAbuse.listForApi(req.query.start, req.query.count, req.query.sort)
49 .then(result => res.json(getFormatedObjects(result.data, result.total))) 49 .then(result => res.json(getFormattedObjects(result.data, result.total)))
50 .catch(err => next(err)) 50 .catch(err => next(err))
51} 51}
52 52
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index d71a132ed..f639df098 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -36,7 +36,7 @@ import {
36 logger, 36 logger,
37 retryTransactionWrapper, 37 retryTransactionWrapper,
38 generateRandomString, 38 generateRandomString,
39 getFormatedObjects, 39 getFormattedObjects,
40 renamePromise 40 renamePromise
41} from '../../../helpers' 41} from '../../../helpers'
42import { TagInstance } from '../../../models' 42import { TagInstance } from '../../../models'
@@ -386,12 +386,12 @@ function getVideo (req: express.Request, res: express.Response, next: express.Ne
386 } 386 }
387 387
388 // Do not wait the view system 388 // Do not wait the view system
389 res.json(videoInstance.toFormatedJSON()) 389 res.json(videoInstance.toFormattedJSON())
390} 390}
391 391
392function listVideos (req: express.Request, res: express.Response, next: express.NextFunction) { 392function listVideos (req: express.Request, res: express.Response, next: express.NextFunction) {
393 db.Video.listForApi(req.query.start, req.query.count, req.query.sort) 393 db.Video.listForApi(req.query.start, req.query.count, req.query.sort)
394 .then(result => res.json(getFormatedObjects(result.data, result.total))) 394 .then(result => res.json(getFormattedObjects(result.data, result.total)))
395 .catch(err => next(err)) 395 .catch(err => next(err))
396} 396}
397 397
@@ -408,6 +408,6 @@ function removeVideo (req: express.Request, res: express.Response, next: express
408 408
409function searchVideos (req: express.Request, res: express.Response, next: express.NextFunction) { 409function searchVideos (req: express.Request, res: express.Response, next: express.NextFunction) {
410 db.Video.searchAndPopulateAuthorAndPodAndTags(req.params.value, req.query.field, req.query.start, req.query.count, req.query.sort) 410 db.Video.searchAndPopulateAuthorAndPodAndTags(req.params.value, req.query.field, req.query.start, req.query.count, req.query.sort)
411 .then(result => res.json(getFormatedObjects(result.data, result.total))) 411 .then(result => res.json(getFormattedObjects(result.data, result.total)))
412 .catch(err => next(err)) 412 .catch(err => next(err))
413} 413}
diff --git a/server/helpers/utils.ts b/server/helpers/utils.ts
index f326210f3..af5be0c69 100644
--- a/server/helpers/utils.ts
+++ b/server/helpers/utils.ts
@@ -14,19 +14,19 @@ function generateRandomString (size: number) {
14} 14}
15 15
16interface FormatableToJSON { 16interface FormatableToJSON {
17 toFormatedJSON () 17 toFormattedJSON ()
18} 18}
19 19
20function getFormatedObjects<U, T extends FormatableToJSON> (objects: T[], objectsTotal: number) { 20function getFormattedObjects<U, T extends FormatableToJSON> (objects: T[], objectsTotal: number) {
21 const formatedObjects: U[] = [] 21 const formattedObjects: U[] = []
22 22
23 objects.forEach(object => { 23 objects.forEach(object => {
24 formatedObjects.push(object.toFormatedJSON()) 24 formattedObjects.push(object.toFormattedJSON())
25 }) 25 })
26 26
27 const res: ResultList<U> = { 27 const res: ResultList<U> = {
28 total: objectsTotal, 28 total: objectsTotal,
29 data: formatedObjects 29 data: formattedObjects
30 } 30 }
31 31
32 return res 32 return res
@@ -52,6 +52,6 @@ function isSignupAllowed () {
52export { 52export {
53 badRequest, 53 badRequest,
54 generateRandomString, 54 generateRandomString,
55 getFormatedObjects, 55 getFormattedObjects,
56 isSignupAllowed 56 isSignupAllowed
57} 57}
diff --git a/server/lib/friends.ts b/server/lib/friends.ts
index bd3ff97a5..3f0ce3f33 100644
--- a/server/lib/friends.ts
+++ b/server/lib/friends.ts
@@ -42,7 +42,7 @@ import {
42 RemoteVideoRemoveData, 42 RemoteVideoRemoveData,
43 RemoteVideoReportAbuseData, 43 RemoteVideoReportAbuseData,
44 ResultList, 44 ResultList,
45 Pod as FormatedPod 45 Pod as FormattedPod
46} from '../../shared' 46} from '../../shared'
47 47
48type QaduParam = { videoId: number, type: RequestVideoQaduType } 48type QaduParam = { videoId: number, type: RequestVideoQaduType }
@@ -332,7 +332,7 @@ function computeWinningPods (hosts: string[], podsScore: { [ host: string ]: num
332} 332}
333 333
334function getForeignPodsList (host: string) { 334function getForeignPodsList (host: string) {
335 return new Promise< ResultList<FormatedPod> >((res, rej) => { 335 return new Promise< ResultList<FormattedPod> >((res, rej) => {
336 const path = '/api/' + API_VERSION + '/pods' 336 const path = '/api/' + API_VERSION + '/pods'
337 337
338 request.get(REMOTE_SCHEME.HTTP + '://' + host + path, (err, response, body) => { 338 request.get(REMOTE_SCHEME.HTTP + '://' + host + path, (err, response, body) => {
diff --git a/server/models/pod/pod-interface.ts b/server/models/pod/pod-interface.ts
index 340d4f1a7..8b0b72167 100644
--- a/server/models/pod/pod-interface.ts
+++ b/server/models/pod/pod-interface.ts
@@ -2,10 +2,10 @@ import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird' 2import * as Promise from 'bluebird'
3 3
4// Don't use barrel, import just what we need 4// Don't use barrel, import just what we need
5import { Pod as FormatedPod } from '../../../shared/models/pods/pod.model' 5import { Pod as FormattedPod } from '../../../shared/models/pods/pod.model'
6 6
7export namespace PodMethods { 7export namespace PodMethods {
8 export type ToFormatedJSON = (this: PodInstance) => FormatedPod 8 export type ToFormattedJSON = (this: PodInstance) => FormattedPod
9 9
10 export type CountAll = () => Promise<number> 10 export type CountAll = () => Promise<number>
11 11
@@ -53,7 +53,7 @@ export interface PodInstance extends PodClass, PodAttributes, Sequelize.Instance
53 createdAt: Date 53 createdAt: Date
54 updatedAt: Date 54 updatedAt: Date
55 55
56 toFormatedJSON: PodMethods.ToFormatedJSON, 56 toFormattedJSON: PodMethods.ToFormattedJSON,
57} 57}
58 58
59export interface PodModel extends PodClass, Sequelize.Model<PodInstance, PodAttributes> {} 59export interface PodModel extends PodClass, Sequelize.Model<PodInstance, PodAttributes> {}
diff --git a/server/models/pod/pod.ts b/server/models/pod/pod.ts
index e1088977f..56918e358 100644
--- a/server/models/pod/pod.ts
+++ b/server/models/pod/pod.ts
@@ -13,7 +13,7 @@ import {
13} from './pod-interface' 13} from './pod-interface'
14 14
15let Pod: Sequelize.Model<PodInstance, PodAttributes> 15let Pod: Sequelize.Model<PodInstance, PodAttributes>
16let toFormatedJSON: PodMethods.ToFormatedJSON 16let toFormattedJSON: PodMethods.ToFormattedJSON
17let countAll: PodMethods.CountAll 17let countAll: PodMethods.CountAll
18let incrementScores: PodMethods.IncrementScores 18let incrementScores: PodMethods.IncrementScores
19let list: PodMethods.List 19let list: PodMethods.List
@@ -86,7 +86,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da
86 updatePodsScore, 86 updatePodsScore,
87 removeAll 87 removeAll
88 ] 88 ]
89 const instanceMethods = [ toFormatedJSON ] 89 const instanceMethods = [ toFormattedJSON ]
90 addMethodsToModel(Pod, classMethods, instanceMethods) 90 addMethodsToModel(Pod, classMethods, instanceMethods)
91 91
92 return Pod 92 return Pod
@@ -94,7 +94,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da
94 94
95// ------------------------------ METHODS ------------------------------ 95// ------------------------------ METHODS ------------------------------
96 96
97toFormatedJSON = function (this: PodInstance) { 97toFormattedJSON = function (this: PodInstance) {
98 const json = { 98 const json = {
99 id: this.id, 99 id: this.id,
100 host: this.host, 100 host: this.host,
diff --git a/server/models/user/user-interface.ts b/server/models/user/user-interface.ts
index 9bd3d2ebb..0b97a8f6d 100644
--- a/server/models/user/user-interface.ts
+++ b/server/models/user/user-interface.ts
@@ -2,14 +2,14 @@ import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird' 2import * as Promise from 'bluebird'
3 3
4// Don't use barrel, import just what we need 4// Don't use barrel, import just what we need
5import { User as FormatedUser } from '../../../shared/models/users/user.model' 5import { User as FormattedUser } from '../../../shared/models/users/user.model'
6import { UserRole } from '../../../shared/models/users/user-role.type' 6import { UserRole } from '../../../shared/models/users/user-role.type'
7import { ResultList } from '../../../shared/models/result-list.model' 7import { ResultList } from '../../../shared/models/result-list.model'
8 8
9export namespace UserMethods { 9export namespace UserMethods {
10 export type IsPasswordMatch = (this: UserInstance, password: string) => Promise<boolean> 10 export type IsPasswordMatch = (this: UserInstance, password: string) => Promise<boolean>
11 11
12 export type ToFormatedJSON = (this: UserInstance) => FormatedUser 12 export type ToFormattedJSON = (this: UserInstance) => FormattedUser
13 export type IsAdmin = (this: UserInstance) => boolean 13 export type IsAdmin = (this: UserInstance) => boolean
14 14
15 export type CountTotal = () => Promise<number> 15 export type CountTotal = () => Promise<number>
@@ -29,7 +29,7 @@ export namespace UserMethods {
29 29
30export interface UserClass { 30export interface UserClass {
31 isPasswordMatch: UserMethods.IsPasswordMatch, 31 isPasswordMatch: UserMethods.IsPasswordMatch,
32 toFormatedJSON: UserMethods.ToFormatedJSON, 32 toFormattedJSON: UserMethods.ToFormattedJSON,
33 isAdmin: UserMethods.IsAdmin, 33 isAdmin: UserMethods.IsAdmin,
34 34
35 countTotal: UserMethods.CountTotal, 35 countTotal: UserMethods.CountTotal,
@@ -55,7 +55,7 @@ export interface UserInstance extends UserClass, UserAttributes, Sequelize.Insta
55 updatedAt: Date 55 updatedAt: Date
56 56
57 isPasswordMatch: UserMethods.IsPasswordMatch 57 isPasswordMatch: UserMethods.IsPasswordMatch
58 toFormatedJSON: UserMethods.ToFormatedJSON 58 toFormattedJSON: UserMethods.ToFormattedJSON
59 isAdmin: UserMethods.IsAdmin 59 isAdmin: UserMethods.IsAdmin
60} 60}
61 61
diff --git a/server/models/user/user.ts b/server/models/user/user.ts
index bda95d2f6..e1b933988 100644
--- a/server/models/user/user.ts
+++ b/server/models/user/user.ts
@@ -21,7 +21,7 @@ import {
21 21
22let User: Sequelize.Model<UserInstance, UserAttributes> 22let User: Sequelize.Model<UserInstance, UserAttributes>
23let isPasswordMatch: UserMethods.IsPasswordMatch 23let isPasswordMatch: UserMethods.IsPasswordMatch
24let toFormatedJSON: UserMethods.ToFormatedJSON 24let toFormattedJSON: UserMethods.ToFormattedJSON
25let isAdmin: UserMethods.IsAdmin 25let isAdmin: UserMethods.IsAdmin
26let countTotal: UserMethods.CountTotal 26let countTotal: UserMethods.CountTotal
27let getByUsername: UserMethods.GetByUsername 27let getByUsername: UserMethods.GetByUsername
@@ -108,7 +108,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da
108 ] 108 ]
109 const instanceMethods = [ 109 const instanceMethods = [
110 isPasswordMatch, 110 isPasswordMatch,
111 toFormatedJSON, 111 toFormattedJSON,
112 isAdmin 112 isAdmin
113 ] 113 ]
114 addMethodsToModel(User, classMethods, instanceMethods) 114 addMethodsToModel(User, classMethods, instanceMethods)
@@ -129,7 +129,7 @@ isPasswordMatch = function (this: UserInstance, password: string) {
129 return comparePassword(password, this.password) 129 return comparePassword(password, this.password)
130} 130}
131 131
132toFormatedJSON = function (this: UserInstance) { 132toFormattedJSON = function (this: UserInstance) {
133 return { 133 return {
134 id: this.id, 134 id: this.id,
135 username: this.username, 135 username: this.username,
diff --git a/server/models/video/video-abuse-interface.ts b/server/models/video/video-abuse-interface.ts
index fa45aa5f9..abc82f7ac 100644
--- a/server/models/video/video-abuse-interface.ts
+++ b/server/models/video/video-abuse-interface.ts
@@ -5,10 +5,10 @@ import { PodInstance } from '../pod'
5import { ResultList } from '../../../shared' 5import { ResultList } from '../../../shared'
6 6
7// Don't use barrel, import just what we need 7// Don't use barrel, import just what we need
8import { VideoAbuse as FormatedVideoAbuse } from '../../../shared/models/videos/video-abuse.model' 8import { VideoAbuse as FormattedVideoAbuse } from '../../../shared/models/videos/video-abuse.model'
9 9
10export namespace VideoAbuseMethods { 10export namespace VideoAbuseMethods {
11 export type ToFormatedJSON = (this: VideoAbuseInstance) => FormatedVideoAbuse 11 export type ToFormattedJSON = (this: VideoAbuseInstance) => FormattedVideoAbuse
12 12
13 export type ListForApi = (start: number, count: number, sort: string) => Promise< ResultList<VideoAbuseInstance> > 13 export type ListForApi = (start: number, count: number, sort: string) => Promise< ResultList<VideoAbuseInstance> >
14} 14}
@@ -30,7 +30,7 @@ export interface VideoAbuseInstance extends VideoAbuseClass, VideoAbuseAttribute
30 30
31 Pod: PodInstance 31 Pod: PodInstance
32 32
33 toFormatedJSON: VideoAbuseMethods.ToFormatedJSON 33 toFormattedJSON: VideoAbuseMethods.ToFormattedJSON
34} 34}
35 35
36export interface VideoAbuseModel extends VideoAbuseClass, Sequelize.Model<VideoAbuseInstance, VideoAbuseAttributes> {} 36export interface VideoAbuseModel extends VideoAbuseClass, Sequelize.Model<VideoAbuseInstance, VideoAbuseAttributes> {}
diff --git a/server/models/video/video-abuse.ts b/server/models/video/video-abuse.ts
index df92609c0..ebc63e7a0 100644
--- a/server/models/video/video-abuse.ts
+++ b/server/models/video/video-abuse.ts
@@ -12,7 +12,7 @@ import {
12} from './video-abuse-interface' 12} from './video-abuse-interface'
13 13
14let VideoAbuse: Sequelize.Model<VideoAbuseInstance, VideoAbuseAttributes> 14let VideoAbuse: Sequelize.Model<VideoAbuseInstance, VideoAbuseAttributes>
15let toFormatedJSON: VideoAbuseMethods.ToFormatedJSON 15let toFormattedJSON: VideoAbuseMethods.ToFormattedJSON
16let listForApi: VideoAbuseMethods.ListForApi 16let listForApi: VideoAbuseMethods.ListForApi
17 17
18export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) { 18export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
@@ -57,7 +57,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da
57 listForApi 57 listForApi
58 ] 58 ]
59 const instanceMethods = [ 59 const instanceMethods = [
60 toFormatedJSON 60 toFormattedJSON
61 ] 61 ]
62 addMethodsToModel(VideoAbuse, classMethods, instanceMethods) 62 addMethodsToModel(VideoAbuse, classMethods, instanceMethods)
63 63
@@ -66,7 +66,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da
66 66
67// ------------------------------ METHODS ------------------------------ 67// ------------------------------ METHODS ------------------------------
68 68
69toFormatedJSON = function (this: VideoAbuseInstance) { 69toFormattedJSON = function (this: VideoAbuseInstance) {
70 let reporterPodHost 70 let reporterPodHost
71 71
72 if (this.Pod) { 72 if (this.Pod) {
diff --git a/server/models/video/video-blacklist-interface.ts b/server/models/video/video-blacklist-interface.ts
index cd9f19363..ba48b1b6e 100644
--- a/server/models/video/video-blacklist-interface.ts
+++ b/server/models/video/video-blacklist-interface.ts
@@ -4,10 +4,10 @@ import * as Promise from 'bluebird'
4import { ResultList } from '../../../shared' 4import { ResultList } from '../../../shared'
5 5
6// Don't use barrel, import just what we need 6// Don't use barrel, import just what we need
7import { BlacklistedVideo as FormatedBlacklistedVideo } from '../../../shared/models/videos/video-blacklist.model' 7import { BlacklistedVideo as FormattedBlacklistedVideo } from '../../../shared/models/videos/video-blacklist.model'
8 8
9export namespace BlacklistedVideoMethods { 9export namespace BlacklistedVideoMethods {
10 export type ToFormatedJSON = (this: BlacklistedVideoInstance) => FormatedBlacklistedVideo 10 export type ToFormattedJSON = (this: BlacklistedVideoInstance) => FormattedBlacklistedVideo
11 11
12 export type CountTotal = () => Promise<number> 12 export type CountTotal = () => Promise<number>
13 13
@@ -21,7 +21,7 @@ export namespace BlacklistedVideoMethods {
21} 21}
22 22
23export interface BlacklistedVideoClass { 23export interface BlacklistedVideoClass {
24 toFormatedJSON: BlacklistedVideoMethods.ToFormatedJSON 24 toFormattedJSON: BlacklistedVideoMethods.ToFormattedJSON
25 countTotal: BlacklistedVideoMethods.CountTotal 25 countTotal: BlacklistedVideoMethods.CountTotal
26 list: BlacklistedVideoMethods.List 26 list: BlacklistedVideoMethods.List
27 listForApi: BlacklistedVideoMethods.ListForApi 27 listForApi: BlacklistedVideoMethods.ListForApi
@@ -39,7 +39,7 @@ export interface BlacklistedVideoInstance
39 createdAt: Date 39 createdAt: Date
40 updatedAt: Date 40 updatedAt: Date
41 41
42 toFormatedJSON: BlacklistedVideoMethods.ToFormatedJSON 42 toFormattedJSON: BlacklistedVideoMethods.ToFormattedJSON
43} 43}
44 44
45export interface BlacklistedVideoModel 45export interface BlacklistedVideoModel
diff --git a/server/models/video/video-blacklist.ts b/server/models/video/video-blacklist.ts
index 4d1b45aa5..dc49852b6 100644
--- a/server/models/video/video-blacklist.ts
+++ b/server/models/video/video-blacklist.ts
@@ -9,7 +9,7 @@ import {
9} from './video-blacklist-interface' 9} from './video-blacklist-interface'
10 10
11let BlacklistedVideo: Sequelize.Model<BlacklistedVideoInstance, BlacklistedVideoAttributes> 11let BlacklistedVideo: Sequelize.Model<BlacklistedVideoInstance, BlacklistedVideoAttributes>
12let toFormatedJSON: BlacklistedVideoMethods.ToFormatedJSON 12let toFormattedJSON: BlacklistedVideoMethods.ToFormattedJSON
13let countTotal: BlacklistedVideoMethods.CountTotal 13let countTotal: BlacklistedVideoMethods.CountTotal
14let list: BlacklistedVideoMethods.List 14let list: BlacklistedVideoMethods.List
15let listForApi: BlacklistedVideoMethods.ListForApi 15let listForApi: BlacklistedVideoMethods.ListForApi
@@ -39,7 +39,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da
39 loadByVideoId 39 loadByVideoId
40 ] 40 ]
41 const instanceMethods = [ 41 const instanceMethods = [
42 toFormatedJSON 42 toFormattedJSON
43 ] 43 ]
44 addMethodsToModel(BlacklistedVideo, classMethods, instanceMethods) 44 addMethodsToModel(BlacklistedVideo, classMethods, instanceMethods)
45 45
@@ -48,7 +48,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da
48 48
49// ------------------------------ METHODS ------------------------------ 49// ------------------------------ METHODS ------------------------------
50 50
51toFormatedJSON = function (this: BlacklistedVideoInstance) { 51toFormattedJSON = function (this: BlacklistedVideoInstance) {
52 return { 52 return {
53 id: this.id, 53 id: this.id,
54 videoId: this.videoId, 54 videoId: this.videoId,
diff --git a/server/models/video/video-interface.ts b/server/models/video/video-interface.ts
index 976c70b5e..cc214fd60 100644
--- a/server/models/video/video-interface.ts
+++ b/server/models/video/video-interface.ts
@@ -6,17 +6,17 @@ import { TagAttributes, TagInstance } from './tag-interface'
6import { VideoFileAttributes, VideoFileInstance } from './video-file-interface' 6import { VideoFileAttributes, VideoFileInstance } from './video-file-interface'
7 7
8// Don't use barrel, import just what we need 8// Don't use barrel, import just what we need
9import { Video as FormatedVideo } from '../../../shared/models/videos/video.model' 9import { Video as FormattedVideo } from '../../../shared/models/videos/video.model'
10import { ResultList } from '../../../shared/models/result-list.model' 10import { ResultList } from '../../../shared/models/result-list.model'
11 11
12export type FormatedRemoteVideoFile = { 12export type FormattedRemoteVideoFile = {
13 infoHash: string 13 infoHash: string
14 resolution: number 14 resolution: number
15 extname: string 15 extname: string
16 size: number 16 size: number
17} 17}
18 18
19export type FormatedAddRemoteVideo = { 19export type FormattedAddRemoteVideo = {
20 uuid: string 20 uuid: string
21 name: string 21 name: string
22 category: number 22 category: number
@@ -33,10 +33,10 @@ export type FormatedAddRemoteVideo = {
33 views: number 33 views: number
34 likes: number 34 likes: number
35 dislikes: number 35 dislikes: number
36 files: FormatedRemoteVideoFile[] 36 files: FormattedRemoteVideoFile[]
37} 37}
38 38
39export type FormatedUpdateRemoteVideo = { 39export type FormattedUpdateRemoteVideo = {
40 uuid: string 40 uuid: string
41 name: string 41 name: string
42 category: number 42 category: number
@@ -52,14 +52,14 @@ export type FormatedUpdateRemoteVideo = {
52 views: number 52 views: number
53 likes: number 53 likes: number
54 dislikes: number 54 dislikes: number
55 files: FormatedRemoteVideoFile[] 55 files: FormattedRemoteVideoFile[]
56} 56}
57 57
58export namespace VideoMethods { 58export namespace VideoMethods {
59 export type GetThumbnailName = (this: VideoInstance) => string 59 export type GetThumbnailName = (this: VideoInstance) => string
60 export type GetPreviewName = (this: VideoInstance) => string 60 export type GetPreviewName = (this: VideoInstance) => string
61 export type IsOwned = (this: VideoInstance) => boolean 61 export type IsOwned = (this: VideoInstance) => boolean
62 export type ToFormatedJSON = (this: VideoInstance) => FormatedVideo 62 export type ToFormattedJSON = (this: VideoInstance) => FormattedVideo
63 63
64 export type GenerateMagnetUri = (this: VideoInstance, videoFile: VideoFileInstance) => string 64 export type GenerateMagnetUri = (this: VideoInstance, videoFile: VideoFileInstance) => string
65 export type GetTorrentFileName = (this: VideoInstance, videoFile: VideoFileInstance) => string 65 export type GetTorrentFileName = (this: VideoInstance, videoFile: VideoFileInstance) => string
@@ -69,8 +69,8 @@ export namespace VideoMethods {
69 export type GetVideoFilePath = (this: VideoInstance, videoFile: VideoFileInstance) => string 69 export type GetVideoFilePath = (this: VideoInstance, videoFile: VideoFileInstance) => string
70 export type CreateTorrentAndSetInfoHash = (this: VideoInstance, videoFile: VideoFileInstance) => Promise<void> 70 export type CreateTorrentAndSetInfoHash = (this: VideoInstance, videoFile: VideoFileInstance) => Promise<void>
71 71
72 export type ToAddRemoteJSON = (this: VideoInstance) => Promise<FormatedAddRemoteVideo> 72 export type ToAddRemoteJSON = (this: VideoInstance) => Promise<FormattedAddRemoteVideo>
73 export type ToUpdateRemoteJSON = (this: VideoInstance) => FormatedUpdateRemoteVideo 73 export type ToUpdateRemoteJSON = (this: VideoInstance) => FormattedUpdateRemoteVideo
74 74
75 export type TranscodeVideofile = (this: VideoInstance, inputVideoFile: VideoFileInstance) => Promise<void> 75 export type TranscodeVideofile = (this: VideoInstance, inputVideoFile: VideoFileInstance) => Promise<void>
76 76
@@ -159,7 +159,7 @@ export interface VideoInstance extends VideoClass, VideoAttributes, Sequelize.In
159 removeThumbnail: VideoMethods.RemoveThumbnail 159 removeThumbnail: VideoMethods.RemoveThumbnail
160 removeTorrent: VideoMethods.RemoveTorrent 160 removeTorrent: VideoMethods.RemoveTorrent
161 toAddRemoteJSON: VideoMethods.ToAddRemoteJSON 161 toAddRemoteJSON: VideoMethods.ToAddRemoteJSON
162 toFormatedJSON: VideoMethods.ToFormatedJSON 162 toFormattedJSON: VideoMethods.ToFormattedJSON
163 toUpdateRemoteJSON: VideoMethods.ToUpdateRemoteJSON 163 toUpdateRemoteJSON: VideoMethods.ToUpdateRemoteJSON
164 transcodeVideofile: VideoMethods.TranscodeVideofile 164 transcodeVideofile: VideoMethods.TranscodeVideofile
165 165
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 1e4bdf51c..b3ca1e668 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -52,7 +52,7 @@ let getThumbnailName: VideoMethods.GetThumbnailName
52let getPreviewName: VideoMethods.GetPreviewName 52let getPreviewName: VideoMethods.GetPreviewName
53let getTorrentFileName: VideoMethods.GetTorrentFileName 53let getTorrentFileName: VideoMethods.GetTorrentFileName
54let isOwned: VideoMethods.IsOwned 54let isOwned: VideoMethods.IsOwned
55let toFormatedJSON: VideoMethods.ToFormatedJSON 55let toFormattedJSON: VideoMethods.ToFormattedJSON
56let toAddRemoteJSON: VideoMethods.ToAddRemoteJSON 56let toAddRemoteJSON: VideoMethods.ToAddRemoteJSON
57let toUpdateRemoteJSON: VideoMethods.ToUpdateRemoteJSON 57let toUpdateRemoteJSON: VideoMethods.ToUpdateRemoteJSON
58let transcodeVideofile: VideoMethods.TranscodeVideofile 58let transcodeVideofile: VideoMethods.TranscodeVideofile
@@ -257,7 +257,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da
257 removeThumbnail, 257 removeThumbnail,
258 removeTorrent, 258 removeTorrent,
259 toAddRemoteJSON, 259 toAddRemoteJSON,
260 toFormatedJSON, 260 toFormattedJSON,
261 toUpdateRemoteJSON, 261 toUpdateRemoteJSON,
262 transcodeVideofile 262 transcodeVideofile
263 ] 263 ]
@@ -414,7 +414,7 @@ generateMagnetUri = function (this: VideoInstance, videoFile: VideoFileInstance)
414 return magnetUtil.encode(magnetHash) 414 return magnetUtil.encode(magnetHash)
415} 415}
416 416
417toFormatedJSON = function (this: VideoInstance) { 417toFormattedJSON = function (this: VideoInstance) {
418 let podHost 418 let podHost
419 419
420 if (this.Author.Pod) { 420 if (this.Author.Pod) {