| 
									
										
										
										
											2017-10-21 21:10:33 -04:00
										 |  |  | "use strict"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-14 23:31:44 -04:00
										 |  |  | const express = require('express'); | 
					
						
							|  |  |  | const router = express.Router(); | 
					
						
							| 
									
										
										
										
											2017-10-15 19:47:05 -04:00
										 |  |  | const auth = require('../services/auth'); | 
					
						
							| 
									
										
										
										
											2017-12-16 20:48:34 -05:00
										 |  |  | const source_id = require('../services/source_id'); | 
					
						
							| 
									
										
										
										
											2017-12-19 23:22:21 -05:00
										 |  |  | const sql = require('../services/sql'); | 
					
						
							| 
									
										
										
										
											2018-01-07 09:35:44 -05:00
										 |  |  | const wrap = require('express-promise-wrap').wrap; | 
					
						
							| 
									
										
										
										
											2017-10-14 23:31:44 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-07 09:35:44 -05:00
										 |  |  | router.get('', auth.checkAuth, wrap(async (req, res, next) => { | 
					
						
							| 
									
										
										
										
											2017-12-16 20:48:34 -05:00
										 |  |  |     res.render('index', { | 
					
						
							| 
									
										
										
										
											2017-12-19 23:22:21 -05:00
										 |  |  |         sourceId: await source_id.generateSourceId(), | 
					
						
							| 
									
										
										
										
											2017-12-23 11:02:38 -05:00
										 |  |  |         maxSyncIdAtLoad: await sql.getFirstValue("SELECT MAX(id) FROM sync") | 
					
						
							| 
									
										
										
										
											2017-12-16 20:48:34 -05:00
										 |  |  |     }); | 
					
						
							| 
									
										
										
										
											2018-01-07 09:35:44 -05:00
										 |  |  | })); | 
					
						
							| 
									
										
										
										
											2017-10-14 23:31:44 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | module.exports = router; |