Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix/#190 #191

Merged
merged 2 commits into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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