Skip to content

Commit 7045243

Browse files
authored
Merge pull request #74 from haniffalab/fix/find-unlisted-studies
fix: allow finding unlisted studies when providing a dataset id
2 parents df840da + 66e0565 commit 7045243

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/api/study/controllers/study.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@ const { NotFoundError } = require('@strapi/utils').errors;
99

1010
module.exports = createCoreController('api::study.study', ({ strapi }) => ({
1111
async find(ctx) {
12-
ctx.query.filters = {
13-
...ctx.query.filters,
14-
is_listed: true,
15-
};
12+
13+
// If not providing a dataset id, return only studies that are listed
14+
if (!ctx.query.filters?.datasets?.id?.$eq){
15+
ctx.query.filters = {
16+
...ctx.query.filters,
17+
is_listed: true,
18+
};
19+
}
1620

1721
ctx.query = {
1822
...ctx.query,

0 commit comments

Comments
 (0)