Interface ICharacterFriendService
- Namespace
- FishMMO.Database.Npgsql.Services.Interfaces
- Assembly
- FishMMO-DB.dll
Service interface for managing character friend relationships.
public interface ICharacterFriendService : ICountByKeyAction<long>, IDeleteByKeyVersionedAction<long>, IFetchCollectionByKeyAction<long, CharacterFriendData>
- Inherited Members
Remarks
Friend link deletion is expected to be version-gated via the logical Version
so stale updates are rejected and newer authoritative updates win.
Methods
DeleteAsync(long, long, long, CancellationToken)
Deletes a friend relationship for the specified character if incomingVersion is newer.
Task<DatabaseResult> DeleteAsync(long characterId, long friendCharacterId, long incomingVersion, CancellationToken cancellationToken = default)
Parameters
characterIdlongThe owning character ID.
friendCharacterIdlongThe friend character ID.
incomingVersionlongThe authoritative, monotonic version for this delete operation.
cancellationTokenCancellationTokenToken to cancel the operation.
Returns
- Task<DatabaseResult>
A DatabaseResult indicating success or failure.
IsBlockedAsync(long, long, CancellationToken)
Determines whether characterId has blocked
otherCharacterId.
Task<DatabaseResult<bool>> IsBlockedAsync(long characterId, long otherCharacterId, CancellationToken cancellationToken = default)
Parameters
characterIdlongThe character who may own a block entry.
otherCharacterIdlongThe character who may be blocked.
cancellationTokenCancellationTokenToken to cancel the operation.
Returns
- Task<DatabaseResult<bool>>
A DatabaseResult<T> that is true when an active row exists marking
otherCharacterIdas blocked bycharacterId.
Remarks
The is_blocked column has existed since the friend table was introduced and
nothing has ever read it — every block a player recorded was written and then ignored,
so blocking someone did not stop them inviting or whispering. This is the read side.
The check is deliberately one-directional: it answers "has A blocked B", so the caller
must ask it about the TARGET of an unwanted action, not about the initiator.
PersistAsync(long, long, long, bool, CancellationToken)
Persists a friend or block relationship for the specified character.
Task<DatabaseResult> PersistAsync(long characterId, long friendCharacterId, long incomingVersion, bool isBlocked, CancellationToken cancellationToken = default)
Parameters
characterIdlongThe owning character ID.
friendCharacterIdlongThe friend character ID.
incomingVersionlongThe authoritative, monotonic version for this persist operation.
isBlockedboolWhen true the relationship is a block; when false it is a friend.
cancellationTokenCancellationTokenToken to cancel the operation.
Returns
- Task<DatabaseResult>
A DatabaseResult indicating success or failure.