## AI Chat Fixes - **CRITICAL**: Fixed AI chat responding only with sleep-related info - Root cause: Current user message was never added to context before sending to AI - Added user message to context in ai.service.ts before API call - Fixed conversation ID handling for new conversations (undefined check) - Fixed children query to properly use FamilyMember join instead of incorrect familyId lookup - Added FamilyMember entity to AI module imports - **Context improvements**: - New conversations now use empty history array (not the current message) - Properly query user's children across all their families via family membership ## Children Authorization Fix - **CRITICAL SECURITY**: Fixed authorization bug where all users could see all children - Root cause: Controllers used `user.sub` but JWT strategy returns `user.userId` - Changed all children controller methods to use `user.userId` instead of `user.sub` - Added comprehensive logging to track userId and returned children - Backend now correctly filters children by family membership ## WebSocket Authentication - **Enhanced error handling** in families gateway - Better error messages for connection failures - Added debug logging for token validation - More descriptive error emissions to client - Added userId fallback (checks both payload.userId and payload.sub) ## User Experience - **Auto-clear cache on logout**: - Logout now clears localStorage and sessionStorage - Prevents stale cached data from persisting across sessions - Users get fresh data on every login without manual cache clearing ## Testing - Backend correctly returns only user's own children (verified in logs) - AI chat now responds to all types of questions, not just sleep-related - WebSocket authentication provides clearer error feedback 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
3.2 KiB
Features Completed - October 4, 2025
Photo Upload System Implementation
✅ User Profile Photo Upload
Status: COMPLETE
Time: ~3 hours (planned: 2h)
What was built:
- PhotoUpload component with base64 encoding (max 5MB)
- Increased backend body size limit to 10MB
- Added photo_url TEXT column to users table
- Removed PostgreSQL index (exceeded 8KB limit for base64)
- Updated all auth endpoints to return photoUrl
- Added avatar display in header with error handling
- Hidden URL text field for cleaner UX
Technical challenges solved:
- PostgreSQL index size limit (8KB) - removed index completely
- Express body parser limit (100KB default) - increased to 10MB
- React import error - added missing useEffect import
- Next.js caching - required full rebuild
Files modified: 15 files across frontend and backend
Commits: 6 commits
3f31edd- feat: Add user profile photo upload4527224- fix: Increase body size limit to 10MB5c69375- fix: Remove photo_url index31f710d- feat: Hide photo URL fieldf083e3e- fix: Remove TextField completely0519740- fix: Import useEffect
✅ Child Photo Upload Enhancement
Status: COMPLETE Time: ~1 hour (planned: 1.5h)
What was built:
- Reused PhotoUpload component for child profiles
- Updated translations in all 7 languages
- Changed label from "Photo URL (Optional)" to "Child Image (Optional)"
- Photo displays in child cards with avatar fallback
Files modified: 8 translation files + ChildDialog.tsx
Commit: afdb51c - feat: Update child photo label
✅ Mobile View Grid Layout (2 Cards per Row)
Status: COMPLETE Time: ~30 minutes (planned: 1h)
What was built:
- Changed children grid from 1 card/row to 2 cards/row on mobile
- Responsive Grid sizing: xs={6} sm={6} md={4}
- Maintained proper touch targets and spacing
Files modified: maternal-web/app/children/page.tsx
✅ Collapsible Active Sessions Section
Status: COMPLETE Time: ~1 hour
What was built:
- Converted SessionsManagement to MUI Accordion
- Converted DeviceTrustManagement to MUI Accordion
- Shows count badge when collapsed
- Smooth expand/collapse animations
Files modified:
maternal-web/components/settings/SessionsManagement.tsxmaternal-web/components/settings/DeviceTrustManagement.tsx
Bug Fixes
✅ Voice Tracking Data Format
Fixed: Voice feeding/sleep commands now save correctly
- Fixed data format mismatch (timestamp/data vs startedAt/metadata)
- Added sleep duration → startTime/endTime conversion
✅ Session Persistence After Revocation
Fixed: Users are now properly logged out after revoking sessions/devices
✅ Voice Modal Status Not Updating
Fixed: Voice modal now shows correct status after approve/edit
Summary
Total features completed today: 4 high-priority features + 3 bug fixes Total time: ~6 hours Total commits: 10+ commits Files modified: 25+ files
Next priorities (from REMAINING_FEATURES.md):
- Legal Pages & User Menu (3h)
- EULA Agreement Popup (2h)
- Cookie Consent Banner (2h)
- Secondary Color Palette & Accessibility Toggle (4h)
- AI Response Feedback UI (2h)