< Summary

Information
Class: Elsa.Tenants.Endpoints.Tenants.Get.Endpoint
Assembly: Elsa.Tenants
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Tenants/Endpoints/Tenants/Get/Endpoint.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 11
Coverable lines: 11
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/Get/Endpoint.cs

#LineLine coverage
 1using Elsa.Authorization;
 2using Elsa.Abstractions;
 3using Elsa.Common.Multitenancy;
 4using Elsa.Models;
 5
 6namespace Elsa.Tenants.Endpoints.Tenants.Get;
 7
 08public class Endpoint(ITenantService tenantService) : ElsaEndpointWithoutRequest<Tenant>
 9{
 10    public override void Configure()
 11    {
 012        Get("/tenants/{id}");
 013        RequirePermission(Elsa.Tenants.Permissions.TenantPermissions.Tenants, CoreVerbs.View);
 014    }
 15
 16    public override async Task HandleAsync(CancellationToken ct)
 17    {
 018        var id = Route<string>("id")!;
 019        var tenant = await tenantService.FindAsync(id, ct);
 20
 021        if (tenant == null)
 22        {
 023            await Send.NotFoundAsync(ct);
 024            return;
 25        }
 26
 027        await Send.OkAsync(tenant, ct);
 028    }
 29}