Repository navigation
Add GET /plant/:id endpoint - #60
Merged
3 commits merged intoNov 22, 2026
Merged
3 commits merged into
3 commits merged into
Conversation
Adds a RolesGuard/@roles decorator (Cognito groups) for 403s, a validated CreateAdminEventDto, service logic that 404s on unknown sites and inserts into admin_events, extended response DTO, README docs and unit tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Returns the full plant record plus host sites via the site_plants join. Malformed ids return 400, unknown ids return 404.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ℹ️ Issue
Closes #20
📝 Description
Adds
GET /plant/:id, which returns the full record for one plant plus the sites where it grows. The site page only previews up to 6 plants, so visitors who click one need this detail view.Briefly list the changes made to the code:
plantsmodule (controller, service, module) withGET /plant/:id.PlantResponseDto/PlantHostSiteDtoas the typed response shape. Optional text fields arenullwhen empty, andrecipes/hostSitesdefault to[].hostSitesis loaded through thesite_plantsjoin table and includes all site types (existing and emerging).PlantsModuleinapp.module.tsand added a Plants swagger tag.✔️ Verification
yarn test(full suite passes, including the newapps/backend/src/plantsspecs)yarn lint:check && npx nx build backendyarn migration:run && yarn seed && npx nx serve backend, thenGET http://localhost:3000/api/plant/<seeded plant uuid>returns 200 withhostSites./api/plant/abcreturns 400 and a random valid UUID returns 404.postman:
🏕️ (Optional) Future Work / Notes
Plant.idis a UUID, so any non-UUID (e.g.abc,123) returns 400, consistent withGET /site/:id.nameis mapped fromplantName,siteTypefromSite.type, andimageUrlis built fromimageS3Key(nullif unset).yarn format:checkflagsevent-exception.entity.ts, which came from main (not touched here).