Class SocialBoardService
Reads guilds, rank ladders, guild logs and parties for the operator's social board.
public sealed class SocialBoardService : BaseService<GuildEntity>, ISocialBoardService
- Inheritance
-
SocialBoardService
- Implements
- Inherited Members
Remarks
EF throughout, every read AsNoTracking, and every list read runs a fixed number of
statements whatever the page size — see the interface. The one pattern worth naming: a
count that belongs to a listed row is projected into that row's own SELECT as a
correlated subquery, and anything needing a second table for a whole page is fetched once
by the IDs on the page. Neither ever becomes a query per row.
Nothing here writes, and the class exposes no method that could. See the interface for why that is a rule and not an omission.
Constructors
SocialBoardService(INpgsqlDbContextFactory)
public SocialBoardService(INpgsqlDbContextFactory dbContextFactory)
Parameters
dbContextFactoryINpgsqlDbContextFactory
Methods
FetchGuildAsync(long, CancellationToken)
One guild in full: the row, its rank ladder, its roster and its pending applications.
public 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.
public 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.
public 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.
public 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.