Skip to content

feat(massif): add GET /api/v1/massifs/count endpoint#1704

Merged
ClemRz merged 2 commits into
developfrom
feat/massif-count
Jun 26, 2026
Merged

feat(massif): add GET /api/v1/massifs/count endpoint#1704
ClemRz merged 2 commits into
developfrom
feat/massif-count

Conversation

@ClemRz

@ClemRz ClemRz commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

🤔 What

🤷‍♂️ Why

The homepage currently displays a hardcoded ">4700 massifs" value. This endpoint enables the frontend to fetch a live count, consistent with how other entity counts (entrances, documents, organizations) are already served.

🔍 How

Follows the exact same pattern as existing count endpoints (/entrances/count, /documents/count, /organizations/count):

  • Controller calls TMassif.count({ isDeleted: false }) and returns { count } via ControllerService.treat
  • Route is publicly accessible (no auth required), matching the access level of other read-only massif endpoints
  • OpenAPI spec updated with the new path referencing the existing Count schema

🧪 Testing

npm run test -- --grep "Massif count"

Or hit the endpoint directly:

curl http://localhost:1337/api/v1/massifs/count

📸 Previews

N/A — backend-only change.

- Add count controller returning total non-deleted massifs
- Add route and public access policy
- Add integration test
- Update OpenAPI spec
@ClemRz ClemRz self-assigned this Jun 26, 2026
@ClemRz ClemRz requested a review from Paul-AUB June 26, 2026 15:47
…llers

- ControllerService.treat only uses notFoundMessage when found is falsy
- Count controllers always pass { count } which is always truthy
- Affects: massif, entrance, public-count, document, caver, partner,
  organization, bibliographic-metadata
@Paul-AUB

Copy link
Copy Markdown
Contributor

The implementation is clean and consistent with the existing count endpoint pattern (/entrances/count, /organizations/count). The controller, route, policy, OpenAPI spec, and integration test all follow established conventions.

@ClemRz ClemRz merged commit af5e55d into develop Jun 26, 2026
5 checks passed
@ClemRz ClemRz deleted the feat/massif-count branch June 26, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add GET /api/v1/massifs/count endpoint

2 participants