Commit Graph

23 Commits

Author SHA1 Message Date
bee80be87d fix: add support for Clerk IDs and activity endpoint
- Update getUserProfile to accept both database ID and Clerk ID
- Update getUserReports to handle Clerk IDs
- Update getUserEvents to handle Clerk IDs
- Add getUserActivity endpoint to return timeline of user actions
- Add activity route GET /api/users/:id/activity
- Fix TypeScript errors with const assertions

This fixes 404 errors when frontend uses Clerk IDs to fetch user data
2025-11-16 21:39:38 +00:00
c84bcb2fd6 feat: implement user profile endpoints (task 31)
- Add GET /api/users/:id for profile retrieval with stats
- Add PATCH /api/users/:id for profile updates
- Add GET /api/users/:id/reports to fetch user's reports
- Add GET /api/users/:id/events to fetch user's events (registered & organized)
- Add PATCH /api/users/:id/preferences for notification settings
- Add POST /api/users/:id/calculate-impact for impact score calculation
- Create userService with all business logic
- Create userController with request handling
- Create userRoutes and register in main server
- Update frontend userService with new endpoints
- Add comprehensive documentation in USER_PROFILE_ENDPOINTS.md
- Add test script for manual endpoint testing

Requirements satisfied: 6.3, 6.4, 6.5, 10.4
2025-11-16 21:38:16 +00:00
f02f23e185 feat: implement user profile page with statistics, contribution map, and activity timeline
- Add userService for profile and activity API calls
- Create UserProfilePage with tabbed interface (overview, reports, events, activity)
- Display user statistics (reports count, events count, impact score)
- Implement personal contribution map showing all user report locations
- Add activity timeline with different activity types
- Enable profile editing for own profile (first name, last name, username)
- Update UserProfile component to link to profile page
- Add /profile/:userId route to App
- Install react-leaflet for map integration
- Requirements: 6.3, 6.4, 6.5
2025-11-16 21:13:26 +00:00
25f8c46d7f Restrict event completion to after event date
- Only allow organizers to complete events after the scheduled date has passed
- Show informative message to organizers before event date
- Prevents premature event completion
2025-11-16 20:25:38 +00:00
c1f362a604 Implement event completion workflow (Task 14)
- Add completeEvent endpoint to backend API
- Create EventCompletionForm component with litter quantity input and photo upload
- Update EventDetailModal to show completion form for organizers
- Add isOrganizer check in EventsPage
- Update event service to support completion
- Display completion data (litter collected, photos) for completed events
2025-11-16 20:21:47 +00:00
b19b93d32d chore: mark task 13 as completed 2025-11-16 20:06:25 +00:00
e165fea414 feat: implement event creation and management interface (task 13)
- Create EventForm component with date/time picker and map-based location selection
- Implement EventList component with status badges and participant counts
- Add EventFilters component for filtering by status and date range
- Create EventDetailModal with registration functionality and event details
- Build eventService for API calls (getEvents, createEvent, register, etc.)
- Update EventsPage with full event management UI
- Support event creation, listing, filtering, and registration
- Requirements: 4.1, 4.2, 4.3, 4.4
2025-11-16 20:06:09 +00:00
6d30405428 chore: mark task 25 as complete 2025-11-16 19:20:05 +00:00
32102d7aaa feat: implement file upload and EXIF processing (task 25)
- Configure Multer for photo uploads to local filesystem
- Set up uploads directory and Express static file serving
- Implement EXIF metadata extraction with exifr library
- Add file validation (type: JPEG/PNG/WebP, size: 5MB max)
- Create photo URL generation for local storage paths
- Add upload endpoint POST /api/reports/upload
- Include comprehensive error handling
- Add test scripts and documentation

Requirements satisfied: 1.2, 1.3, 1.4, 1.5
2025-11-16 19:19:35 +00:00
4797b320e1 Update task 25 to use local file storage instead of cloud storage 2025-11-16 19:16:47 +00:00
0d9d2e5579 Mark task 11 (data visualization charts) as complete 2025-11-16 19:04:54 +00:00
9aa6507e7e fix: expand map filters by default to show hotspot toggle
Make the filters panel expanded by default so users can immediately
see and access the hotspot visualization toggle without needing to
click to expand the panel first.
2025-11-16 19:03:28 +00:00
40a96142ba feat: implement hotspot visualization on map
- Add HotspotSeverity type and HotspotWithSeverity interface
- Implement getHotspots() method in analyticsService with severity calculation
- Add hotspot layer to MapView component with color-coded circles
- Create hotspot markers with severity icons and report count badges
- Add detailed hotspot popups showing report count, severity score, radius, and dates
- Implement hotspot toggle control in MapFilters with loading state
- Add hotspot severity legend to MapFilters
- Integrate hotspot data fetching in MapPage with sample fallback data
- Color-code hotspot boundaries: yellow (low), orange (medium/high), red (critical)
- Display hotspot statistics in interactive popups

