< Summary - Syki

Information
Class: Syki.Back.Audit.AuditTrail
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Audit/AuditTrail.cs
Tag: 56_26538939494
Line coverage
95%
Covered lines: 19
Uncovered lines: 1
Coverable lines: 20
Total lines: 44
Line coverage: 95%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

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

File(s)

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

#LineLine coverage
 1using Audit.Core;
 2using System.Text.Json;
 3using Audit.EntityFramework;
 4
 5namespace Syki.Back.Audit;
 6
 7/// <summary>
 8/// Guarda os dados de auditoria de uma entidade.
 9/// </summary>
 10public class AuditTrail
 11{
 012    public int Id { get; set; }
 13
 138614    public string ActivityId { get; set; }
 138615    public string Operation { get; set; }
 16
 138617    public string EntityId { get; set; }
 138618    public string EntityType { get; set; }
 19
 138620    public int UserId { get; set; }
 138621    public int InstitutionId { get; set; }
 22
 138623    public string Action { get; set; }
 138624    public DateTime CreatedAt { get; set; }
 138625    public JsonDocument Data { get; set; }
 26
 27    public bool Fill(AuditEvent evt, EventEntry entry)
 28    {
 138629        ActivityId = evt.ActivityId;
 138630        Operation = evt.Operation;
 31
 138632        EntityId = entry.PrimaryKey.First().Value.ToString()!;
 138633        EntityType = entry.EntityType.Name;
 34
 138635        UserId = evt.UserId;
 138636        InstitutionId = evt.InstitutionId;
 37
 138638        Action = entry.Action;
 138639        CreatedAt = DateTime.UtcNow;
 138640        Data = AuditData.NewAsJson(entry);
 41
 138642        return true;
 43    }
 44}