- IAuditLogService + AuditLogService avec pagination et filtres - AuditLogsController: GET /api/audit-logs (resourceType, action, page) - AuditLogsPage Blazor: liste paginée avec filtres + coloration par action - Lien vers le journal dans le menu Admin (visible pour les Admins)
30 lines
955 B
C#
30 lines
955 B
C#
using Heimdall.Application.DTOs;
|
|
using Heimdall.Application.Services;
|
|
using Heimdall.Infrastructure.Security;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Heimdall.Api.Controllers;
|
|
|
|
[ApiController]
|
|
[Route("api/audit-logs")]
|
|
[Authorize(AuthenticationSchemes = "JwtBearer", Policy = AppPermissions.AdminManage)]
|
|
public class AuditLogsController : ControllerBase
|
|
{
|
|
private readonly IAuditLogService _auditLogService;
|
|
|
|
public AuditLogsController(IAuditLogService auditLogService) => _auditLogService = auditLogService;
|
|
|
|
[HttpGet]
|
|
public async Task<IActionResult> List(
|
|
[FromQuery] string? resourceType,
|
|
[FromQuery] string? action,
|
|
[FromQuery] int page = 1,
|
|
[FromQuery] int pageSize = 20,
|
|
CancellationToken ct = default)
|
|
{
|
|
var result = await _auditLogService.ListAsync(resourceType, action, page, pageSize, ct);
|
|
return Ok(result.Data);
|
|
}
|
|
}
|