Files
mic-check/src/api/MicCheck.Api/Organizations/OrganizationResponse.cs
James Wampler 1fddec7281 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.
2026-06-30 11:44:43 -07:00

31 lines
741 B
C#
Executable File

namespace MicCheck.Api.Organizations;
public record OrganizationResponse(
int Id,
string Name,
DateTimeOffset CreatedAt,
bool IsPrimary
)
{
public static OrganizationResponse From(Organization org, bool isPrimary = false) => new(
org.Id, org.Name, org.CreatedAt, isPrimary);
}
public record OrganizationMemberResponse(
int UserId,
string FirstName,
string LastName,
string Email,
string Role,
DateTimeOffset? LastLoginAt
)
{
public static OrganizationMemberResponse From(OrganizationUser member) => new(
member.UserId,
member.User.FirstName,
member.User.LastName,
member.User.Email,
member.Role.ToString(),
member.User.LastLoginAt);
}