Commit graph

340 commits

Author SHA1 Message Date
514b115326 Fix onboarding SQL column names
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 00:15:51 +05:30
e7a5de3cc2 Fix onboarding to use custom session auth
Was using next-auth which wasn't working with custom sessions.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 00:13:56 +05:30
340cf4322e Add audit_log and password_resets migrations
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 00:01:07 +05:30
a54f30ddcb Security hardening - all 8 patches applied
Patch 1: Add requireFamily to chat route
Patch 2: Add requireFamily to family routes
Patch 3: Create admin-auth.ts, apply to all admin routes
Patch 4: Delete debug and migrate routes, update middleware
Patch 5: Create audit_log table and schema
Patch 6: Create password reset flow (reset-request, reset-confirm)
Patch 7: Replace with real HTTP security tests
Patch 8: RLS migrations already exist (01-app-role, 02-enable-rls)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 23:59:43 +05:30
f4a1d4544b Fix scoped.ts TypeScript error - simplify to avoid transaction type issue
The Drizzle transaction generic type was causing a type mismatch error.
Since withFamilyContext and getScopedDb were not used anywhere,
simplify the file to just re-export sql and dbUnscoped.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 23:17:38 +05:30
b3e8b0a75f Fix TypeScript error in AI route 2026-05-16 23:13:24 +05:30
5acb2760cc Fix db imports: use dbUnscoped 2026-05-16 23:12:33 +05:30
2196c3d07d Security hardening: auth, bcrypt, rate-limiting, RLS, audit 2026-05-16 23:11:01 +05:30
4cf886ea43 Add security libs: auth, audit, rate-limit, scoped db 2026-05-16 23:10:56 +05:30
149d8bc72c auth: fix family_id join with uuid cast 2026-05-16 23:05:20 +05:30
ca4e1355d6 Dockerfile: enable pnpm in builder stage 2026-05-16 22:38:02 +05:30
aec1e4bcab Dockerfile: use pnpm install --ignore-scripts to bypass build approval 2026-05-16 22:37:16 +05:30
d5a48072d7 Dockerfile: approve build scripts for esbuild/sharp 2026-05-16 22:35:58 +05:30
6f800e07df Dockerfile: use pnpm instead of npm
- Replace npm ci with pnpm install --frozen-lockfile
- Use corepack to enable pnpm
- Update COPY for pnpm-lock.yaml
2026-05-16 22:34:36 +05:30
387da42286 Add growth chart with WHO percentile bands
- Line chart showing child's growth over time
- Toggle between weight/height/head
- WHO 50th percentile reference line
- WHO p3-p97 range zone

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 18:31:24 +05:30
0865706a94 Add WHO growth standards with percentile tracking
- Add head circumference to WHO standards (boys & girls 0-24 months)
- Update growth API to return WHO standards with records
- Update growth page to show percentile rankings
- Add head circumference input to form
- Use FamilyProvider instead of hardcoded childId
- Show percentile (e.g., "50th-85th") for each measurement

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 18:07:41 +05:30
260e287f0b Add vaccine reminders to home page
- Show vaccine reminder banner on home page
- Link to medical page for details
- Show due/overdue status

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 16:31:12 +05:30
b93f1f5dcf Add notifications API for vaccine reminders
- API endpoint /api/notifications returns due/overdue vaccines
- Checks child's birthDate to calculate due dates
- Returns notifications with type, status, days overdue

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 16:30:14 +05:30
3e54efaf66 Add vaccine tabs: Completed/Upcoming/Overdue with days overdue display
- Calculate schedule from child's DOB
- Add tab navigation for vaccines
- Show days overdue for missed vaccines
- Visual indicators (opacity for completed, red border for overdue)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 16:29:33 +05:30
bc08828c18 Disable service worker to fix console errors
The PWA service worker is causing errors in production. Disabled for now.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 16:09:36 +05:30
39a93d64e2 Add GET /api/auth/signin for session checking
FamilyProvider calls GET /api/auth/signin to check if user is authenticated after page load.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 15:30:59 +05:30
3ffd3c32db Fix: Remove pediatrician_phone column reference
The column doesn't exist in production database, causing login failures.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 15:20:04 +05:30
c65051cf7d Add password management to admin users page
- Add PATCH endpoint to set user passwords
- Add password modal UI in admin panel
- Update CLAUDE.md with latest features

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 15:12:23 +05:30
0349be2067 Fix TypeScript error - add hasPassword to User interface
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 15:06:58 +05:30
752924a323 Add password status column to admin users page
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 15:03:58 +05:30
40c3dcf33f Make dashboard cards clickable
- Families → /admin/families
- Users → /admin/users
- Children → /admin/children
- MRR → /admin/revenue

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 14:25:28 +05:30
26af4b9318 Fix column name error in admin/families API
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 14:21:49 +05:30
2de47056e7 Fix admin panels
- Families: add "New Family" button
- Users: add "Add User" form with family selector
- Add delete user option
- Include member_id for proper removal

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 14:19:22 +05:30
8867e66928 Fix admin-login route - create proper page at /admin-login
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 12:59:01 +05:30
6543d888c8 Fix admin login page
- Create proper /admin-login page
- Fix route conflict

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 11:28:54 +05:30
da8675c045 Add admin member management
- View members per family
- Add new member by email
- Remove member from family
- Simple password auth migration file

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 10:45:38 +05:30
f967215fc8 Add email/password authentication
- Add password_hash to users table
- New login flow: email + password
- Sign up / Sign in toggle
- Simple password hashing (upgrade to bcrypt in prod)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 10:37:48 +05:30
09f263b423 Fix R2 photo privacy - filter by childId
- GET /api/upload now filters R2 listing by childId
- Only user's own photos are returned

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 09:31:09 +05:30
67bb077687 Fix AI page header layout
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 09:21:19 +05:30
75909615b4 Style AI page like other pages
- Add dark mode support throughout
- Add consistent header with back button
- Add modal dark mode styling

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 09:17:14 +05:30
5984a8ea13 Add modal confirm dialog for delete
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 02:00:21 +05:30
6e2ee3830e Fix delete button confirmation and size
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 01:58:34 +05:30
8d74656ecc Fix AI chat UX
- Show user message immediately while waiting for AI
- Add delete button for each conversation

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 01:57:03 +05:30
e51853f335 Add debug logging for childId
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 01:54:09 +05:30
1c5c02ffbd Fix chat API query - use separate queries instead of aggregate
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 01:51:21 +05:30
9e506279a7 Fix AI chat performance and UX
- Single JOIN query instead of N+1 selects for sessions
- Auto-create session when sending without one
- Send button enabled when typing

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 01:49:36 +05:30
881888ef10 Fix AI chat: handle undefined sessions
- Add error state to display API errors
- Safe guard sessions.map with (sessions || [])
- Show error message on API failure

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 01:44:08 +05:30
fb2527f4b3 Fix AI chat: disable send without session
- Disable send button when no active session exists

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 01:42:37 +05:30
2d61ba2afc Fix chat API to work with database
- Use sql template literals instead of unsafe queries
- Handle UUID child_id requirement properly
- Fetch messages separately to avoid GROUP BY issues

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 01:40:40 +05:30
f8df3ce313 Fix AI chat page: add back button, disable send while loading
- Add back link (←) to /menu in header
- Send button: gray out while loading to prevent double-click

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 01:32:22 +05:30
049a496f7f Document Turbopack cumulative fixes tip
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 01:29:55 +05:30
b8c03acd02 Fix Medical page header to match other pages, avoid Turbopack bug
- Header: align with Growth page pattern (p-4, back button left)
- Link: / → /menu
- Rename: Medical 💊 → Medical
- Fix: TT/Td → Tetanus and adult diphtheria (Td) to avoid Turbopack SWC parser error

Note: Apply fixes one change at a time between builds to avoid Turbopack caching issues.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 01:29:35 +05:30
26fe359303 Update documentation with recent fixes and known issues
- Add familyName and memberCount to FamilyProvider docs
- Document Turbopack parsing issue and workaround
- Add chat sessions localStorage note

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 01:16:14 +05:30
4deb7ff69d Highlight Free Plan with background shade
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 00:55:28 +05:30
953adbd3b3 Fix memberCount to fetch from database
FamilyProvider now fetches actual member count from family_members API

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 00:53:36 +05:30