aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
Diffstat (limited to 'server/models')
-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
10 files changed, 39 insertions, 39 deletions
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) {