lint
parent
7ff8d5f190
commit
f68f76c237
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import authentication from './authentication';
|
import authentication from './authentication';
|
||||||
import { Accounts } from '../../models';
|
import { Accounts } from '../../models';
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,7 @@ export async function SetResearchStatus(userId, status) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function GetResearchStatus(userId) {
|
export async function GetResearchStatus(userId) {
|
||||||
return Accounts.findOne({where: {id: userId}, attributes: ['research_enabled']})
|
return Accounts.findOne({ where: { id: userId }, attributes: ['research_enabled'] });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export default null;
|
export default null;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
import log4js from 'log4js';
|
|
||||||
|
|
||||||
import admin from './admin';
|
import admin from './admin';
|
||||||
import auth from './auth';
|
import auth from './auth';
|
||||||
|
|
|
@ -1,34 +1,25 @@
|
||||||
import bodyParser from 'body-parser';
|
|
||||||
import crypto from 'crypto';
|
|
||||||
import dirTree from 'directory-tree';
|
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
import log4js from 'log4js';
|
|
||||||
|
|
||||||
import { requireAuthenticated } from '../../../middlewares/authentication';
|
import { requireAuthenticated } from '../../../middlewares/authentication';
|
||||||
import { SetResearchStatus, GetResearchStatus } from '../../../controllers/user/settings';
|
import { SetResearchStatus, GetResearchStatus } from '../../../controllers/user/settings';
|
||||||
|
|
||||||
const logger = log4js.getLogger();
|
|
||||||
|
|
||||||
// /api/devices
|
// /api/devices
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
router.patch('/research/:enabled', requireAuthenticated, async (req, res) => {
|
router.patch('/research/:enabled', requireAuthenticated, async (req, res) => {
|
||||||
const { enabled } = req.params;
|
const { enabled } = req.params;
|
||||||
if (!enabled) { res.json({ bad: true }); }
|
if (!enabled) { res.json({ bad: true }); }
|
||||||
const doEnable = enabled === 'true';
|
const doEnable = enabled === 'true';
|
||||||
const accountId = req.account.id;
|
|
||||||
|
|
||||||
const update = await SetResearchStatus(req.account.id, doEnable);
|
|
||||||
|
|
||||||
return res.json({ success: true, data: req.account });
|
|
||||||
});
|
|
||||||
|
|
||||||
router.get('/research/', requireAuthenticated, async (req, res) => {
|
await SetResearchStatus(req.account.id, doEnable);
|
||||||
const accountId = req.account.id;
|
|
||||||
|
return res.json({ success: true, data: req.account });
|
||||||
const update = await GetResearchStatus(req.account.id);
|
});
|
||||||
|
|
||||||
return res.json({ success: true, data: update });
|
router.get('/research/', requireAuthenticated, async (req, res) => {
|
||||||
});
|
const update = await GetResearchStatus(req.account.id);
|
||||||
|
|
||||||
|
return res.json({ success: true, data: update });
|
||||||
|
});
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|
Loading…
Reference in New Issue