Skip to content

feat(schema): add user preferences infrastructure for EPIC-09#707

Merged
steilerDev merged 1 commit into
betafrom
arch/470-dashboard-schema-api
Mar 9, 2026
Merged

feat(schema): add user preferences infrastructure for EPIC-09#707
steilerDev merged 1 commit into
betafrom
arch/470-dashboard-schema-api

Conversation

@steilerDev
Copy link
Copy Markdown
Owner

Summary

  • Migration 0018 (user_preferences table): INTEGER PK AUTOINCREMENT, user_id FK to users with ON DELETE CASCADE, key/value TEXT columns, UNIQUE(user_id, key) constraint, index on user_id
  • Drizzle schema updated with userPreferences table definition
  • Shared types added: UserPreference, PreferenceKey, DashboardCardId, UpsertPreferenceRequest, PreferencesResponse in shared/src/types/preference.ts
  • Wiki updates: Architecture.md dashboard section, Schema.md deviation fixes (invoice_budget_lines ON DELETE CASCADE, migration renumbering 0017->0018)

Design Decisions

  • No new ADR needed: ADR-017 (Chart Library: Recharts) already covers the chart decision
  • No new dashboard data endpoint: client fetches from existing endpoints in parallel (budget overview, timeline, budget sources, subsidy programs, invoices)
  • User preferences API contract already documented in wiki API-Contract.md (GET/PATCH/DELETE /api/users/me/preferences)
  • DashboardCardId type enumerates the 8 dashboard cards for the dashboard.hiddenCards preference

Schema Deviation Fixes

Test plan

  • Migration 0018 applies cleanly on a fresh database
  • Migration 0018 applies cleanly on a database with existing data
  • Shared types compile without errors
  • Drizzle schema type-checks correctly

Refs #470

🤖 Generated with Claude Code

- Migration 0018: create user_preferences table with UNIQUE(user_id, key)
- Drizzle schema: add userPreferences table definition
- Shared types: add UserPreference, PreferenceKey, DashboardCardId,
  UpsertPreferenceRequest, PreferencesResponse
- Export new types from @cornerstone/shared index
- Wiki: add dashboard architecture section, fix Schema.md deviations
  (invoice_budget_lines ON DELETE CASCADE, migration renumbering)

Refs #470

Co-Authored-By: Claude product-architect (Opus 4.6) <noreply@anthropic.com>
@steilerDev steilerDev merged commit 4713eb7 into beta Mar 9, 2026
13 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 9, 2026

🎉 This PR is included in version 1.15.0-beta.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.15.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@steilerDev steilerDev deleted the arch/470-dashboard-schema-api branch March 22, 2026 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants