< Summary - Heimdall API

Information
Class: ArturRios.Heimdall.WebApi.Controllers.AuditController
Assembly: ArturRios.Heimdall.WebApi
File(s): /home/runner/work/heimdall-api/heimdall-api/src/Presentation/ArturRios.Heimdall.WebApi/Controllers/AuditController.cs
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 42
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
100%
Covered methods: 2
Fully covered methods: 2
Total methods: 2
Method coverage: 100%
Full method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
List()100%11100%

File(s)

/home/runner/work/heimdall-api/heimdall-api/src/Presentation/ArturRios.Heimdall.WebApi/Controllers/AuditController.cs

#LineLine coverage
 1using ArturRios.Heimdall.Domain.Enums;
 2using ArturRios.Heimdall.Query.Input;
 3using ArturRios.Heimdall.Query.Output;
 4using ArturRios.Heimdall.Shared.Messages;
 5using ArturRios.Heimdall.WebApi.Security;
 6using ArturRios.Mediator.Query;
 7using ArturRios.Output;
 8using ArturRios.Util.WebApi.AspNetCore;
 9using ArturRios.Util.WebApi.Security.Attributes;
 10using Microsoft.AspNetCore.Mvc;
 11
 12namespace ArturRios.Heimdall.WebApi.Controllers;
 13
 14[Route("api/audit-log")]
 2015public class AuditController(QueryMediator queryMediator) : Controller
 16{
 17    /// <summary>
 18    ///     Lists the audit trail (UC-48, FR-AT-01/02), newest first. System Admin only. Every filter is
 19    ///     optional and they combine: <c>from</c>/<c>to</c> bound when an entry was recorded (UTC,
 20    ///     inclusive), <c>actorId</c> and <c>targetId</c> are public ids, <c>action</c> is the exact
 21    ///     command type name (e.g. <c>CreateScopeCommand</c>), and <c>succeeded=false</c> lists only
 22    ///     refusals.
 23    /// </summary>
 24    /// <remarks>
 25    ///     Entries are shown as stored. An actor the retention pass has cleared (NFR-21) is
 26    ///     <c>null</c> and is never reconstructed, so filtering by <c>actorId</c> cannot find entries
 27    ///     whose attribution has been cleared. A Scope Admin is refused: the trail has no scope
 28    ///     column, and an old entry's target may be gone, so it cannot be divided by scope reliably.
 29    ///     Reading the trail is not itself audited.
 30    /// </remarks>
 31    [HttpGet]
 32    [RoleRequirement((int)Roles.SystemAdmin)]
 33    public async Task<ActionResult<PaginatedOutput<AuditLogEntryOutput>>> List([FromQuery] ListAuditLogQuery query)
 34    {
 1735        HttpContext.ApplyActor(query);
 36
 1737        var result = await queryMediator
 1738            .ExecutePaginatedQueryAsync<ListAuditLogQuery, AuditLogEntryOutput>(query);
 39
 1740        return result.ToActionResult(statusMap: AuditMessageMap.StatusCodes);
 1741    }
 42}