< Summary - Syki

Information
Class: Syki.Back.Audit.AuditLog
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Audit/AuditLog.cs
Tag: 4_16869239191
Line coverage
100%
Covered lines: 19
Uncovered lines: 0
Coverable lines: 19
Total lines: 37
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Id()100%11100%
get_EntityId()100%11100%
get_EntityType()100%11100%
get_Action()100%11100%
get_CreatedAt()100%11100%
get_UserId()100%11100%
get_InstitutionId()100%11100%
get_Data()100%11100%
Fill(...)100%44100%

File(s)

/home/runner/work/syki/syki/Back/Audit/AuditLog.cs

#LineLine coverage
 1using Audit.Core;
 2using System.Text.Json;
 3using Audit.EntityFramework;
 4
 5namespace Syki.Back.Audit;
 6
 7/// <summary>
 8/// Tabela de logs de auditoria.
 9/// </summary>
 10public class AuditLog
 11{
 30012    public Guid Id { get; set; }
 30013    public Guid EntityId { get; set; }
 30414    public string EntityType { get; set; }
 30415    public string Action { get; set; }
 30016    public DateTime CreatedAt { get; set; }
 30017    public Guid UserId { get; set; }
 30018    public Guid InstitutionId { get; set; }
 29819    public JsonDocument Data { get; set; }
 20
 21    public bool Fill(AuditEvent evt, EventEntry entry)
 22    {
 30023        if (evt.CustomFields.Count == 0 || evt.CustomFields.ContainsKey("Skip"))
 224            return false;
 25
 29826        Id = Guid.CreateVersion7();
 29827        EntityId = Guid.Parse(entry.PrimaryKey.First().Value.ToString()!);
 29828        EntityType = entry.EntityType.Name;
 29829        Action = entry.Action;
 29830        CreatedAt = DateTime.UtcNow;
 29831        UserId = Guid.Parse(evt.CustomFields["UserId"].ToString()!);
 29832        InstitutionId = Guid.Parse(evt.CustomFields["InstitutionId"].ToString()!);
 29833        Data = AuditData.NewAsJson(entry);
 34
 29835        return true;
 36    }
 37}