diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-01-31 11:23:52 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-01-31 11:23:52 +0100 |
commit | c45f7f84001c2731909db04dd82e1c1f290386eb (patch) | |
tree | b7e57420a1f65dfbbacc1a532bf489c9bea6125d /initializers/database.js | |
parent | cda021079ff455cc0fd0eb95a5395fa808ab63d1 (diff) | |
download | PeerTube-c45f7f84001c2731909db04dd82e1c1f290386eb.tar.gz PeerTube-c45f7f84001c2731909db04dd82e1c1f290386eb.tar.zst PeerTube-c45f7f84001c2731909db04dd82e1c1f290386eb.zip |
Infile code reorganization
Diffstat (limited to 'initializers/database.js')
-rw-r--r-- | initializers/database.js | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/initializers/database.js b/initializers/database.js index 4570d3739..e041d5c4b 100644 --- a/initializers/database.js +++ b/initializers/database.js | |||
@@ -11,17 +11,6 @@ | |||
11 | var host = config.get('database.host') | 11 | var host = config.get('database.host') |
12 | var port = config.get('database.port') | 12 | var port = config.get('database.port') |
13 | 13 | ||
14 | // ----------- Videos ----------- | ||
15 | var videosSchema = mongoose.Schema({ | ||
16 | name: String, | ||
17 | namePath: String, | ||
18 | description: String, | ||
19 | magnetUri: String, | ||
20 | podUrl: String | ||
21 | }) | ||
22 | |||
23 | var VideosDB = mongoose.model('videos', videosSchema) | ||
24 | |||
25 | // ----------- Pods ----------- | 14 | // ----------- Pods ----------- |
26 | var podsSchema = mongoose.Schema({ | 15 | var podsSchema = mongoose.Schema({ |
27 | url: String, | 16 | url: String, |
@@ -40,6 +29,25 @@ | |||
40 | 29 | ||
41 | var PoolRequestsDB = mongoose.model('poolRequests', poolRequestsSchema) | 30 | var PoolRequestsDB = mongoose.model('poolRequests', poolRequestsSchema) |
42 | 31 | ||
32 | // ----------- Videos ----------- | ||
33 | var videosSchema = mongoose.Schema({ | ||
34 | name: String, | ||
35 | namePath: String, | ||
36 | description: String, | ||
37 | magnetUri: String, | ||
38 | podUrl: String | ||
39 | }) | ||
40 | |||
41 | var VideosDB = mongoose.model('videos', videosSchema) | ||
42 | |||
43 | // --------------------------------------------------------------------------- | ||
44 | |||
45 | module.exports = { | ||
46 | PodsDB: PodsDB, | ||
47 | PoolRequestsDB: PoolRequestsDB, | ||
48 | VideosDB: VideosDB | ||
49 | } | ||
50 | |||
43 | // ----------- Connection ----------- | 51 | // ----------- Connection ----------- |
44 | 52 | ||
45 | mongoose.connect('mongodb://' + host + ':' + port + '/' + dbname) | 53 | mongoose.connect('mongodb://' + host + ':' + port + '/' + dbname) |
@@ -51,11 +59,4 @@ | |||
51 | mongoose.connection.on('open', function () { | 59 | mongoose.connection.on('open', function () { |
52 | logger.info('Connected to mongodb.') | 60 | logger.info('Connected to mongodb.') |
53 | }) | 61 | }) |
54 | |||
55 | // ----------- Export ----------- | ||
56 | module.exports = { | ||
57 | VideosDB: VideosDB, | ||
58 | PodsDB: PodsDB, | ||
59 | PoolRequestsDB: PoolRequestsDB | ||
60 | } | ||
61 | })() | 62 | })() |