Interface IAdminAuditService
- Namespace
- FishMMO.Database.Npgsql.Services.Interfaces
- Assembly
- FishMMO-DB.dll
The operator audit log: who did what, to what, and why.
public interface IAdminAuditService
Remarks
There is no update and no delete on this interface, and there must never be one. An audit log that can be edited is not evidence of anything. Retention, if it is ever needed, belongs in a scheduled database job that an operator cannot reach through the application, not in a method sitting next to the one that writes the rows.
Both the Control Panel and the game server's elevated chat commands write here. One log, because "show me everything this person did" must not be two queries against two logs.
Methods
AppendAsync(AdminAuditData, CancellationToken)
Records one action.
Task<DatabaseResult<long>> AppendAsync(AdminAuditData entry, CancellationToken cancellationToken = default)
Parameters
entryAdminAuditDataThe action.
OccurredUtcis filled in when left at default.cancellationTokenCancellationTokenCancellation token.
Returns
Remarks
Call this for refusals as well as successes. A log holding only what worked cannot distinguish an operator who never tried from one who tried and was stopped, and the second is the one worth knowing about.
Returns the new row's id. Callers that cannot usefully react to a failure should still check the result and log it: a write that silently did not happen is the one failure mode that makes the whole table untrustworthy.
FetchActionsAsync(CancellationToken)
The distinct action identifiers present in the log, for populating a filter.
Task<DatabaseResult<IReadOnlyList<string>>> FetchActionsAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancellation token.
Returns
Remarks
Read from the data rather than from a constant list, so an action added by a future command appears in the filter without anybody remembering to register it.
SearchAsync(AdminAuditQuery, CancellationToken)
Reads a page of the log, newest first.
Task<DatabaseResult<AdminAuditPage>> SearchAsync(AdminAuditQuery query, CancellationToken cancellationToken = default)
Parameters
queryAdminAuditQueryFilters. Every field is optional.
cancellationTokenCancellationTokenCancellation token.