Commit Graph

14 Commits

Author SHA1 Message Date
7153e55f4d Add organizerClerkId to events for proper organizer permission checks 2025-11-16 20:53:59 +00:00
a953e63dd8 Fix CORS to allow both port 5173 and 5174 2025-11-16 20:42:32 +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
ec70baa498 fix: add user creation logic to event controller
- Add findOrCreateUser helper function to handle Clerk ID to database ID mapping
- Update all authenticated endpoints to convert Clerk ID to database user ID
- Ensures events can be created and managed by authenticated users
- Matches pattern used in reportController
2025-11-16 20:16:39 +00:00
88117567ab feat: implement backend API for event management (task 13)
- Create eventController with CRUD operations and registration endpoints
- Implement eventService with Prisma database operations
- Add event routes with authentication middleware
- Support event creation, listing, filtering, registration/unregistration
- Include spatial data handling for event locations
- Add participant count tracking and registration status checks
- Requirements: 4.1, 4.2, 4.3, 4.4
2025-11-16 20:15:41 +00:00
64fe312f01 feat: implement report submission with photo upload and map display
- Fix Prisma client generation and database schema sync issues
- Implement user auto-creation from Clerk authentication
- Add raw SQL queries to handle MySQL POINT spatial fields
- Make password_hash optional for Clerk-only authentication
- Update MapPage to fetch real reports from API
- Add photo display in map popups with full-size modal view
- Configure CORS and Helmet for cross-origin image loading
- Add cleanup tracking task to implementation plan

Fixes report submission 500 errors and enables end-to-end workflow from submission to map display.
2025-11-16 20:01:26 +00:00
a58e8da0e1 fix: update upload directory to root uploads folder
- Change UPLOAD_DIR from ./uploads to ../uploads
- Update static file serving path to ../../uploads
- Files now upload to project root uploads/ folder instead of server/uploads/
2025-11-16 19:31:50 +00:00
da95523101 fix: update Clerk auth to use networkless JWT verification
- Replace deprecated verifySession() with verifyToken()
- Use JWT-based authentication (networkless verification)
- Update Clerk secret key to correct test key
- Fixes 410 Gone error from deprecated endpoint

This resolves the authentication issues with file uploads.
2025-11-16 19:26:56 +00:00
d80e787701 docs: add Clerk setup guide and improve auth error messages
- Create CLERK_SETUP.md with step-by-step instructions
- Improve error message to indicate Clerk configuration issue
- Remove debug logging from auth middleware
- Update error handling to be more helpful

The 401 error is caused by missing Clerk Secret Key in server/.env
2025-11-16 19:23:37 +00:00
18e1e03bfc feat: improve file upload authentication and error handling
- Add better error messages for authentication failures
- Display warning in ReportForm when user is not signed in
- Update documentation with authentication requirements
- Improve error handling in reportService.uploadPhoto()

This helps users understand they need to be signed in to upload photos.
2025-11-16 19:21:47 +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
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
ae19d9b690 Change backend API port from 3000 to 3005
- Update server default port to 3005
- Update frontend API base URL to point to port 3005
2025-11-16 17:31:11 +00:00
c0ec28c5c9 Set up backend API server with Express and Prisma
- Initialize Node.js/Express backend project structure
- Configure TypeScript for backend development
- Set up Prisma ORM with MySQL database schema
- Implement authentication middleware with Clerk
- Create photo upload endpoint with EXIF extraction
- Build report CRUD endpoints (create, read, delete)
- Add file upload handling with Multer
- Configure CORS and security middleware (helmet)
- Set up error handling and validation
- Create development environment configuration

Task 21 complete: Backend foundation ready for report submissions
2025-11-16 17:29:26 +00:00