Skip to content
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
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Maintenance Task
about: Request or propose refactoring, dependency updates, or tooling improvements
title: "[Maintenance] "
labels: maintenance, refactor
assignees: ""
---

**Describe the task**
What needs to be maintained, refactored, or updated?

**Reason for change**
Why is this maintenance needed (e.g., outdated dependency, code clarity, build speed)?

**Proposed approach**
How might this be done?

**Additional context**
Any links, dependencies, or related issues.
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/support_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Support Request
about: Ask for help with using or configuring the software
title: "[Support] "
labels: question, support
assignees: ""
---

**What are you trying to do?**
Describe your goal clearly.

**What have you tried so far?**
List steps or commands you've already attempted.

**What issue are you encountering?**
Include error messages, logs, or unexpected behaviour.

**Environment:**

- OS: [e.g., Windows, macOS, Linux]
- Software version: [e.g., 1.2.3]
- Runtime version: [e.g., Python 3.11]

**Additional context:**
Add any relevant details, such as configuration files or links to documentation you’ve followed.
15 changes: 9 additions & 6 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@

Give a brief summary of changes...

Fixes # (issue)
Fixes # (issue)
Related to # (if applicable)

## Type of change

- [ ] Documentation (non-breaking change that adds or improves the documentation)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Optimization (non-breaking, back-end change that speeds up the code)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] Breaking change (whatever its nature)
- [ ] 🐛 Bug fix (non-breaking change that resolves an issue)
- [ ] ✨ New feature (non-breaking change that adds functionality)
- [ ] ⚡ Optimisation (non-breaking improvement to performance or efficiency)
- [ ] 🧩 Documentation (adds or improves documentation)
- [ ] 🧱 Maintenance (refactor, dependency update, CI/CD, etc.)
- [ ] 🔥 Breaking change (fix or feature that causes existing functionality to change)

## Checklist

- [ ] All tests pass (eg. `npm test`)
- [ ] Pre-commit hooks run successfully (eg. `pre-commit run --all-files`)
- [ ] Documentation updated (if required)
70 changes: 9 additions & 61 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,69 +2,17 @@

# [1.2.0](https://github.com/haniffalab/strapi-api/compare/v1.1.5...v1.2.0) (2025-08-19)


### Bug Fixes

