Files
DorkNet/DorkNet.Server/Data/Entities/RelationshipEntity.cs
T
Alexa 955246c6e4 feat: Refactor admin UI pages to support embedded mode and improve navigation
- Updated PlayerLogs, Players, Reports, Rooms, Settings, SignupCodes, and other pages to accept an optional `embedded` prop for better integration in various contexts.
- Introduced a new Activity page consolidating audit logs and player request logs with tab navigation.
- Added Content page for community board and loading tips with tab navigation.
- Created Moderation page to unify player directory, bans, and reports under a single interface.
- Implemented SettingsHome page to manage server settings and signup codes with tab navigation.
- Enhanced the Join page to include password creation for new accounts.
- Added global friends feature in Settings to allow all accounts to be friends without database entries.
- Introduced RelationshipQueries service to manage effective friend resolution based on global friends toggle.
- Added WireDates for consistent date handling in serialized data.
- Created reusable Tabs component for consistent tab navigation across various pages.
2026-06-06 16:39:19 +03:00

65 lines
2.7 KiB
C#

namespace DorkNet.Server.Data.Entities;
/// <summary>
/// Storage-side enum mirroring the int values previously hard-coded in
/// <see cref="RelationshipEntity"/>. Stays separate from the on-the-wire
/// <c>DorkNet.Models.Relationships.RelationshipStatus</c> so the contract
/// can evolve without touching the DB representation. Underlying int
/// values match — no migration data fixup needed.
/// </summary>
public enum RelationshipStatus
{
/// <summary>No friendship/block — the row exists only to hold the
/// requester's own favorite/mute/ignore preference about the target.
/// The actual relationship status (if any) lives on the paired row in
/// the other direction; the read path merges the two.</summary>
None = 0,
/// <summary>Mutual friend (both directions accepted).</summary>
Friend = 1,
/// <summary>Outgoing request from <see cref="RelationshipEntity.RequesterId"/>
/// awaiting accept/decline by <see cref="RelationshipEntity.TargetId"/>.</summary>
PendingSent = 2,
/// <summary>
/// Reserved for the receiving-side view if we later denormalise. The
/// backing column is still 1-2-4 in practice; PendingReceived is what
/// the wire DTO computes from the caller's perspective when the row's
/// PendingSent direction is "into" them.
/// </summary>
PendingReceived = 3,
/// <summary>Block held by <see cref="RelationshipEntity.RequesterId"/>
/// against <see cref="RelationshipEntity.TargetId"/>. Hides the target
/// from the requester's friend list and prevents new requests both ways.</summary>
Blocked = 4,
}
public class RelationshipEntity
{
public long Id { get; set; }
public long RequesterId { get; set; }
public long TargetId { get; set; }
public RelationshipStatus Status { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
/// <summary>True when <see cref="RequesterId"/> favorited
/// <see cref="TargetId"/>. Favorited shows up first in the friend
/// list and triggers an extra notification on "online".</summary>
public bool Favorited { get; set; }
/// <summary>True when <see cref="RequesterId"/> muted text from
/// <see cref="TargetId"/>. Drops chat-message notifications but
/// keeps the friendship intact.</summary>
public bool Muted { get; set; }
/// <summary>True when <see cref="RequesterId"/> ignored
/// <see cref="TargetId"/> (a soft block — hides the player from
/// the room browser without breaking the relationship row).</summary>
public bool Ignored { get; set; }
public PlayerEntity? Requester { get; set; }
}