Interface ISocialBoardService
- Namespace
- FishMMO.Database.Npgsql.Services.Interfaces
- Assembly
- FishMMO-DB.dll
The operator's read of the social systems: guilds, their ladders, their logs, and parties.
public interface ISocialBoardService
Remarks
A read-only service spanning six tables, separate from the per-table services the game itself uses. Those exist to serve one guild or one membership row being mutated by the player who owns it — IGuildService fetches the guild a character is in, ICharacterGuildService writes one membership. This exists to answer "what does this guild look like from outside", which is a different question with a different shape, and folding it into them would hand the game server methods for enumerating every guild on the shard that it has no business calling.
Nothing here writes. Guild and party membership is game state, owned by the scene server holding the characters: it is changed by players in the world, replicated through the update tables, and a row edited underneath a running server would be overwritten by its next save or, worse, leave the in-memory roster and the stored one disagreeing. The panel looks and does not touch, and there is no method here that could be called by mistake.
Member counts are counted in the same statement as the rows they belong to. A page of twenty-five guilds is not twenty-six round trips; the count is a correlated subquery in the page's own SELECT, and the rosters for a page of parties are one further query keyed by the IDs on that page. An empty guild and an empty party are ordinary rows and come back as rows, not as gaps.
Methods
FetchGuildAsync(long, CancellationToken)
One guild in full: the row, its rank ladder, its roster and its pending applications.
Task<DatabaseResult<GuildAdminDetail>> FetchGuildAsync(long guildId, CancellationToken cancellationToken = default)
Parameters
guildIdlongThe guild's primary key.
cancellationTokenCancellationTokenCancellation token.
Returns
Remarks
Fails with NotFound when no such guild exists, which the caller must tell apart from a guild that exists and has nobody in it. The roster is unpaged: a guild's membership is bounded by the game's own cap, and a roster split across pages could not be ordered by rank without re-reading it.
FetchGuildLogAsync(long, int, int, CancellationToken)
One guild's activity log, newest first.
Task<DatabaseResult<GuildLogPage>> FetchGuildLogAsync(long guildId, int page, int pageSize, CancellationToken cancellationToken = default)
Parameters
guildIdlongThe guild's primary key.
pageint1-based page number.
pageSizeintRows per page. Clamped by the service.
cancellationTokenCancellationTokenCancellation token.
Returns
Remarks
The log is append-only and stores character IDs; the actor and target names are resolved at read time in one further query for the IDs on the page. A guild with no log is an ordinary answer: the table only started recording when the feature landed, so an older guild can legitimately have nothing in it.
FetchPartiesAsync(long?, int, int, CancellationToken)
Live parties, newest first, each with its member count and roster.
Task<DatabaseResult<PartyAdminPage>> FetchPartiesAsync(long? worldServerId, int page, int pageSize, CancellationToken cancellationToken = default)
Parameters
worldServerIdlong?Filter to one world server, or null for all of them.
pageint1-based page number.
pageSizeintRows per page. Clamped by the service.
cancellationTokenCancellationTokenCancellation token.
Returns
Remarks
A party is a transient row: it exists while people are grouped and is deleted when the last member leaves, so this list is a snapshot of who is grouped with whom right now rather than a history. Rosters are small enough to carry inline — a party is capped at a handful of members — and come back in one query for the whole page.
SearchGuildsAsync(string, int, int, CancellationToken)
Guilds whose name starts with the given text, or every guild when it is empty.
Task<DatabaseResult<GuildAdminPage>> SearchGuildsAsync(string query, int page, int pageSize, CancellationToken cancellationToken = default)
Parameters
querystringName prefix, or null/empty for every guild.
pageint1-based page number.
pageSizeintRows per page. Clamped by the service.
cancellationTokenCancellationTokenCancellation token.
Returns
Remarks
A prefix match, against the lower-cased computed name column, so the unique index on
it does the work and nothing runs LOWER() per row. A contains-match would read
the whole table on every keystroke of a debounced search box.
Each row carries the member count and the leader. Neither is a column: the count is counted, and the leader is the member whose rank reaches the top rung of the guild's ladder — which is the test the game server itself applies, rather than a second definition of leadership that only the panel believes.