< Summary - Syki

Information
Class: Syki.Back.Features.Adm.GetDomainEvent.GetDomainEventService
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Adm/GetDomainEvent/GetDomainEventService.cs
Tag: 4_16869239191
Line coverage
0%
Covered lines: 0
Uncovered lines: 9
Coverable lines: 9
Total lines: 32
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 4
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
Get()0%2040%

File(s)

/home/runner/work/syki/syki/Back/Features/Adm/GetDomainEvent/GetDomainEventService.cs

#LineLine coverage
 1using Dapper;
 2using Npgsql;
 3
 4namespace Syki.Back.Features.Adm.GetDomainEvent;
 5
 06public class GetDomainEventService(NpgsqlDataSource dataSource) : IAdmService
 7{
 8    public async Task<DomainEventOut> Get(Guid id)
 9    {
 010        await using var connection = await dataSource.OpenConnectionAsync();
 11
 12        const string sql = @"
 13            SELECT *
 14            FROM syki.domain_events
 15            WHERE id = @Id
 16        ";
 017        var evt = await connection.QueryFirstOrDefaultAsync<DomainEventOut>(sql, new{ id }) ?? new();
 18
 019        evt.EntityName = evt.Type.ToDomainEventEntityName();
 020        evt.Type = evt.Type.ToDomainEventDescription();
 21
 22        const string commandsSql = @"
 23            SELECT *
 24            FROM syki.commands
 25            WHERE event_id = @Id
 26        ";
 027        evt.Commands = (await connection.QueryAsync<DomainEventCommandOut>(commandsSql, new{ id })).ToList();
 028        evt.Commands.ForEach(x => x.Type = x.Type.ToCommandDescription());
 29
 030        return evt;
 031    }
 32}