merge: web admin after the visual, accessibility and RTL review (dark theme, plurals, audit filters)
This commit is contained in:
22 files changed
+1192
-437
No files matched your search
@@ -20,13 +20,19 @@ public sealed class AuditRepository
|
||||
public Task<Page<AuditEntry>> ListAsync(Guid? userId = null, int limit = 100, string? cursor = null, CancellationToken cancellationToken = default) =>
|
||||
ListAsync(userId, action: null, limit, cursor, cancellationToken);
|
||||
|
||||
/// <summary>Entries newest first, optionally of one user and one action (e.g. the sign-in log).</summary>
|
||||
public Task<Page<AuditEntry>> ListAsync(Guid? userId, string? action, int limit = 100, string? cursor = null, CancellationToken cancellationToken = default)
|
||||
/// <summary>Entries newest first, optionally of one user and one action.</summary>
|
||||
public Task<Page<AuditEntry>> ListAsync(Guid? userId, string? action, int limit = 100, string? cursor = null, CancellationToken cancellationToken = default) =>
|
||||
ListByActionsAsync(userId, action is null ? [] : [action], limit, cursor, cancellationToken);
|
||||
|
||||
/// <summary>Entries newest first, optionally of one user, of any of the actions (none: all), e.g. the sign-in log with failed attempts.</summary>
|
||||
public Task<Page<AuditEntry>> ListByActionsAsync(Guid? userId, IReadOnlyCollection<string> actions, int limit = 100, string? cursor = null,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(actions);
|
||||
var p = new SqlParameters();
|
||||
var where = new List<string>();
|
||||
if (userId is { } user) where.Add($"user_id = {p.Add(user)}");
|
||||
if (action is not null) where.Add($"action = {p.Add(action)}");
|
||||
if (actions.Count > 0) where.Add($"action IN ({string.Join(", ", actions.Select(a => p.Add(a)))})");
|
||||
if (cursor is not null)
|
||||
{
|
||||
var (value, id) = Cursor.Decode("audit", cursor);
|
||||
|
||||
Reference in new issue
Block a user