perf: lazy-load Workspace relationships to reduce N+1 queries #69

Open
Charon wants to merge 1 commit from feat/workspace-lazy-loading into dev

1 commit

Author SHA1 Message Date
Claude
3976e52f43
perf: lazy-load Workspace relationships to reduce N+1 queries
Add explicit $with = [] to prevent any auto-eager-loading of the 30+
relationships defined on the Workspace model. Provide scopeWithCommon()
for eager-loading core tenant relationships (users, members, teams,
workspacePackages, namespaces) and scopeWithCommonCounts() as a lighter
alternative using withCount() for listing pages.

Fixes #21

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 13:38:18 +00:00