Feat Varios 3

This commit is contained in:
2026-01-06 10:34:06 -03:00
parent 0fa77e4a98
commit 9fa21ebec3
65 changed files with 2897 additions and 373 deletions

View File

@@ -37,4 +37,19 @@ public class AuditRepository
ORDER BY a.CreatedAt DESC";
return await conn.QueryAsync<AuditLog>(sql, new { UserId = userId, Limit = limit });
}
public async Task<IEnumerable<AuditLog>> GetFilteredLogsAsync(DateTime from, DateTime to, int? userId = null)
{
using var conn = _db.CreateConnection();
var sql = @"SELECT a.*, u.Username
FROM AuditLogs a
JOIN Users u ON a.UserId = u.Id
WHERE a.CreatedAt >= @From AND a.CreatedAt <= @To";
if (userId.HasValue) sql += " AND a.UserId = @UserId";
sql += " ORDER BY a.CreatedAt DESC";
return await conn.QueryAsync<AuditLog>(sql, new { From = from, To = to, UserId = userId });
}
}