Commit Graph

2 Commits

Author SHA1 Message Date
Víctor Falcón 5d2e292088 fix(spaces): scope category/label/saved-filter uniqueness per space
A user's spaces are each seeded with the same default category names, so the
per-user unique indexes on categories, labels and saved_filters collided the
moment a second space was created (500 on space creation). Rescope those
uniques to space_id (adding a plain user_id index first so the FK keeps its
index), teach the category duplicate-name handler the new index name, and
harden the creation test to seed the personal space first so it reproduces the
collision.
2026-07-09 12:48:01 +02:00
Víctor Falcón c43bfd5439 feat(spaces): scope reads by active space and add the space switcher
Flip every user-facing read (dashboard, cashflow, transactions, budgets,
accounts, settings, analytics, sync, shared props) from user-scoped to
active-space-scoped via explicit $space->… relations, and re-key the category
tree, spending, and budget-assignment services by space_id. Authorization moves
from creator-ownership to space membership.

Add the visible spaces layer behind a Pennant 'spaces' flag: a sidebar space
switcher, a settings page to create/rename/delete/switch spaces, per-space
offline-cache flushing, and the currentSpace/spaces shared props. Data creation
is unchanged — the BelongsToSpace trait already stamps space_id from the active
space. Isolation tests prove no cross-space leakage.
2026-07-09 12:48:00 +02:00