6cb2fbe610
PR Checks / test-and-build (pull_request) Successful in 7m28s
Implements Issue #110: game masters can now publish sessions exclusively to a club's private showcase, gated behind a member application and approval flow. Adds a 4-state publication_mode (None/Catalog/ClubOnly/Both) replacing the binary is_public, plus a club_memberships table with Pending/Active/Rejected/Left lifecycle and partial unique index ensuring a single Active row per (group, player). Highlights - V030 migration: club_memberships, publication_mode, drop is_public, recreate partial indexes, portfolio_games gains publication_mode. - PublicationMode enum + extensions in GmRelay.Shared. - ISessionStore gains 12 membership/showcase methods; AuthorizedMembershipService owns the membership flow with GM-only approve/reject authorization. - PublicClub / PublicMasterProfile / PublicSession: member- aware queries (ClubOnly visible only to Active members). - New pages: MyClubMemberships (/profile/memberships) and ClubApplications (/group/{id}/applications). - GroupDetails and EditSession switch from a bool toggle to a 4-state publication_mode selector. - NavMenu adds Moji kluby, PublicLayout adds Kluby. Tests: 4 new test files (PublicationMode, ClubMemberships, AuthorizedMembershipService, ClubShowcaseSource) + updates to PublicClubPages, AuthorizedSessionService/Portfolio service FakeSessionStore, CampaignTemplatesNavigation. 493 tests pass. Bump version 3.6.0 -> 3.7.0 across Directory.Build.props, compose.yaml, deploy.yml, NavMenu.razor. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
45 lines
1.6 KiB
C#
45 lines
1.6 KiB
C#
namespace GmRelay.Shared.Domain;
|
|
|
|
public enum PublicationMode
|
|
{
|
|
None,
|
|
Catalog,
|
|
ClubOnly,
|
|
Both
|
|
}
|
|
|
|
public static class PublicationModeExtensions
|
|
{
|
|
public const string NoneValue = nameof(PublicationMode.None);
|
|
public const string CatalogValue = nameof(PublicationMode.Catalog);
|
|
public const string ClubOnlyValue = nameof(PublicationMode.ClubOnly);
|
|
public const string BothValue = nameof(PublicationMode.Both);
|
|
|
|
public static bool IsVisibleInCatalog(this PublicationMode mode) =>
|
|
mode is PublicationMode.Catalog or PublicationMode.Both;
|
|
|
|
public static bool IsVisibleToClubMembers(this PublicationMode mode) =>
|
|
mode is PublicationMode.ClubOnly or PublicationMode.Both;
|
|
|
|
public static string ToDatabaseValue(this PublicationMode mode) =>
|
|
mode switch
|
|
{
|
|
PublicationMode.None => NoneValue,
|
|
PublicationMode.Catalog => CatalogValue,
|
|
PublicationMode.ClubOnly => ClubOnlyValue,
|
|
PublicationMode.Both => BothValue,
|
|
_ => throw new ArgumentOutOfRangeException(nameof(mode), mode, "Unknown publication mode.")
|
|
};
|
|
|
|
public static PublicationMode FromDatabaseValue(string? value) =>
|
|
value switch
|
|
{
|
|
null or "" => PublicationMode.None,
|
|
NoneValue => PublicationMode.None,
|
|
CatalogValue => PublicationMode.Catalog,
|
|
ClubOnlyValue => PublicationMode.ClubOnly,
|
|
BothValue => PublicationMode.Both,
|
|
_ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown publication mode.")
|
|
};
|
|
}
|