From 22aef80079367f2a3ba349b546c09d735adcee85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=98=A4=EC=A7=80=ED=99=98?= <50487467+134130@users.noreply.github.com> Date: Tue, 19 Oct 2021 13:25:43 +0000 Subject: [PATCH 1/2] HOTFIX: Edit Algolia search filter accessGroups.edit is not working propaly.. Resolved: #190 --- backend/controllers/itemController.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/controllers/itemController.js b/backend/controllers/itemController.js index 9e46a33b..80e91bc9 100644 --- a/backend/controllers/itemController.js +++ b/backend/controllers/itemController.js @@ -38,7 +38,8 @@ module.exports = { const query = req.params.query; const result = await algolia.search(query, { - filters: `status:"modified" AND NOT accessGroups.read:"${res.locals.group}"`, + // filters: `NOT status:"modified" AND accessGroups.read:"${res.locals.group.toString()}"` + filters: `NOT status:"modified"` }); res.status(200).send(result.hits); From 85367cc234dffc4e05c3af8f81d0b3e9f6c254ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=98=A4=EC=A7=80=ED=99=98?= <50487467+134130@users.noreply.github.com> Date: Tue, 19 Oct 2021 13:27:25 +0000 Subject: [PATCH 2/2] HOTFIX: Request URI with Korean is not working Edit URI structure from /api/algolia/:query to /api/algolia?query= Resolved: #190 --- backend/controllers/itemController.js | 4 ++-- backend/routes/api/item.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/controllers/itemController.js b/backend/controllers/itemController.js index 80e91bc9..037f9ccf 100644 --- a/backend/controllers/itemController.js +++ b/backend/controllers/itemController.js @@ -32,10 +32,10 @@ module.exports = { } }, - // GET /item/algolia + // GET /item/algolia?query= algoliaSearch: async (req, res) => { try { - const query = req.params.query; + const query = req.query.query; const result = await algolia.search(query, { // filters: `NOT status:"modified" AND accessGroups.read:"${res.locals.group.toString()}"` diff --git a/backend/routes/api/item.js b/backend/routes/api/item.js index 08b4782e..f540edfb 100644 --- a/backend/routes/api/item.js +++ b/backend/routes/api/item.js @@ -3,7 +3,7 @@ const router = express.Router(); const itemController = require("../../controllers/itemController.js"); router.get("", itemController.search); -router.get("/algolia/:query", itemController.algoliaSearch); +router.get("/algolia", itemController.algoliaSearch); router.get("/:item_id", itemController.read); router.post("/", itemController.create); router.put("/:item_id", itemController.update);