Skip to content

Add cost, hours, and mobility fields to POIs#183

Closed
fatherlinux wants to merge 2 commits into
masterfrom
feature/7-poi-metadata-fields
Closed

Add cost, hours, and mobility fields to POIs#183
fatherlinux wants to merge 2 commits into
masterfrom
feature/7-poi-metadata-fields

Conversation

@fatherlinux
Copy link
Copy Markdown
Member

Summary

Adds essential trip planning metadata to POIs: cost, operating hours, and mobility accessibility levels. These fields enable users to filter and plan visits based on budget, schedule constraints, and physical accessibility needs.

Closes #7

Changes

Database (Migration 017)

  • Adds cost VARCHAR(50) with CHECK constraint (free, low, medium, high)
  • Adds hours TEXT for freeform operating hours
  • Adds mobility VARCHAR(50) with CHECK constraint (full, limited, accessible)
  • All fields nullable for backward compatibility

Backend API

  • Updated POST /api/admin/pois to accept new fields
  • Updated PUT /api/admin/pois/:id to accept new fields
  • Database constraints enforce valid values

Frontend

  • POI detail view shows new fields in "Visitor Information" section
  • Icons: 💵 (cost), 🕐 (hours), ♿/⚠️/🥾 (mobility)
  • Admin panel has form inputs: cost dropdown, hours text field, mobility dropdown

Test plan

  • Database migration applied successfully
  • API returns new fields in GET /api/pois
  • API accepts new fields in POST /api/admin/pois
  • API accepts new fields in PUT /api/admin/pois/:id
  • Database constraints reject invalid enum values
  • Frontend displays fields when present
  • Frontend hides sections when fields are NULL
  • Admin form inputs working

🤖 Generated with Claude Code

fatherlinux and others added 2 commits April 4, 2026 16:40
Adds cost, operating hours, and mobility accessibility fields to POIs.
Enables trip planning based on budget, schedule, and physical limitations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds essential trip planning metadata to POIs:
- Cost field (free, low, medium, high) for budget planning
- Hours field (freeform text) for operating hours/availability
- Mobility field (full, limited, accessible) for accessibility

Database changes:
- Migration 017: Adds cost, hours, mobility columns with CHECK constraints
- All fields nullable for backward compatibility

Backend changes:
- Updated POST/PUT /api/admin/pois to accept new fields
- Database constraints enforce valid enum values

Frontend changes:
- Added new fields to POI detail view Visitor Information section
- Icons for cost, hours, mobility fields
- Added admin form inputs (dropdowns + text field)

Testing:
- Integration tests for API endpoints
- Manual API testing verified all endpoints

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces cost, hours, and mobility metadata fields for POIs, featuring a database migration with CHECK constraints, backend route updates, integration tests, and frontend UI enhancements for viewing and editing. Feedback identifies a need for backend validation to prevent database errors from invalid inputs and recommends refactoring repetitive conditional rendering logic in the frontend components to improve maintainability.

Comment thread backend/routes/admin.js
'events_url', 'news_url', 'research_context',
'length_miles', 'difficulty', 'boundary_type', 'boundary_color'
'length_miles', 'difficulty', 'boundary_type', 'boundary_color',
'cost', 'hours', 'mobility'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The new fields 'cost', 'hours', and 'mobility' are added to the allowedFields array, but there is no corresponding validation logic implemented to ensure these fields adhere to the database constraints (e.g., checking if 'cost' is one of the allowed enum values) before they are passed to the database query. This could lead to database errors if invalid data is submitted.

Comment on lines +431 to +434
{destination.cost === 'free' ? 'Free' :
destination.cost === 'low' ? 'Low ($1-10)' :
destination.cost === 'medium' ? 'Medium ($11-25)' :
destination.cost === 'high' ? 'High ($26+)' : destination.cost}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The conditional rendering logic for the cost display is repetitive. Consider using a mapping object or a lookup function to improve readability and maintainability.

References
  1. Code should be clean and maintainable. Repetitive conditional logic should be refactored. (link)

Comment on lines +447 to +449
{destination.mobility === 'accessible' ? '♿ Accessibility' :
destination.mobility === 'limited' ? '⚠️ Accessibility' :
destination.mobility === 'full' ? '🥾 Accessibility' : 'Accessibility'}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The conditional rendering logic for mobility icons is repetitive. Consider using a mapping object or a lookup function to improve readability and maintainability.

References
  1. Code should be clean and maintainable. Repetitive conditional logic should be refactored. (link)

@fatherlinux
Copy link
Copy Markdown
Member Author

Closing as stale — codebase has moved significantly since April. Will re-evaluate if needed.

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 Cost, Limited Mobility and Hours Fields for Activities

1 participant