Add primary organization flag with auto-selection on dashboard

Adds IsPrimary to OrganizationUser (per-user flag, one primary per user).
First org created is automatically set as primary. Selecting a different
org via the UI calls PUT /organisations/{id}/primary to persist the choice
server-side. Dashboard auto-selects: localStorage org (refreshed) →
primary org → single org when no explicit selection exists.
This commit is contained in:
2026-06-11 10:00:09 -07:00
parent f2cc5245bc
commit 1fddec7281
11 changed files with 1995 additions and 944 deletions

View File

@@ -3,11 +3,12 @@ namespace MicCheck.Api.Organizations;
public record OrganizationResponse(
int Id,
string Name,
DateTimeOffset CreatedAt
DateTimeOffset CreatedAt,
bool IsPrimary
)
{
public static OrganizationResponse From(Organization org) => new(
org.Id, org.Name, org.CreatedAt);
public static OrganizationResponse From(Organization org, bool isPrimary = false) => new(
org.Id, org.Name, org.CreatedAt, isPrimary);
}
public record OrganizationMemberResponse(