< Summary - Estud

Information
Class: Estud.Back.Features.Webhooks.GetWebhookCalls.GetWebhookCallsService
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Webhooks/GetWebhookCalls/GetWebhookCallsService.cs
Tag: 114_29044117136
Line coverage
100%
Covered lines: 19
Uncovered lines: 0
Coverable lines: 19
Total lines: 30
Line coverage: 100%
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
.ctor(...)100%11100%
Get()100%11100%

File(s)

/home/runner/work/syki/syki/Back/Features/Webhooks/GetWebhookCalls/GetWebhookCallsService.cs

#LineLine coverage
 1namespace Estud.Back.Features.Webhooks.GetWebhookCalls;
 2
 103public class GetWebhookCallsService(EstudDbContext ctx) : IEstudService
 4{
 5    public async Task<GetWebhookCallsOut> Get(GetWebhookCallsIn data)
 6    {
 107        var institutionId = ctx.RequestUser.InstitutionId;
 8
 109        var query = ctx.WebhookCalls.AsNoTracking().Where(x => x.InstitutionId == institutionId);
 10
 1011        var total = await query.CountAsync();
 12
 1013        var calls = await query
 1014            .OrderByDescending(x => x.CreatedAt)
 1015            .ThenByDescending(x => x.Id)
 1016            .Skip((data.Page - 1) * data.PageSize)
 1017            .Take(data.PageSize)
 1018            .ToListAsync();
 19
 2020        var items = calls.ConvertAll(x => x.ToGetWebhookCallsItemOut());
 21
 1022        return new GetWebhookCallsOut
 1023        {
 1024            Total = total,
 1025            Page = data.Page,
 1026            PageSize = data.PageSize,
 1027            Items = items,
 1028        };
 1029    }
 30}