converted of web (non-api) routes, basic conversion completed

This commit is contained in:
azivner
2018-03-30 19:31:22 -04:00
parent cfe0ae1eda
commit 795d50f02e
10 changed files with 90 additions and 122 deletions

View File

@@ -1,26 +1,25 @@
"use strict";
const express = require('express');
const router = express.Router();
const auth = require('../../services/auth');
const options = require('../../services/options');
const migration = require('../../services/migration');
const app_info = require('../../services/app_info');
const wrap = require('express-promise-wrap').wrap;
router.get('', auth.checkApiAuthForMigrationPage, wrap(async (req, res, next) => {
res.send({
async function getMigrationInfo() {
return {
db_version: parseInt(await options.getOption('db_version')),
app_db_version: app_info.db_version
});
}));
};
}
router.post('', auth.checkApiAuthForMigrationPage, wrap(async (req, res, next) => {
async function executeMigration() {
const migrations = await migration.migrate();
res.send({
return {
migrations: migrations
});
}));
};
}
module.exports = router;
module.exports = {
getMigrationInfo,
executeMigration
};