Commit Graph

4 Commits

Author SHA1 Message Date
hailin 06226a3d74 fix(db): drop files_user_id_fkey — anonymous users may not exist in users table
The conversations table has no FK on user_id, but files had one, causing
500 errors on file upload when the anonymous user wasn't registered.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:11:37 -08:00
hailin cf2fd07ead fix(file-service): sync tenantId in domain entity and add migration
FileORM had tenant_id column but FileEntity domain class was missing it,
causing "column FileORM.tenant_id does not exist" errors on production.

- Add tenantId to FileEntity (constructor, create, fromPersistence)
- Pass tenantId in repository toEntity() mapping
- Add idempotent migration script for files.tenant_id + indexes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 04:21:43 -08:00
hailin 4ac1fc4f88 fix(db): add multi-tenancy migration for conversation-service tables
- Add tenant_id column to conversations, messages, token_usages tables
- Create standalone migration SQL script for production deployment
- Add agent_executions table to init-db.sql for new installations
- Fix MessageORM created_at nullable mismatch with database schema
- Backfill existing data with default tenant ID

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 08:39:10 -08:00
hailin 7975982fc3 feat(user): add user profile and contact management
- Add UserProfile entity with immigration-specific fields:
  - Basic info (name, birth date, nationality, current location)
  - Immigration intent (target countries, types, timeline)
  - Education records with WES evaluation flag
  - Work records with NOC codes
  - Language scores (IELTS, TOEFL, etc.)
  - Family members info
  - Financial info for investment immigration
  - Profile completion percentage calculation

- Add UserContact entity for identity binding:
  - Support multiple contact types (EMAIL, WECHAT, WHATSAPP, TELEGRAM, LINE)
  - Verification code flow with expiration
  - Notification settings (paid feature)
  - Notification types: POLICY_UPDATE, DEADLINE_REMINDER, etc.

- Add API endpoints:
  - GET/PUT /users/me/profile/* for profile sections
  - GET/POST/PUT/DELETE /users/me/contacts for contact management
  - POST /users/me/contacts/:type/verification for verification flow
  - POST/PUT/DELETE /users/me/contacts/:type/notifications

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 19:32:17 -08:00