2017-10-21 21:10:33 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								"use strict";
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-15 17:31:49 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								const express = require('express');
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								const router = express.Router();
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-15 19:47:05 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								const auth = require('../../services/auth');
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-02 20:48:02 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								const options = require('../../services/options');
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-22 20:22:09 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								const migration = require('../../services/migration');
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-03 22:29:23 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								const app_info = require('../../services/app_info');
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-15 17:31:49 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-30 20:51:35 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								router.get('', auth.checkApiAuthForMigrationPage, async (req, res, next) => {
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-15 17:31:49 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    res.send({
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-09 23:25:23 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        db_version: parseInt(await options.getOption('db_version')),
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-03 22:29:23 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        app_db_version: app_info.db_version
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-15 17:31:49 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    });
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								});
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-30 20:51:35 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								router.post('', auth.checkApiAuthForMigrationPage, async (req, res, next) => {
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-22 20:22:09 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    const migrations = await migration.migrate();
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-15 17:31:49 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    res.send({
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-09 23:25:23 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        migrations: migrations
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-15 17:31:49 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    });
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								});
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								module.exports = router;
							 |