From 335ff230fdbb7202b1b1399dcced16ae45af8174 Mon Sep 17 00:00:00 2001 From: nannal Date: Wed, 7 Oct 2020 02:34:49 +0300 Subject: [PATCH] more open types --- index.js | 9 ++------- listManager.js | 7 ++----- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/index.js b/index.js index c80e49d..81a0473 100644 --- a/index.js +++ b/index.js @@ -14,14 +14,9 @@ app.use(bodyParser.json(),function (req, res, next) { }) -app.get('/meta/blacklist', function (req, res) { - list.getAllBlack().then(r => { - res.send(JSON.stringify(r)) - }) - }) -app.get('/meta/greylist', function (req, res) { - list.getAllGrey().then(r => { +app.get('/status/:status', function (req, res) { + list.getStatus(req.params.status).then(r => { res.send(JSON.stringify(r)) }) }) diff --git a/listManager.js b/listManager.js index 088c21f..5a58694 100644 --- a/listManager.js +++ b/listManager.js @@ -44,11 +44,8 @@ async function verifyMsg (obj, username) { list = { - getAllBlack: async () => { - return await mongo.get("list","list",{"status": "black"}) - }, - getAllGrey: async () => { - return await mongo.get("list","list",{"status": "black"}) + getStatus: async () => { + return await mongo.get("list","list",{"status": status}) }, getUser: async (username) => { return await mongo.get("list","list",{"user": username})