Feat Varios 3
This commit is contained in:
@@ -51,10 +51,12 @@ public class ReportsController : ControllerBase
|
||||
|
||||
[HttpGet("audit")]
|
||||
[Authorize(Roles = "Admin")]
|
||||
public async Task<IActionResult> GetAuditLogs()
|
||||
public async Task<IActionResult> GetAuditLogs([FromQuery] DateTime? from, [FromQuery] DateTime? to, [FromQuery] int? userId)
|
||||
{
|
||||
// Obtenemos los últimos 100 eventos
|
||||
var logs = await _auditRepo.GetRecentLogsAsync(100);
|
||||
var start = from ?? DateTime.UtcNow.Date;
|
||||
var end = to ?? DateTime.UtcNow.AddDays(1).Date.AddSeconds(-1);
|
||||
|
||||
var logs = await _auditRepo.GetFilteredLogsAsync(start, end, userId);
|
||||
return Ok(logs);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user