Skip to content

feat(api): expose organism associations on molecules REST resource#794

Open
vcnainala wants to merge 1 commit into
developmentfrom
feat/expose-molecule-organisms-api
Open

feat(api): expose organism associations on molecules REST resource#794
vcnainala wants to merge 1 commit into
developmentfrom
feat/expose-molecule-organisms-api

Conversation

@vcnainala

@vcnainala vcnainala commented Jun 1, 2026

Copy link
Copy Markdown
Member

Summary

  • Add organisms as an includable BelongsToMany relation on MoleculeResource, reusing the existing OrganismResource fields (name, iri, rank, molecule_count).
  • Expose organism_count on molecule records so clients can show counts without eager-loading the full relation.
  • Document the new include in docs/api-documentation.md and regenerate public/vendor/rest/openapi.json.

Test plan

  • Authenticate and POST /api/molecules/search with includes: [{ "relation": "organisms" }] for a known molecule identifier
  • Verify response includes nested organisms with name, iri, rank, molecule_count
  • Verify organism_count is filterable/sortable in molecule search
  • Confirm OpenAPI spec lists organisms under molecule relations

Resolves

Closes #781

Add organisms as an includable BelongsToMany relation on MoleculeResource
and expose organism_count so API clients can load linked taxa without a
separate organisms lookup. Update API docs and regenerate OpenAPI spec.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 6.09%. Comparing base (a4c26c6) to head (f9010ca).
⚠️ Report is 4 commits behind head on development.

Files with missing lines Patch % Lines
app/Rest/Resources/MoleculeResource.php 0.00% 2 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##             development    #794      +/-   ##
================================================
- Coverage           6.14%   6.09%   -0.06%     
- Complexity          1736    1737       +1     
================================================
  Files                227     227              
  Lines               8945    8963      +18     
================================================
- Hits                 550     546       -4     
- Misses              8395    8417      +22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants