< Summary

Information
Class: Syki.Back.Audit.AuditLog
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Audit/AuditLog.cs
Tag: 22_11348620282
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{
 760812    public Guid Id { get; set; }
 760813    public Guid EntityId { get; set; }
 761014    public string EntityType { get; set; }
 761015    public string Action { get; set; }
 760816    public DateTime CreatedAt { get; set; }
 760817    public Guid UserId { get; set; }
 760818    public Guid InstitutionId { get; set; }
 760719    public JsonDocument Data { get; set; }
 20
 21    public bool Fill(AuditEvent evt, EventEntry entry)
 22    {
 858123        if (evt.CustomFields.Count == 0 || evt.CustomFields.ContainsKey("Skip"))
 97424            return false;
 25
 760726        Id = Guid.NewGuid();
 760727        EntityId = Guid.Parse(entry.PrimaryKey.First().Value.ToString()!);
 760728        EntityType = entry.EntityType.Name;
 760729        Action = entry.Action;
 760730        CreatedAt = DateTime.Now;
 760731        UserId = Guid.Parse(evt.CustomFields["UserId"].ToString()!);
 760732        InstitutionId = Guid.Parse(evt.CustomFields["InstitutionId"].ToString()!);
 760733        Data = AuditData.NewAsJson(entry);
 34
 760735        return true;
 36    }
 37}