< Summary - Syki

Information
Class: Syki.Back.Features.Academic.CreateWebhookSubscription.CreateWebhookSubscriptionService
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Academic/CreateWebhookSubscription/CreateWebhookSubscriptionService.cs
Tag: 4_16869239191
Line coverage
100%
Covered lines: 8
Uncovered lines: 0
Coverable lines: 8
Total lines: 18
Line coverage: 100%
Branch coverage
87%
Covered branches: 7
Total branches: 8
Branch coverage: 87.5%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Create()87.5%88100%

File(s)

/home/runner/work/syki/syki/Back/Features/Academic/CreateWebhookSubscription/CreateWebhookSubscriptionService.cs

#LineLine coverage
 1namespace Syki.Back.Features.Academic.CreateWebhookSubscription;
 2
 103public class CreateWebhookSubscriptionService(SykiDbContext ctx) : IAcademicService
 4{
 5    public async Task<OneOf<CreateWebhookSubscriptionOut, SykiError>> Create(Guid institutionId, CreateWebhookSubscripti
 6    {
 127        if (data.Events?.Count == 0) return new InvalidWebhookEventsList();
 8
 89        if (data.AuthenticationType == WebhookAuthenticationType.ApiKey && data.ApiKey.IsEmpty())
 610            return new InvalidWebhookAuthentication();
 11
 212        var webhook = new WebhookSubscription(institutionId, data.Name, data.Url, data.Events, data.ApiKey);
 13
 214        await ctx.SaveChangesAsync(webhook);
 15
 216        return webhook.ToOut();
 1017    }
 18}