namespace DodoSSH.Domain; /// /// A group of users who can share vaults. /// /// /// The tables exist from the first migration although team features ship in M3. Adding them /// later would mean altering to introduce a foreign key on a live table, and /// the cost of carrying two unused tables is far lower than that. /// public sealed class Team { /// Primary key. public Guid Id { get; set; } /// Display name. public string Name { get; set; } = string.Empty; /// URL-safe unique identifier. public string Slug { get; set; } = string.Empty; /// Optional description. public string? Description { get; set; } /// Who created it. public Guid CreatedByUserId { get; set; } /// Creation timestamp. public DateTimeOffset CreatedAtUtc { get; set; } /// Soft-delete marker. public DateTimeOffset? DeletedAtUtc { get; set; } /// Members. public ICollection Memberships { get; } = []; } /// /// A user's membership of a team. /// /// /// Revoked memberships are retained rather than deleted, so historic audit entries remain /// resolvable to a person. /// public sealed class TeamMembership { /// Primary key. public Guid Id { get; set; } /// The team. public Guid TeamId { get; set; } /// The team. public Team? Team { get; set; } /// The member. public Guid UserId { get; set; } /// The member. public UserAccount? User { get; set; } /// Role within the team. public TeamRole Role { get; set; } /// Membership state. public MembershipStatus Status { get; set; } /// /// Which admin added them. /// /// /// Named for the invitations that used to be the other way in. They are gone — an account is added /// by somebody who names it, and there is no path that creates a membership out of a token's email /// claim — so this now records only that, and the column keeps its name rather than costing a /// migration to rename a field nothing reads but an audit trail. /// public Guid? InvitedByUserId { get; set; } /// When the membership became active. public DateTimeOffset? JoinedAtUtc { get; set; } /// Creation timestamp. public DateTimeOffset CreatedAtUtc { get; set; } /// Soft-delete marker. public DateTimeOffset? DeletedAtUtc { get; set; } }