Implements task 12: Create hotspot visualization
Requirements: 3.2, 3.3, 3.5
2025-11-16 19:01:26 +00:00
82635559db feat: implement data visualization charts for analytics dashboard
- Add TimeSeriesChart component for report trends over time
- Add LitterTypeChart component with pie chart for type distribution
- Add QuantityChart component with bar chart for quantity aggregation
- Update analytics service with new API methods for chart data
- Add new types for chart data structures (TimeSeriesDataPoint, LitterTypeDistribution, QuantityAggregation)
- Integrate charts into AnalyticsPage with responsive grid layout
- Add mock data fallback for development when API is not available
- Configure charts for mobile responsiveness
- Implement comparison metrics display in time series
- Add loading states and empty states for all charts

Implements task 11: Data visualization charts
Requirements: 5.2, 5.3, 5.4
2025-11-16 18:58:01 +00:00
9f7fc43fb2 feat: implement analytics dashboard layout (task 10)
- Add analytics types (AnalyticsSummary, DateRange)
- Create analyticsService for API calls and CSV export
- Implement DateRangeSelector component with presets
- Create StatCard component for summary statistics
- Build responsive AnalyticsPage with:
  - Summary statistics cards (reports, events, users, litter collected)
  - Date range filtering with presets
  - CSV export functionality
  - Loading and error states
  - Responsive grid layout

Requirements: 5.1, 5.5
2025-11-16 18:52:34 +00:00
fc2fff5cb1 feat: Configure database with Prisma and MySQL spatial support (Task 22)
- Set up MySQL 8.0+ with spatial data support (POINT SRID 4326)
- Created Prisma schema with all models (User, Report, Event, etc.)
- Added Clerk authentication support (clerk_id field)
- Configured spatial indexes on location fields for performance
- Created database migrations and applied to MySQL
- Built spatial query utilities for geographical operations
- Added database connection singleton and health checks
- Created comprehensive documentation and test scripts

Requirements: 1.1, 2.1, 3.2, 4.1
2025-11-16 18:46:00 +00:00
82a365f357 Update tasks to reflect MySQL instead of PostgreSQL/PostGIS
- Change task 22 from PostgreSQL+PostGIS to MySQL with spatial support
- Update references to PostGIS spatial queries to MySQL spatial functions
- Remove materialized view reference (MySQL specific)
- Update test task to reference MySQL instead of PostGIS
2025-11-16 18:21:09 +00:00
520970993d chore: mark task 9 as complete 2025-11-16 16:52:01 +00:00
3aa7576487 feat: implement report submission and display (task 9)
- Created reportService for API interactions (upload, create, get, verify, dispute)
- Built ReportDetailModal component with photo gallery and verification UI
- Updated ReportForm with actual API submission and progress tracking
- Added error handling and success states
- Created ReportDetailDemo page to showcase modal functionality
- Added route for demo page at /demo/report-detail
- Exported services through index file for cleaner imports
- Documented implementation in SUBMISSION_IMPLEMENTATION.md

Requirements fulfilled: 1.8, 7.4
2025-11-16 16:35:05 +00:00
e18997ed95 feat: implement location selection interface with EXIF, GPS, and map picker
- Created LocationSelector component with three location input methods:
  * Auto-populate from photo EXIF data
  * Device GPS location capture with accuracy indicator
  * Interactive Leaflet map picker with draggable marker
- Added Ireland coordinate validation (lat: 51.4-55.4, lng: -10.5--5.5)
- Created coordinate utility functions for validation and formatting
- Added LocationSelectorDemo page for testing at /demo/location-selector
- Displays selected location with coordinates, source, and accuracy
- Provides clear error messages for validation failures
- Satisfies requirements 1.1, 1.2, 1.3, 8.2
2025-11-16 16:15:42 +00:00
ebdfc797ac feat: implement photo upload component with EXIF extraction
- Add PhotoUpload component with drag-and-drop interface
- Integrate exifr library for GPS and timestamp extraction
- Implement file validation (type, size)
- Add photo previews with metadata overlay
- Support multiple photo uploads (max 5 files, 5MB each)
- Display GPS indicators and extracted metadata
- Create demo page for testing component
- Satisfies requirements 1.2, 1.3, 1.4, 1.5, 8.3
2025-11-16 16:11:00 +00:00
8f297e1ec4 feat: implement heat map visualization with Leaflet.heat plugin
- Integrate Leaflet.heat plugin for heat map overlay
- Add heat map toggle control in MapFilters component
- Configure heat map intensity based on report quantity levels (minimal: 0.3, moderate: 0.5, significant: 0.7, severe: 1.0)
- Implement heat map layer management with proper cleanup
- Add custom gradient colors (blue to red) for visual intensity representation
- Configure heat map with radius: 25px, blur: 15, maxZoom: 17
- Add TypeScript type declarations for leaflet.heat
- Heat map respects existing filter state (date range, litter type, quantity)

Implements task 5: Create heat map visualization
Requirements: 3.1, 3.5
2025-11-16 16:05:31 +00:00
ba324b370e Initial Commit 2025-11-16 16:00:51 +00:00