< Summary

Information
Class: Elsa.Tenants.Endpoints.Tenants.Delete.Endpoint
Assembly: Elsa.Tenants
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Tenants/Endpoints/Tenants/Delete/Endpoint.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 12
Coverable lines: 12
Total lines: 29
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
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%
Configure()100%210%
HandleAsync()0%620%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Tenants/Endpoints/Tenants/Delete/Endpoint.cs

#LineLine coverage
 1using Elsa.Authorization;
 2using Elsa.Abstractions;
 3using Elsa.Common.Multitenancy;
 4
 5namespace Elsa.Tenants.Endpoints.Tenants.Delete;
 6
 07public class Endpoint(ITenantService tenantService, ITenantStore store) : ElsaEndpointWithoutRequest<Tenant>
 8{
 9    public override void Configure()
 10    {
 011        Delete("/tenants/{id}");
 012        RequirePermission(Elsa.Tenants.Permissions.TenantPermissions.Tenants, CoreVerbs.Delete);
 013    }
 14
 15    public override async Task HandleAsync(CancellationToken ct)
 16    {
 017        var id = Route<string>("id")!;
 018        var found = await store.DeleteAsync(id, ct);
 19
 020        if (!found)
 21        {
 022            await Send.NotFoundAsync(ct);
 023            return;
 24        }
 25
 026        await tenantService.RefreshAsync(ct);
 027        await Send.OkAsync(cancellation: ct);
 028    }
 29}