Add chat service, collection clone/tier rules, social graph
SOR.Chat (new project):
- 10 WebSocket message handlers: send, get_channels, get_messages,
dm_open, friend_request, friend_respond, friend_remove, block,
unblock, get_social
- Cursor-based pagination for message history
- Block checks on DM send and dm_open
- Social graph: friends / pending requests (in+out) / blocked list
- Batch identity DB lookups for display names
Collection updates:
- clone_deck handler (copy deck + re-validate)
- Tier-chain validation: deck ArchSpirit must be Tier 1 (hard rule);
warn on Tier 2+ card without previous tier present (soft warning)
- Tier 2+ ArchSpirits now allowed in card list as ascension targets
- ValidationWarnings field added to DeckSummaryDto + DeckDetailDto
Database:
- CardDefinition.PreviousTierId self-reference FK for ascension chains
- FriendRequest + BlockedUser entities in chat schema
- ChatChannelType.System + FriendRequestStatus enum values
- Migrations: AddArchSpiritTierChain (catalog), AddSocialGraph (chat)
Admin portal:
- ChatOverview (/chat) — stats + channel list with type filter
- ChatChannelViewer (/chat/channel/{id}) — message history + system
message compose for admins
- SocialModerationPage (/chat/social) — friend/block lookup + actions
- NavMenu: Chat section with Social Graph sub-item
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -61,6 +61,16 @@ public sealed class CardDefinition
|
||||
/// <summary>Tier 1 = base form; higher tiers reached via Ascend/Transition.</summary>
|
||||
public int? Tier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// For Tier 2+ ArchSpirits: the Tier (N-1) card this ascends from.
|
||||
/// Null for Tier 1 and all non-ArchSpirit cards.
|
||||
/// Used to validate ascension chains in deck construction.
|
||||
/// </summary>
|
||||
public Guid? PreviousTierId { get; set; }
|
||||
|
||||
/// <summary>Navigation for the ascension chain (self-reference within catalog).</summary>
|
||||
public CardDefinition? PreviousTier { get; set; }
|
||||
|
||||
// ── Terramorpha-only ────────────────────────────────────────────────────
|
||||
public TerramorphaMode? TerramorphaMode { get; set; }
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace SOR.Database.Entities.Chat;
|
||||
|
||||
/// <summary>
|
||||
/// Records that one player has blocked another.
|
||||
///
|
||||
/// Effects of blocking:
|
||||
/// - Blocker cannot receive DMs from the blocked player.
|
||||
/// - Blocked player cannot send DMs to the blocker.
|
||||
/// - Existing friendship (if any) is dissolved when a block is created.
|
||||
/// - Blocked player cannot send friend requests to the blocker.
|
||||
///
|
||||
/// Cross-schema: both Guids have no EF FK to identity.accounts.
|
||||
/// </summary>
|
||||
public sealed class BlockedUser
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
/// <summary>The player who performed the block.</summary>
|
||||
public Guid BlockerAccountId { get; set; }
|
||||
|
||||
/// <summary>The player who was blocked.</summary>
|
||||
public Guid BlockedAccountId { get; set; }
|
||||
|
||||
public DateTimeOffset BlockedAt { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
namespace SOR.Database.Entities.Chat;
|
||||
|
||||
using SOR.Database.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// A friend request from one player to another.
|
||||
///
|
||||
/// Once accepted, the row stays with Status = Accepted — this is the
|
||||
/// canonical record of friendship. To check if two players are friends:
|
||||
/// SELECT 1 FROM chat.friend_requests
|
||||
/// WHERE ((requester = A AND recipient = B) OR (requester = B AND recipient = A))
|
||||
/// AND status = 'Accepted'
|
||||
///
|
||||
/// Declined requests are kept for spam-prevention (prevents immediate re-request).
|
||||
/// A player can re-request after the existing declined row is cleared by TTL/admin.
|
||||
///
|
||||
/// Cross-schema: both Guids have no EF FK to identity.accounts.
|
||||
/// </summary>
|
||||
public sealed class FriendRequest
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
public Guid RequesterAccountId { get; set; }
|
||||
public Guid RecipientAccountId { get; set; }
|
||||
|
||||
public FriendRequestStatus Status { get; set; } = FriendRequestStatus.Pending;
|
||||
|
||||
public DateTimeOffset CreatedAt { get; set; }
|
||||
public DateTimeOffset UpdatedAt { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user