Skip to content

Commit

Permalink
Merge pull request #191 from osamhack2021/hotfix/#190
Browse files Browse the repository at this point in the history
Hotfix/#190
  • Loading branch information
134130 authored Oct 19, 2021
2 parents 566e213 + 85367cc commit 688fe14
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions backend/controllers/itemController.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ 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: `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);
Expand Down
2 changes: 1 addition & 1 deletion backend/routes/api/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 688fe14

Please sign in to comment.