< Summary - Syki

Information
Class: Syki.Back.Audit.AuditLog
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Audit/AuditLog.cs
Tag: 21_17346963026
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{
 36212    public Guid Id { get; set; }
 36213    public Guid EntityId { get; set; }
 36614    public string EntityType { get; set; }
 36615    public string Action { get; set; }
 36216    public DateTime CreatedAt { get; set; }
 36217    public Guid UserId { get; set; }
 36218    public Guid InstitutionId { get; set; }
 36019    public JsonDocument Data { get; set; }
 20
 21    public bool Fill(AuditEvent evt, EventEntry entry)
 22    {
 36223        if (evt.CustomFields.Count == 0 || evt.CustomFields.ContainsKey("Skip"))
 224            return false;
 25
 36026        Id = Guid.CreateVersion7();
 36027        EntityId = Guid.Parse(entry.PrimaryKey.First().Value.ToString()!);
 36028        EntityType = entry.EntityType.Name;
 36029        Action = entry.Action;
 36030        CreatedAt = DateTime.UtcNow;
 36031        UserId = Guid.Parse(evt.CustomFields["UserId"].ToString()!);
 36032        InstitutionId = Guid.Parse(evt.CustomFields["InstitutionId"].ToString()!);
 36033        Data = AuditData.NewAsJson(entry);
 34
 36035        return true;
 36    }
 37}