aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-06-16 09:45:46 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-06-16 09:45:46 +0200
commit74889a71fe687dda74f2a687653122327807af36 (patch)
treee938e8b6401b74fbec80513a877d9967f2c0dbcd
parent15a302943d84bc0978b84fe33110c4daa451d311 (diff)
downloadPeerTube-74889a71fe687dda74f2a687653122327807af36.tar.gz
PeerTube-74889a71fe687dda74f2a687653122327807af36.tar.zst
PeerTube-74889a71fe687dda74f2a687653122327807af36.zip
Reorganize model files
-rw-r--r--server/initializers/database.ts68
-rw-r--r--server/models/application/application-interface.ts (renamed from server/models/application-interface.ts)0
-rw-r--r--server/models/application/application.ts (renamed from server/models/application.ts)2
-rw-r--r--server/models/application/index.ts1
-rw-r--r--server/models/index.ts24
-rw-r--r--server/models/job/index.ts1
-rw-r--r--server/models/job/job-interface.ts (renamed from server/models/job-interface.ts)0
-rw-r--r--server/models/job/job.ts (renamed from server/models/job.ts)4
-rw-r--r--server/models/oauth/index.ts2
-rw-r--r--server/models/oauth/oauth-client-interface.ts (renamed from server/models/oauth-client-interface.ts)0
-rw-r--r--server/models/oauth/oauth-client.ts (renamed from server/models/oauth-client.ts)2
-rw-r--r--server/models/oauth/oauth-token-interface.ts (renamed from server/models/oauth-token-interface.ts)2
-rw-r--r--server/models/oauth/oauth-token.ts (renamed from server/models/oauth-token.ts)4
-rw-r--r--server/models/pod/index.ts1
-rw-r--r--server/models/pod/pod-interface.ts (renamed from server/models/pod-interface.ts)2
-rw-r--r--server/models/pod/pod.ts (renamed from server/models/pod.ts)6
-rw-r--r--server/models/request/index.ts4
-rw-r--r--server/models/request/request-interface.ts (renamed from server/models/request-interface.ts)2
-rw-r--r--server/models/request/request-to-pod-interface.ts (renamed from server/models/request-to-pod-interface.ts)0
-rw-r--r--server/models/request/request-to-pod.ts (renamed from server/models/request-to-pod.ts)2
-rw-r--r--server/models/request/request-video-event-interface.ts (renamed from server/models/request-video-event-interface.ts)4
-rw-r--r--server/models/request/request-video-event.ts (renamed from server/models/request-video-event.ts)8
-rw-r--r--server/models/request/request-video-qadu-interface.ts (renamed from server/models/request-video-qadu-interface.ts)4
-rw-r--r--server/models/request/request-video-qadu.ts (renamed from server/models/request-video-qadu.ts)6
-rw-r--r--server/models/request/request.ts (renamed from server/models/request.ts)6
-rw-r--r--server/models/user/index.ts2
-rw-r--r--server/models/user/user-interface.ts (renamed from server/models/user-interface.ts)2
-rw-r--r--server/models/user/user-video-rate-interface.ts (renamed from server/models/user-video-rate-interface.ts)0
-rw-r--r--server/models/user/user-video-rate.ts (renamed from server/models/user-video-rate.ts)4
-rw-r--r--server/models/user/user.ts (renamed from server/models/user.ts)8
-rw-r--r--server/models/video/author-interface.ts (renamed from server/models/author-interface.ts)2
-rw-r--r--server/models/video/author.ts (renamed from server/models/author.ts)4
-rw-r--r--server/models/video/index.ts6
-rw-r--r--server/models/video/tag-interface.ts (renamed from server/models/tag-interface.ts)0
-rw-r--r--server/models/video/tag.ts (renamed from server/models/tag.ts)2
-rw-r--r--server/models/video/video-abuse-interface.ts (renamed from server/models/video-abuse-interface.ts)2
-rw-r--r--server/models/video/video-abuse.ts (renamed from server/models/video-abuse.ts)6
-rw-r--r--server/models/video/video-blacklist-interface.ts (renamed from server/models/video-blacklist-interface.ts)2
-rw-r--r--server/models/video/video-blacklist.ts (renamed from server/models/video-blacklist.ts)2
-rw-r--r--server/models/video/video-interface.ts (renamed from server/models/video-interface.ts)2
-rw-r--r--server/models/video/video-tag-interface.ts (renamed from server/models/video-tag-interface.ts)0
-rw-r--r--server/models/video/video-tag.ts (renamed from server/models/video-tag.ts)2
-rw-r--r--server/models/video/video.ts (renamed from server/models/video.ts)10
43 files changed, 128 insertions, 83 deletions
diff --git a/server/initializers/database.ts b/server/initializers/database.ts
index 0ab9e98db..1662c1968 100644
--- a/server/initializers/database.ts
+++ b/server/initializers/database.ts
@@ -1,6 +1,7 @@
1import * as fs from 'fs' 1import * as fs from 'fs'
2import { join } from 'path' 2import { join } from 'path'
3import * as Sequelize from 'sequelize' 3import * as Sequelize from 'sequelize'
4import { each } from 'async'
4 5
5import { CONFIG } from './constants' 6import { CONFIG } from './constants'
6// Do not use barrel, we need to load database first 7// Do not use barrel, we need to load database first
@@ -72,24 +73,13 @@ const sequelize = new Sequelize(dbname, username, password, {
72database.sequelize = sequelize 73database.sequelize = sequelize
73 74
74database.init = function (silent: boolean, callback: (err: Error) => void) { 75database.init = function (silent: boolean, callback: (err: Error) => void) {
75
76 const modelDirectory = join(__dirname, '..', 'models') 76 const modelDirectory = join(__dirname, '..', 'models')
77 fs.readdir(modelDirectory, function (err, files) {
78 if (err) throw err
79 77
80 files.filter(function (file) { 78 getModelFiles(modelDirectory, function (err, filePaths) {
81 // For all models but not utils.js 79 if (err) throw err
82 if (
83 file === 'index.js' || file === 'index.ts' ||
84 file === 'utils.js' || file === 'utils.ts' ||
85 file.endsWith('-interface.js') || file.endsWith('-interface.ts') ||
86 file.endsWith('.js.map')
87 ) return false
88 80
89 return true 81 filePaths.forEach(function (filePath) {
90 }) 82 const model = sequelize.import(filePath)
91 .forEach(function (file) {
92 const model = sequelize.import(join(modelDirectory, file))
93 83
94 database[model['name']] = model 84 database[model['name']] = model
95 }) 85 })
@@ -111,3 +101,51 @@ database.init = function (silent: boolean, callback: (err: Error) => void) {
111export { 101export {
112 database 102 database
113} 103}
104
105// ---------------------------------------------------------------------------
106
107function getModelFiles (modelDirectory: string, callback: (err: Error, filePaths: string[]) => void) {
108 fs.readdir(modelDirectory, function (err, files) {
109 if (err) throw err
110
111 const directories = files.filter(function (directory) {
112 // For all models but not utils.js
113 if (
114 directory === 'index.js' || directory === 'index.ts' ||
115 directory === 'utils.js' || directory === 'utils.ts'
116 ) return false
117
118 return true
119 })
120
121 let modelFilePaths: string[] = []
122
123 // For each directory we read it and append model in the modelFilePaths array
124 each(directories, function (directory: string, eachCallback: ErrorCallback<Error>) {
125 const modelDirectoryPath = join(modelDirectory, directory)
126
127 fs.readdir(modelDirectoryPath, function (err, files) {
128 if (err) return eachCallback(err)
129
130 const filteredFiles = files.filter(file => {
131 if (
132 file === 'index.js' || file === 'index.ts' ||
133 file === 'utils.js' || file === 'utils.ts' ||
134 file.endsWith('-interface.js') || file.endsWith('-interface.ts') ||
135 file.endsWith('.js.map')
136 ) return false
137
138 return true
139 }).map(file => {
140 return join(modelDirectoryPath, file)
141 })
142
143 modelFilePaths = modelFilePaths.concat(filteredFiles)
144
145 return eachCallback(null)
146 })
147 }, function(err: Error) {
148 return callback(err, modelFilePaths)
149 })
150 })
151}
diff --git a/server/models/application-interface.ts b/server/models/application/application-interface.ts
index c03513db1..c03513db1 100644
--- a/server/models/application-interface.ts
+++ b/server/models/application/application-interface.ts
diff --git a/server/models/application.ts b/server/models/application/application.ts
index 55bb40d84..0e9a1ebb3 100644
--- a/server/models/application.ts
+++ b/server/models/application/application.ts
@@ -1,6 +1,6 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3import { addMethodsToModel } from './utils' 3import { addMethodsToModel } from '../utils'
4import { 4import {
5 ApplicationClass, 5 ApplicationClass,
6 ApplicationAttributes, 6 ApplicationAttributes,
diff --git a/server/models/application/index.ts b/server/models/application/index.ts
new file mode 100644
index 000000000..706f85cb9
--- /dev/null
+++ b/server/models/application/index.ts
@@ -0,0 +1 @@
export * from './application-interface'
diff --git a/server/models/index.ts b/server/models/index.ts
index 432c0dc4a..b392a8a77 100644
--- a/server/models/index.ts
+++ b/server/models/index.ts
@@ -1,17 +1,7 @@
1export * from './application-interface' 1export * from './application'
2export * from './author-interface' 2export * from './job'
3export * from './job-interface' 3export * from './oauth'
4export * from './oauth-client-interface' 4export * from './pod'
5export * from './oauth-token-interface' 5export * from './request'
6export * from './pod-interface' 6export * from './user'
7export * from './request-interface' 7export * from './video'
8export * from './request-to-pod-interface'
9export * from './request-video-event-interface'
10export * from './request-video-qadu-interface'
11export * from './tag-interface'
12export * from './user-video-rate-interface'
13export * from './user-interface'
14export * from './video-abuse-interface'
15export * from './video-blacklist-interface'
16export * from './video-tag-interface'
17export * from './video-interface'
diff --git a/server/models/job/index.ts b/server/models/job/index.ts
new file mode 100644
index 000000000..56925fd32
--- /dev/null
+++ b/server/models/job/index.ts
@@ -0,0 +1 @@
export * from './job-interface'
diff --git a/server/models/job-interface.ts b/server/models/job/job-interface.ts
index ab6678257..ab6678257 100644
--- a/server/models/job-interface.ts
+++ b/server/models/job/job-interface.ts
diff --git a/server/models/job.ts b/server/models/job/job.ts
index d4380a575..60a6c551b 100644
--- a/server/models/job.ts
+++ b/server/models/job/job.ts
@@ -1,9 +1,9 @@
1import { values } from 'lodash' 1import { values } from 'lodash'
2import * as Sequelize from 'sequelize' 2import * as Sequelize from 'sequelize'
3 3
4import { JOB_STATES } from '../initializers' 4import { JOB_STATES } from '../../initializers'
5 5
6import { addMethodsToModel } from './utils' 6import { addMethodsToModel } from '../utils'
7import { 7import {
8 JobClass, 8 JobClass,
9 JobInstance, 9 JobInstance,
diff --git a/server/models/oauth/index.ts b/server/models/oauth/index.ts
new file mode 100644
index 000000000..a20d3a56a
--- /dev/null
+++ b/server/models/oauth/index.ts
@@ -0,0 +1,2 @@
1export * from './oauth-client-interface'
2export * from './oauth-token-interface'
diff --git a/server/models/oauth-client-interface.ts b/server/models/oauth/oauth-client-interface.ts
index 3b4325740..3b4325740 100644
--- a/server/models/oauth-client-interface.ts
+++ b/server/models/oauth/oauth-client-interface.ts
diff --git a/server/models/oauth-client.ts b/server/models/oauth/oauth-client.ts
index a5438f45a..fbc2a3393 100644
--- a/server/models/oauth-client.ts
+++ b/server/models/oauth/oauth-client.ts
@@ -1,6 +1,6 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3import { addMethodsToModel } from './utils' 3import { addMethodsToModel } from '../utils'
4import { 4import {
5 OAuthClientClass, 5 OAuthClientClass,
6 OAuthClientInstance, 6 OAuthClientInstance,
diff --git a/server/models/oauth-token-interface.ts b/server/models/oauth/oauth-token-interface.ts
index 88526697e..815ad5eef 100644
--- a/server/models/oauth-token-interface.ts
+++ b/server/models/oauth/oauth-token-interface.ts
@@ -1,7 +1,7 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import * as Bluebird from 'bluebird' 2import * as Bluebird from 'bluebird'
3 3
4import { UserModel } from './user-interface' 4import { UserModel } from '../user'
5 5
6export type OAuthTokenInfo = { 6export type OAuthTokenInfo = {
7 refreshToken: string 7 refreshToken: string
diff --git a/server/models/oauth-token.ts b/server/models/oauth/oauth-token.ts
index 91cef11dd..eab9cf858 100644
--- a/server/models/oauth-token.ts
+++ b/server/models/oauth/oauth-token.ts
@@ -1,8 +1,8 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3import { logger } from '../helpers' 3import { logger } from '../../helpers'
4 4
5import { addMethodsToModel } from './utils' 5import { addMethodsToModel } from '../utils'
6import { 6import {
7 OAuthTokenClass, 7 OAuthTokenClass,
8 OAuthTokenInstance, 8 OAuthTokenInstance,
diff --git a/server/models/pod/index.ts b/server/models/pod/index.ts
new file mode 100644
index 000000000..d2bf50d4d
--- /dev/null
+++ b/server/models/pod/index.ts
@@ -0,0 +1 @@
export * from './pod-interface'
diff --git a/server/models/pod-interface.ts b/server/models/pod/pod-interface.ts
index 8f362bd5c..01ccda64c 100644
--- a/server/models/pod-interface.ts
+++ b/server/models/pod/pod-interface.ts
@@ -1,7 +1,7 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3// Don't use barrel, import just what we need 3// Don't use barrel, import just what we need
4import { Pod as FormatedPod } from '../../shared/models/pod.model' 4import { Pod as FormatedPod } from '../../../shared/models/pod.model'
5 5
6export namespace PodMethods { 6export namespace PodMethods {
7 export type ToFormatedJSON = () => FormatedPod 7 export type ToFormatedJSON = () => FormatedPod
diff --git a/server/models/pod.ts b/server/models/pod/pod.ts
index fef9d4da6..4c6e63024 100644
--- a/server/models/pod.ts
+++ b/server/models/pod/pod.ts
@@ -2,10 +2,10 @@ import { each, waterfall } from 'async'
2import { map } from 'lodash' 2import { map } from 'lodash'
3import * as Sequelize from 'sequelize' 3import * as Sequelize from 'sequelize'
4 4
5import { FRIEND_SCORE, PODS_SCORE } from '../initializers' 5import { FRIEND_SCORE, PODS_SCORE } from '../../initializers'
6import { logger, isHostValid } from '../helpers' 6import { logger, isHostValid } from '../../helpers'
7 7
8import { addMethodsToModel } from './utils' 8import { addMethodsToModel } from '../utils'
9import { 9import {
10 PodClass, 10 PodClass,
11 PodInstance, 11 PodInstance,
diff --git a/server/models/request/index.ts b/server/models/request/index.ts
new file mode 100644
index 000000000..824c140f5
--- /dev/null
+++ b/server/models/request/index.ts
@@ -0,0 +1,4 @@
1export * from './request-interface'
2export * from './request-to-pod-interface'
3export * from './request-video-event-interface'
4export * from './request-video-qadu-interface'
diff --git a/server/models/request-interface.ts b/server/models/request/request-interface.ts
index 4bbd79966..70fd734e1 100644
--- a/server/models/request-interface.ts
+++ b/server/models/request/request-interface.ts
@@ -1,6 +1,6 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3import { PodInstance, PodAttributes } from './pod-interface' 3import { PodInstance, PodAttributes } from '../pod'
4 4
5export type RequestsGrouped = { 5export type RequestsGrouped = {
6 [ podId: number ]: { 6 [ podId: number ]: {
diff --git a/server/models/request-to-pod-interface.ts b/server/models/request/request-to-pod-interface.ts
index 6d75ca6e5..6d75ca6e5 100644
--- a/server/models/request-to-pod-interface.ts
+++ b/server/models/request/request-to-pod-interface.ts
diff --git a/server/models/request-to-pod.ts b/server/models/request/request-to-pod.ts
index d2f31463c..67331be1d 100644
--- a/server/models/request-to-pod.ts
+++ b/server/models/request/request-to-pod.ts
@@ -1,6 +1,6 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3import { addMethodsToModel } from './utils' 3import { addMethodsToModel } from '../utils'
4import { 4import {
5 RequestToPodClass, 5 RequestToPodClass,
6 RequestToPodInstance, 6 RequestToPodInstance,
diff --git a/server/models/request-video-event-interface.ts b/server/models/request/request-video-event-interface.ts
index ad576a2b1..219d8edc0 100644
--- a/server/models/request-video-event-interface.ts
+++ b/server/models/request/request-video-event-interface.ts
@@ -1,7 +1,7 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3import { VideoInstance } from './video-interface' 3import { VideoInstance } from '../video'
4import { PodInstance } from './pod-interface' 4import { PodInstance } from '../pod'
5 5
6export type RequestsVideoEventGrouped = { 6export type RequestsVideoEventGrouped = {
7 [ podId: number ]: { 7 [ podId: number ]: {
diff --git a/server/models/request-video-event.ts b/server/models/request/request-video-event.ts
index 32438b581..f552ef50b 100644
--- a/server/models/request-video-event.ts
+++ b/server/models/request/request-video-event.ts
@@ -5,10 +5,10 @@
5import { values } from 'lodash' 5import { values } from 'lodash'
6import * as Sequelize from 'sequelize' 6import * as Sequelize from 'sequelize'
7 7
8import { database as db } from '../initializers/database' 8import { database as db } from '../../initializers/database'
9import { REQUEST_VIDEO_EVENT_TYPES } from '../initializers' 9import { REQUEST_VIDEO_EVENT_TYPES } from '../../initializers'
10import { isVideoEventCountValid } from '../helpers' 10import { isVideoEventCountValid } from '../../helpers'
11import { addMethodsToModel } from './utils' 11import { addMethodsToModel } from '../utils'
12import { 12import {
13 RequestVideoEventClass, 13 RequestVideoEventClass,
14 RequestVideoEventInstance, 14 RequestVideoEventInstance,
diff --git a/server/models/request-video-qadu-interface.ts b/server/models/request/request-video-qadu-interface.ts
index 04de7f159..625b063dc 100644
--- a/server/models/request-video-qadu-interface.ts
+++ b/server/models/request/request-video-qadu-interface.ts
@@ -1,7 +1,7 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3import { VideoInstance } from './video-interface' 3import { VideoInstance } from '../video'
4import { PodInstance } from './pod-interface' 4import { PodInstance } from '../pod'
5 5
6export type RequestsVideoQaduGrouped = { 6export type RequestsVideoQaduGrouped = {
7 [ podId: number ]: { 7 [ podId: number ]: {
diff --git a/server/models/request-video-qadu.ts b/server/models/request/request-video-qadu.ts
index 27ce0ff29..da62239f5 100644
--- a/server/models/request-video-qadu.ts
+++ b/server/models/request/request-video-qadu.ts
@@ -12,9 +12,9 @@
12import { values } from 'lodash' 12import { values } from 'lodash'
13import * as Sequelize from 'sequelize' 13import * as Sequelize from 'sequelize'
14 14
15import { database as db } from '../initializers/database' 15import { database as db } from '../../initializers/database'
16import { REQUEST_VIDEO_QADU_TYPES } from '../initializers' 16import { REQUEST_VIDEO_QADU_TYPES } from '../../initializers'
17import { addMethodsToModel } from './utils' 17import { addMethodsToModel } from '../utils'
18import { 18import {
19 RequestVideoQaduClass, 19 RequestVideoQaduClass,
20 RequestVideoQaduInstance, 20 RequestVideoQaduInstance,
diff --git a/server/models/request.ts b/server/models/request/request.ts
index e6c367f28..66e7da845 100644
--- a/server/models/request.ts
+++ b/server/models/request/request.ts
@@ -1,9 +1,9 @@
1import { values } from 'lodash' 1import { values } from 'lodash'
2import * as Sequelize from 'sequelize' 2import * as Sequelize from 'sequelize'
3 3
4import { database as db } from '../initializers/database' 4import { database as db } from '../../initializers/database'
5import { REQUEST_ENDPOINTS } from '../initializers' 5import { REQUEST_ENDPOINTS } from '../../initializers'
6import { addMethodsToModel } from './utils' 6import { addMethodsToModel } from '../utils'
7import { 7import {
8 RequestClass, 8 RequestClass,
9 RequestInstance, 9 RequestInstance,
diff --git a/server/models/user/index.ts b/server/models/user/index.ts
new file mode 100644
index 000000000..ed3689518
--- /dev/null
+++ b/server/models/user/index.ts
@@ -0,0 +1,2 @@
1export * from './user-video-rate-interface'
2export * from './user-interface'
diff --git a/server/models/user-interface.ts b/server/models/user/user-interface.ts
index 98963b743..1ba4bd800 100644
--- a/server/models/user-interface.ts
+++ b/server/models/user/user-interface.ts
@@ -2,7 +2,7 @@ import * as Sequelize from 'sequelize'
2import * as Bluebird from 'bluebird' 2import * as Bluebird 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/user.model' 5import { User as FormatedUser } from '../../../shared/models/user.model'
6 6
7export namespace UserMethods { 7export namespace UserMethods {
8 export type IsPasswordMatchCallback = (err: Error, same: boolean) => void 8 export type IsPasswordMatchCallback = (err: Error, same: boolean) => void
diff --git a/server/models/user-video-rate-interface.ts b/server/models/user/user-video-rate-interface.ts
index e48869fd2..e48869fd2 100644
--- a/server/models/user-video-rate-interface.ts
+++ b/server/models/user/user-video-rate-interface.ts
diff --git a/server/models/user-video-rate.ts b/server/models/user/user-video-rate.ts
index 0326e1796..68be62fc2 100644
--- a/server/models/user-video-rate.ts
+++ b/server/models/user/user-video-rate.ts
@@ -5,9 +5,9 @@
5import { values } from 'lodash' 5import { values } from 'lodash'
6import * as Sequelize from 'sequelize' 6import * as Sequelize from 'sequelize'
7 7
8import { VIDEO_RATE_TYPES } from '../initializers' 8import { VIDEO_RATE_TYPES } from '../../initializers'
9 9
10import { addMethodsToModel } from './utils' 10import { addMethodsToModel } from '../utils'
11import { 11import {
12 UserVideoRateClass, 12 UserVideoRateClass,
13 UserVideoRateInstance, 13 UserVideoRateInstance,
diff --git a/server/models/user.ts b/server/models/user/user.ts
index 1a56a6dc3..d78f5f845 100644
--- a/server/models/user.ts
+++ b/server/models/user/user.ts
@@ -1,17 +1,17 @@
1import { values } from 'lodash' 1import { values } from 'lodash'
2import * as Sequelize from 'sequelize' 2import * as Sequelize from 'sequelize'
3 3
4import { getSort } from './utils' 4import { getSort } from '../utils'
5import { USER_ROLES } from '../initializers' 5import { USER_ROLES } from '../../initializers'
6import { 6import {
7 cryptPassword, 7 cryptPassword,
8 comparePassword, 8 comparePassword,
9 isUserPasswordValid, 9 isUserPasswordValid,
10 isUserUsernameValid, 10 isUserUsernameValid,
11 isUserDisplayNSFWValid 11 isUserDisplayNSFWValid
12} from '../helpers' 12} from '../../helpers'
13 13
14import { addMethodsToModel } from './utils' 14import { addMethodsToModel } from '../utils'
15import { 15import {
16 UserClass, 16 UserClass,
17 UserInstance, 17 UserInstance,
diff --git a/server/models/author-interface.ts b/server/models/video/author-interface.ts
index b57ce2a6b..c1b30848c 100644
--- a/server/models/author-interface.ts
+++ b/server/models/video/author-interface.ts
@@ -1,6 +1,6 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3import { PodInstance } from './pod-interface' 3import { PodInstance } from '../pod'
4 4
5export namespace AuthorMethods { 5export namespace AuthorMethods {
6 export type FindOrCreateAuthorCallback = (err: Error, authorInstance?: AuthorInstance) => void 6 export type FindOrCreateAuthorCallback = (err: Error, authorInstance?: AuthorInstance) => void
diff --git a/server/models/author.ts b/server/models/video/author.ts
index e0fb250f9..4a115e328 100644
--- a/server/models/author.ts
+++ b/server/models/video/author.ts
@@ -1,8 +1,8 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3import { isUserUsernameValid } from '../helpers' 3import { isUserUsernameValid } from '../../helpers'
4 4
5import { addMethodsToModel } from './utils' 5import { addMethodsToModel } from '../utils'
6import { 6import {
7 AuthorClass, 7 AuthorClass,
8 AuthorInstance, 8 AuthorInstance,
diff --git a/server/models/video/index.ts b/server/models/video/index.ts
new file mode 100644
index 000000000..84b801c72
--- /dev/null
+++ b/server/models/video/index.ts
@@ -0,0 +1,6 @@
1export * from './author-interface'
2export * from './tag-interface'
3export * from './video-abuse-interface'
4export * from './video-blacklist-interface'
5export * from './video-tag-interface'
6export * from './video-interface'
diff --git a/server/models/tag-interface.ts b/server/models/video/tag-interface.ts
index e045e7ca5..e045e7ca5 100644
--- a/server/models/tag-interface.ts
+++ b/server/models/video/tag-interface.ts
diff --git a/server/models/tag.ts b/server/models/video/tag.ts
index 54a5f79e5..3c657d751 100644
--- a/server/models/tag.ts
+++ b/server/models/video/tag.ts
@@ -1,7 +1,7 @@
1import { each } from 'async' 1import { each } from 'async'
2import * as Sequelize from 'sequelize' 2import * as Sequelize from 'sequelize'
3 3
4import { addMethodsToModel } from './utils' 4import { addMethodsToModel } from '../utils'
5import { 5import {
6 TagClass, 6 TagClass,
7 TagInstance, 7 TagInstance,
diff --git a/server/models/video-abuse-interface.ts b/server/models/video/video-abuse-interface.ts
index d9cb93b42..4b7f2a2ec 100644
--- a/server/models/video-abuse-interface.ts
+++ b/server/models/video/video-abuse-interface.ts
@@ -1,7 +1,7 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3// Don't use barrel, import just what we need 3// Don't use barrel, import just what we need
4import { VideoAbuse as FormatedVideoAbuse } from '../../shared/models/video-abuse.model' 4import { VideoAbuse as FormatedVideoAbuse } from '../../../shared/models/video-abuse.model'
5 5
6export namespace VideoAbuseMethods { 6export namespace VideoAbuseMethods {
7 export type toFormatedJSON = () => FormatedVideoAbuse 7 export type toFormatedJSON = () => FormatedVideoAbuse
diff --git a/server/models/video-abuse.ts b/server/models/video/video-abuse.ts
index 5602ef968..e0e0bcfe6 100644
--- a/server/models/video-abuse.ts
+++ b/server/models/video/video-abuse.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3import { CONFIG } from '../initializers' 3import { CONFIG } from '../../initializers'
4import { isVideoAbuseReporterUsernameValid, isVideoAbuseReasonValid } from '../helpers' 4import { isVideoAbuseReporterUsernameValid, isVideoAbuseReasonValid } from '../../helpers'
5 5
6import { addMethodsToModel, getSort } from './utils' 6import { addMethodsToModel, getSort } from '../utils'
7import { 7import {
8 VideoAbuseClass, 8 VideoAbuseClass,
9 VideoAbuseInstance, 9 VideoAbuseInstance,
diff --git a/server/models/video-blacklist-interface.ts b/server/models/video/video-blacklist-interface.ts
index 974718192..37f579422 100644
--- a/server/models/video-blacklist-interface.ts
+++ b/server/models/video/video-blacklist-interface.ts
@@ -1,7 +1,7 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3// Don't use barrel, import just what we need 3// Don't use barrel, import just what we need
4import { BlacklistedVideo as FormatedBlacklistedVideo } from '../../shared/models/video-blacklist.model' 4import { BlacklistedVideo as FormatedBlacklistedVideo } from '../../../shared/models/video-blacklist.model'
5 5
6export namespace BlacklistedVideoMethods { 6export namespace BlacklistedVideoMethods {
7 export type ToFormatedJSON = () => FormatedBlacklistedVideo 7 export type ToFormatedJSON = () => FormatedBlacklistedVideo
diff --git a/server/models/video-blacklist.ts b/server/models/video/video-blacklist.ts
index 040ed03d7..f4479986c 100644
--- a/server/models/video-blacklist.ts
+++ b/server/models/video/video-blacklist.ts
@@ -1,6 +1,6 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3import { addMethodsToModel, getSort } from './utils' 3import { addMethodsToModel, getSort } from '../utils'
4import { 4import {
5 BlacklistedVideoClass, 5 BlacklistedVideoClass,
6 BlacklistedVideoInstance, 6 BlacklistedVideoInstance,
diff --git a/server/models/video-interface.ts b/server/models/video/video-interface.ts
index 7120f91cd..71b9b0a69 100644
--- a/server/models/video-interface.ts
+++ b/server/models/video/video-interface.ts
@@ -4,7 +4,7 @@ import { AuthorInstance } from './author-interface'
4import { VideoTagInstance } from './video-tag-interface' 4import { VideoTagInstance } from './video-tag-interface'
5 5
6// Don't use barrel, import just what we need 6// Don't use barrel, import just what we need
7import { Video as FormatedVideo } from '../../shared/models/video.model' 7import { Video as FormatedVideo } from '../../../shared/models/video.model'
8 8
9export type FormatedAddRemoteVideo = { 9export type FormatedAddRemoteVideo = {
10 name: string 10 name: string
diff --git a/server/models/video-tag-interface.ts b/server/models/video/video-tag-interface.ts
index f928cecff..f928cecff 100644
--- a/server/models/video-tag-interface.ts
+++ b/server/models/video/video-tag-interface.ts
diff --git a/server/models/video-tag.ts b/server/models/video/video-tag.ts
index 514eede25..71ca85332 100644
--- a/server/models/video-tag.ts
+++ b/server/models/video/video-tag.ts
@@ -1,6 +1,6 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3import { addMethodsToModel } from './utils' 3import { addMethodsToModel } from '../utils'
4import { 4import {
5 VideoTagClass, 5 VideoTagClass,
6 VideoTagInstance, 6 VideoTagInstance,
diff --git a/server/models/video.ts b/server/models/video/video.ts
index 78119f516..866b380cc 100644
--- a/server/models/video.ts
+++ b/server/models/video/video.ts
@@ -10,7 +10,7 @@ import * as parseTorrent from 'parse-torrent'
10import { join } from 'path' 10import { join } from 'path'
11import * as Sequelize from 'sequelize' 11import * as Sequelize from 'sequelize'
12 12
13import { database as db } from '../initializers/database' 13import { database as db } from '../../initializers/database'
14import { VideoTagInstance } from './video-tag-interface' 14import { VideoTagInstance } from './video-tag-interface'
15import { 15import {
16 logger, 16 logger,
@@ -22,7 +22,7 @@ import {
22 isVideoDescriptionValid, 22 isVideoDescriptionValid,
23 isVideoInfoHashValid, 23 isVideoInfoHashValid,
24 isVideoDurationValid 24 isVideoDurationValid
25} from '../helpers' 25} from '../../helpers'
26import { 26import {
27 CONSTRAINTS_FIELDS, 27 CONSTRAINTS_FIELDS,
28 CONFIG, 28 CONFIG,
@@ -32,10 +32,10 @@ import {
32 VIDEO_LICENCES, 32 VIDEO_LICENCES,
33 VIDEO_LANGUAGES, 33 VIDEO_LANGUAGES,
34 THUMBNAILS_SIZE 34 THUMBNAILS_SIZE
35} from '../initializers' 35} from '../../initializers'
36import { JobScheduler, removeVideoToFriends } from '../lib' 36import { JobScheduler, removeVideoToFriends } from '../../lib'
37 37
38import { addMethodsToModel, getSort } from './utils' 38import { addMethodsToModel, getSort } from '../utils'
39import { 39import {
40 VideoClass, 40 VideoClass,
41 VideoInstance, 41 VideoInstance,