From a5f8d356ae057eb46a57db8eb9c9fa6e8684af54 Mon Sep 17 00:00:00 2001 From: Dave Horsfall Date: Tue, 19 Aug 2025 14:55:24 +0100 Subject: [PATCH 1/4] manually edit changelog --- CHANGELOG.md | 70 +++++++--------------------------------------------- 1 file changed, 9 insertions(+), 61 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6851ef7..ea109dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) From 248b0ffd5bdeae3692d793aaa4370f3c6653e494 Mon Sep 17 00:00:00 2001 From: Dave Horsfall Date: Wed, 15 Oct 2025 13:44:55 +0100 Subject: [PATCH 2/4] Subtitle to lay_summary, with maxLength, add cover_video --- src/api/study/content-types/study/schema.json | 9 +- src/api/study/controllers/study.js | 164 +++++++++++------- 2 files changed, 111 insertions(+), 62 deletions(-) diff --git a/src/api/study/content-types/study/schema.json b/src/api/study/content-types/study/schema.json index 40d6891..94c77f6 100644 --- a/src/api/study/content-types/study/schema.json +++ b/src/api/study/content-types/study/schema.json @@ -63,8 +63,9 @@ "repeatable": true, "component": "contributions.team" }, - "subtitle": { - "type": "text" + "lay_summary": { + "type": "text", + "maxLength": 400 }, "password": { "type": "customField", @@ -84,6 +85,10 @@ "type": "relation", "relation": "oneToOne", "target": "api::dataset.dataset" + }, + "cover_video": { + "type": "string", + "regex": "^https" } } } diff --git a/src/api/study/controllers/study.js b/src/api/study/controllers/study.js index 2fd07cc..0babcd5 100644 --- a/src/api/study/controllers/study.js +++ b/src/api/study/controllers/study.js @@ -1,15 +1,14 @@ -'use strict'; +"use strict"; /** * study controller */ -const { createCoreController } = require('@strapi/strapi').factories; -const { NotFoundError } = require('@strapi/utils').errors; +const { createCoreController } = require("@strapi/strapi").factories; +const { NotFoundError } = require("@strapi/utils").errors; -module.exports = createCoreController('api::study.study', ({ strapi }) => ({ +module.exports = createCoreController("api::study.study", ({ strapi }) => ({ async find(ctx) { - ctx.query.filters = { ...ctx.query.filters, is_listed: true, @@ -17,55 +16,68 @@ module.exports = createCoreController('api::study.study', ({ strapi }) => ({ 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'], - populate: ['logo'], + fields: ["name"], + populate: ["logo"], }, }, }, teams: { - fields: ['is_lead'], + fields: ["is_lead"], filters: { team: { publishedAt: { $notNull: true } } }, populate: { team: { - fields: ['name', 'website', 'description'], - populate: ['logo'], + fields: ["name", "website", "description"], + populate: ["logo"], }, }, }, contributors: { - fields: ['is_lead', 'role'], + fields: ["is_lead", "role"], filters: { person: { publishedAt: { $notNull: true } } }, populate: { person: { - fields: ['first_name', 'last_name'], - populate: ['avatar'], + fields: ["first_name", "last_name"], + populate: ["avatar"], }, }, }, datasets: { - fields: ['name', 'description', 'tissues', 'organisms', 'assays', 'diseases', 'celltypes', 'human_developmental_stages', 'count', 'unit'], - populate: ['media'], + 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'], - } + populate: ["media"], + }, }, }; @@ -73,15 +85,24 @@ module.exports = createCoreController('api::study.study', ({ strapi }) => ({ // 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, @@ -92,81 +113,104 @@ module.exports = createCoreController('api::study.study', ({ strapi }) => ({ return await super.find(ctx); }, async findOne(ctx) { - const { slug } = ctx.params; const query = { ...ctx.query, filters: { slug }, fields: [ - 'name', - 'slug', - 'subtitle', - 'createdAt', - 'updatedAt', + "name", + "slug", + "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'], - populate: ['logo'], + fields: ["name"], + populate: ["logo"], }, }, }, teams: { - fields: ['is_lead'], + fields: ["is_lead"], filters: { team: { publishedAt: { $notNull: true } } }, populate: { team: { - fields: ['name', 'website', 'description'], - populate: ['logo'], + fields: ["name", "website", "description"], + populate: ["logo"], }, }, }, contributors: { - fields: ['is_lead', 'role'], + fields: ["is_lead", "role"], filters: { person: { publishedAt: { $notNull: true } } }, populate: { person: { - fields: ['first_name', 'last_name'], - populate: ['avatar'], + fields: ["first_name", "last_name"], + populate: ["avatar"], }, }, }, datasets: { - fields: ['name', 'description', 'tissues', 'organisms', 'assays', 'diseases', 'celltypes', 'human_developmental_stages', 'count', 'unit'], - populate: ['media', 'data', 'resources'], + 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'], - } + populate: ["media"], + }, }, }; const [study] = await strapi.entityService.findMany( - 'api::study.study', + "api::study.study", query ); // 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)){ - throw new NotFoundError('Study not found in collection'); + if (!ids.length || !ids.includes(study.id)) { + throw new NotFoundError("Study not found in collection"); } } return this.transformResponse(study); }, -})); \ No newline at end of file +})); From 91aa35dc8fd09c5e5373fab69dfc5b55875a68c0 Mon Sep 17 00:00:00 2001 From: dannda Date: Wed, 15 Oct 2025 15:19:08 +0100 Subject: [PATCH 3/4] lint study.js --- src/api/study/controllers/study.js | 146 ++++++++++++++--------------- 1 file changed, 73 insertions(+), 73 deletions(-) diff --git a/src/api/study/controllers/study.js b/src/api/study/controllers/study.js index 0babcd5..08efc29 100644 --- a/src/api/study/controllers/study.js +++ b/src/api/study/controllers/study.js @@ -1,13 +1,13 @@ -"use strict"; +'use strict'; /** * study controller */ -const { createCoreController } = require("@strapi/strapi").factories; -const { NotFoundError } = require("@strapi/utils").errors; +const { createCoreController } = require('@strapi/strapi').factories; +const { NotFoundError } = require('@strapi/utils').errors; -module.exports = createCoreController("api::study.study", ({ strapi }) => ({ +module.exports = createCoreController('api::study.study', ({ strapi }) => ({ async find(ctx) { ctx.query.filters = { ...ctx.query.filters, @@ -16,67 +16,67 @@ module.exports = createCoreController("api::study.study", ({ strapi }) => ({ ctx.query = { ...ctx.query, - fields: ["name", "slug", "lay_summary", "createdAt", "updatedAt"], + fields: ['name', 'slug', 'lay_summary', 'createdAt', 'updatedAt'], populate: { cover_image: true, publications: { fields: [ - "title", - "doi", - "url", - "abstract", - "date", - "is_published", - "is_preprint", + 'title', + 'doi', + 'url', + 'abstract', + 'date', + 'is_published', + 'is_preprint', ], populate: { journal: { - fields: ["name"], - populate: ["logo"], + fields: ['name'], + populate: ['logo'], }, }, }, teams: { - fields: ["is_lead"], + fields: ['is_lead'], filters: { team: { publishedAt: { $notNull: true } } }, populate: { team: { - fields: ["name", "website", "description"], - populate: ["logo"], + fields: ['name', 'website', 'description'], + populate: ['logo'], }, }, }, contributors: { - fields: ["is_lead", "role"], + fields: ['is_lead', 'role'], filters: { person: { publishedAt: { $notNull: true } } }, populate: { person: { - fields: ["first_name", "last_name"], - populate: ["avatar"], + fields: ['first_name', 'last_name'], + populate: ['avatar'], }, }, }, datasets: { fields: [ - "name", - "description", - "tissues", - "organisms", - "assays", - "diseases", - "celltypes", - "human_developmental_stages", - "count", - "unit", + 'name', + 'description', + 'tissues', + 'organisms', + 'assays', + 'diseases', + 'celltypes', + 'human_developmental_stages', + 'count', + 'unit', ], - populate: ["media"], + populate: ['media'], }, resources: { - fields: ["name", "description", "type", "category"], + fields: ['name', 'description', 'type', 'category'], }, cover_dataset: { fields: [false], - populate: ["media"], + populate: ['media'], }, }, }; @@ -86,10 +86,10 @@ module.exports = createCoreController("api::study.study", ({ strapi }) => ({ const { collection } = ctx.query; if (collection) { const collectionEntry = await strapi.db - .query("api::collection.collection") + .query('api::collection.collection') .findOne({ where: { name: collection }, - populate: { studies: { select: ["id"] } }, + populate: { studies: { select: ['id'] } }, }); const ids = collectionEntry?.studies.map(({ id }) => id) || []; @@ -119,79 +119,79 @@ module.exports = createCoreController("api::study.study", ({ strapi }) => ({ ...ctx.query, filters: { slug }, fields: [ - "name", - "slug", - "lay_summary", - "cover_video", - "createdAt", - "updatedAt", + 'name', + 'slug', + 'lay_summary', + 'cover_video', + 'createdAt', + 'updatedAt', ], populate: { cover_image: true, cover_video: true, publications: { fields: [ - "title", - "doi", - "url", - "abstract", - "date", - "is_published", - "is_preprint", + 'title', + 'doi', + 'url', + 'abstract', + 'date', + 'is_published', + 'is_preprint', ], populate: { journal: { - fields: ["name"], - populate: ["logo"], + fields: ['name'], + populate: ['logo'], }, }, }, teams: { - fields: ["is_lead"], + fields: ['is_lead'], filters: { team: { publishedAt: { $notNull: true } } }, populate: { team: { - fields: ["name", "website", "description"], - populate: ["logo"], + fields: ['name', 'website', 'description'], + populate: ['logo'], }, }, }, contributors: { - fields: ["is_lead", "role"], + fields: ['is_lead', 'role'], filters: { person: { publishedAt: { $notNull: true } } }, populate: { person: { - fields: ["first_name", "last_name"], - populate: ["avatar"], + fields: ['first_name', 'last_name'], + populate: ['avatar'], }, }, }, datasets: { fields: [ - "name", - "description", - "tissues", - "organisms", - "assays", - "diseases", - "celltypes", - "human_developmental_stages", - "count", - "is_featured", - "unit", + 'name', + 'description', + 'tissues', + 'organisms', + 'assays', + 'diseases', + 'celltypes', + 'human_developmental_stages', + 'count', + 'is_featured', + 'unit', ], - populate: ["media", "data", "resources"], + populate: ['media', 'data', 'resources'], }, resources: true, cover_dataset: { fields: [], - populate: ["media"], + populate: ['media'], }, }, }; const [study] = await strapi.entityService.findMany( - "api::study.study", + 'api::study.study', query ); @@ -199,15 +199,15 @@ module.exports = createCoreController("api::study.study", ({ strapi }) => ({ const { collection } = ctx.query; if (collection) { const collectionEntry = await strapi.db - .query("api::collection.collection") + .query('api::collection.collection') .findOne({ where: { name: collection }, - populate: { studies: { select: ["id"] } }, + populate: { studies: { select: ['id'] } }, }); const ids = collectionEntry?.studies.map(({ id }) => id) || []; if (!ids.length || !ids.includes(study.id)) { - throw new NotFoundError("Study not found in collection"); + throw new NotFoundError('Study not found in collection'); } } From 5b57a3135542047f6d63d41a898ccfe5fa2051dd Mon Sep 17 00:00:00 2001 From: Dave Horsfall Date: Tue, 28 Oct 2025 13:13:18 +0000 Subject: [PATCH 4/4] chore: update templates --- .github/ISSUE_TEMPLATE/maintenance.md | 19 +++++++++++++++++ .github/ISSUE_TEMPLATE/support_request.md | 25 +++++++++++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 15 ++++++++------ 3 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/maintenance.md create mode 100644 .github/ISSUE_TEMPLATE/support_request.md diff --git a/.github/ISSUE_TEMPLATE/maintenance.md b/.github/ISSUE_TEMPLATE/maintenance.md new file mode 100644 index 0000000..357244b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/maintenance.md @@ -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. diff --git a/.github/ISSUE_TEMPLATE/support_request.md b/.github/ISSUE_TEMPLATE/support_request.md new file mode 100644 index 0000000..344d03e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/support_request.md @@ -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. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 144eed2..c9ea59a 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -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)