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