* add @semantic-release/exec ([16b308b](https://github.com/haniffalab/strapi-api/commit/16b308b726ee989294d563baf599ce704546a0c1))
* add dummy file for testing ([19ebfad](https://github.com/haniffalab/strapi-api/commit/19ebfadbb274ca728346240f21a2d0379cece0d6))
* again remove v prefix from releases ([dc2d70d](https://github.com/haniffalab/strapi-api/commit/dc2d70db178d8f379f69a0704a5a219cf6f17b7a))
* again remove v prefix from releases ([dd53e96](https://github.com/haniffalab/strapi-api/commit/dd53e967455b495ab632ff2ac833b39a2b668052))
* final cleanup for semantic releases ([5c87719](https://github.com/haniffalab/strapi-api/commit/5c87719c49d363f24c2a77471e8b04cac6bd4696))
* pass updated version to prep script ([dc18c47](https://github.com/haniffalab/strapi-api/commit/dc18c476ad43b9e91e2fe0c6fe08eb2a058537bb))
* remove v prefix from releases ([7388156](https://github.com/haniffalab/strapi-api/commit/7388156e55005167a952e42ee1ffa1970d3a640d))
* update semantic-release config ([57af642](https://github.com/haniffalab/strapi-api/commit/57af642df5f186172ddc4e091863b4cf61f23379))

- add @semantic-release/exec ([16b308b](https://github.com/haniffalab/strapi-api/commit/16b308b726ee989294d563baf599ce704546a0c1))
- add dummy file for testing ([19ebfad](https://github.com/haniffalab/strapi-api/commit/19ebfadbb274ca728346240f21a2d0379cece0d6))
- again remove v prefix from releases ([dc2d70d](https://github.com/haniffalab/strapi-api/commit/dc2d70db178d8f379f69a0704a5a219cf6f17b7a))
- again remove v prefix from releases ([dd53e96](https://github.com/haniffalab/strapi-api/commit/dd53e967455b495ab632ff2ac833b39a2b668052))
- final cleanup for semantic releases ([5c87719](https://github.com/haniffalab/strapi-api/commit/5c87719c49d363f24c2a77471e8b04cac6bd4696))
- pass updated version to prep script ([dc18c47](https://github.com/haniffalab/strapi-api/commit/dc18c476ad43b9e91e2fe0c6fe08eb2a058537bb))
- remove v prefix from releases ([7388156](https://github.com/haniffalab/strapi-api/commit/7388156e55005167a952e42ee1ffa1970d3a640d))
- update semantic-release config ([57af642](https://github.com/haniffalab/strapi-api/commit/57af642df5f186172ddc4e091863b4cf61f23379))

### Features

* support multiple files for version bump ([462c7b2](https://github.com/haniffalab/strapi-api/commit/462c7b2bc0d09602da610b418c479abea232df2b))

## [1.2.2](https://github.com/haniffalab/strapi-api/compare/v1.2.1...v1.2.2) (2025-08-18)


### Bug Fixes

* again remove v prefix from releases ([dc2d70d](https://github.com/haniffalab/strapi-api/commit/dc2d70db178d8f379f69a0704a5a219cf6f17b7a))

## [1.2.1](https://github.com/haniffalab/strapi-api/compare/v1.2.0...v1.2.1) (2025-08-18)


### Bug Fixes

* again remove v prefix from releases ([dd53e96](https://github.com/haniffalab/strapi-api/commit/dd53e967455b495ab632ff2ac833b39a2b668052))

# [1.2.0](https://github.com/haniffalab/strapi-api/compare/v1.1.9...v1.2.0) (2025-08-18)


### Features

* support multiple files for version bump ([462c7b2](https://github.com/haniffalab/strapi-api/commit/462c7b2bc0d09602da610b418c479abea232df2b))

## [1.1.9](https://github.com/haniffalab/strapi-api/compare/v1.1.8...v1.1.9) (2025-08-18)


### Bug Fixes

* remove v prefix from releases ([7388156](https://github.com/haniffalab/strapi-api/commit/7388156e55005167a952e42ee1ffa1970d3a640d))

## [1.1.8](https://github.com/haniffalab/strapi-api/compare/v1.1.7...v1.1.8) (2025-08-18)


### Bug Fixes

* pass updated version to prep script ([dc18c47](https://github.com/haniffalab/strapi-api/commit/dc18c476ad43b9e91e2fe0c6fe08eb2a058537bb))

## [1.1.7](https://github.com/haniffalab/strapi-api/compare/v1.1.6...v1.1.7) (2025-08-18)


### Bug Fixes

* add @semantic-release/exec ([16b308b](https://github.com/haniffalab/strapi-api/commit/16b308b726ee989294d563baf599ce704546a0c1))
* update semantic-release config ([57af642](https://github.com/haniffalab/strapi-api/commit/57af642df5f186172ddc4e091863b4cf61f23379))

## [1.1.6](https://github.com/haniffalab/strapi-api/compare/v1.1.5...v1.1.6) (2025-08-18)


### Bug Fixes

* add dummy file for testing ([19ebfad](https://github.com/haniffalab/strapi-api/commit/19ebfadbb274ca728346240f21a2d0379cece0d6))
- support multiple files for version bump ([462c7b2](https://github.com/haniffalab/strapi-api/commit/462c7b2bc0d09602da610b418c479abea232df2b))
9 changes: 7 additions & 2 deletions src/api/study/content-types/study/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@
"repeatable": true,
"component": "contributions.team"
},
"subtitle": {
"type": "text"
"lay_summary": {
"type": "text",
"maxLength": 400
},
"password": {
"type": "customField",
Expand All @@ -84,6 +85,10 @@
"type": "relation",
"relation": "oneToOne",
"target": "api::dataset.dataset"
},
"cover_video": {
"type": "string",
"regex": "^https"
}
}
}
104 changes: 74 additions & 30 deletions src/api/study/controllers/study.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,26 @@ const { NotFoundError } = require('@strapi/utils').errors;

module.exports = createCoreController('api::study.study', ({ strapi }) => ({
async find(ctx) {

ctx.query.filters = {
...ctx.query.filters,
is_listed: true,
};

ctx.query = {
...ctx.query,
fields: [
'name',
'slug',
'subtitle',
'createdAt',
'updatedAt',
],
fields: ['name', 'slug', 'lay_summary', 'createdAt', 'updatedAt'],
populate: {
cover_image: true,
publications: {
fields: ['title', 'doi', 'url', 'abstract', 'date', 'is_published', 'is_preprint'],
fields: [
'title',
'doi',
'url',
'abstract',
'date',
'is_published',
'is_preprint',
],
populate: {
journal: {
fields: ['name'],
Expand Down Expand Up @@ -56,32 +57,52 @@ module.exports = createCoreController('api::study.study', ({ strapi }) => ({
},
},
datasets: {
fields: ['name', 'description', 'tissues', 'organisms', 'assays', 'diseases', 'celltypes', 'human_developmental_stages', 'count', 'unit'],
fields: [
'name',
'description',
'tissues',
'organisms',
'assays',
'diseases',
'celltypes',
'human_developmental_stages',
'count',
'unit',
],
populate: ['media'],
},
resources: {
fields: ['name', 'description', 'type', 'category' ]
fields: ['name', 'description', 'type', 'category'],
},
cover_dataset: {
fields: [false],
populate: ['media'],
}
},
},
};

// Check if 'collection' query parameter is present
// Add to query filters last to avoid spreading the ids array into an object
const { collection } = ctx.query;
if (collection) {
const collectionEntry = await strapi.db.query('api::collection.collection').findOne({
where: { name: collection },
populate: { studies: { select: ['id'] } },
});
const collectionEntry = await strapi.db
.query('api::collection.collection')
.findOne({
where: { name: collection },
populate: { studies: { select: ['id'] } },
});

const ids = collectionEntry?.studies.map(({ id }) => id) || [];
if (!ids?.length) { return this.transformResponse([], {
pagination: { page: 1, total: 0, pageCount: 0, pageSize: ctx.query.pagination?.pageSize || 10 }
}); }
if (!ids?.length) {
return this.transformResponse([], {
pagination: {
page: 1,
total: 0,
pageCount: 0,
pageSize: ctx.query.pagination?.pageSize || 10,
},
});
}

ctx.query.filters = {
...ctx.query.filters,
Expand All @@ -92,7 +113,6 @@ module.exports = createCoreController('api::study.study', ({ strapi }) => ({
return await super.find(ctx);
},
async findOne(ctx) {

const { slug } = ctx.params;

const query = {
Expand All @@ -101,14 +121,24 @@ module.exports = createCoreController('api::study.study', ({ strapi }) => ({
fields: [
'name',
'slug',
'subtitle',
'lay_summary',
'cover_video',
'createdAt',
'updatedAt',
],
populate: {
cover_image: true,
cover_video: true,
publications: {
fields: ['title', 'doi', 'url', 'abstract', 'date', 'is_published', 'is_preprint'],
fields: [
'title',
'doi',
'url',
'abstract',
'date',
'is_published',
'is_preprint',
],
populate: {
journal: {
fields: ['name'],
Expand Down Expand Up @@ -137,14 +167,26 @@ module.exports = createCoreController('api::study.study', ({ strapi }) => ({
},
},
datasets: {
fields: ['name', 'description', 'tissues', 'organisms', 'assays', 'diseases', 'celltypes', 'human_developmental_stages', 'count', 'unit'],
fields: [
'name',
'description',
'tissues',
'organisms',
'assays',
'diseases',
'celltypes',
'human_developmental_stages',
'count',
'is_featured',
'unit',
],
populate: ['media', 'data', 'resources'],
},
resources: true,
cover_dataset: {
fields: [],
populate: ['media'],
}
},
},
};

Expand All @@ -156,17 +198,19 @@ module.exports = createCoreController('api::study.study', ({ strapi }) => ({
// Check if 'collection' query parameter is present
const { collection } = ctx.query;
if (collection) {
const collectionEntry = await strapi.db.query('api::collection.collection').findOne({
where: { name: collection },
populate: { studies: { select: ['id'] } },
});
const collectionEntry = await strapi.db
.query('api::collection.collection')
.findOne({
where: { name: collection },
populate: { studies: { select: ['id'] } },
});

const ids = collectionEntry?.studies.map(({ id }) => id) || [];
if (!ids.length || !ids.includes(study.id)){
if (!ids.length || !ids.includes(study.id)) {
throw new NotFoundError('Study not found in collection');
}
}

return this.transformResponse(study);
},
}));
}));