< Summary - Syki

Information
Class: Syki.Back.Features.Identity.GetRole.GetRoleService
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Identity/GetRole/GetRoleService.cs
Tag: 97_27801654829
Line coverage
0%
Covered lines: 0
Uncovered lines: 13
Coverable lines: 13
Total lines: 20
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%
Get()0%620%

File(s)

/home/runner/work/syki/syki/Back/Features/Identity/GetRole/GetRoleService.cs

#LineLine coverage
 1namespace Syki.Back.Features.Identity.GetRole;
 2
 03public class GetRoleService(SykiDbContext ctx) : ISykiService
 4{
 5    public async Task<OneOf<GetRoleOut, SykiError>> Get(int id)
 6    {
 07        var role = await ctx.Roles.AsNoTracking()
 08            .FirstOrDefaultAsync(r => r.OwnerId == ctx.RequestUser.InstitutionId && r.Id == id);
 09        if (role == null) return RoleNotFound.I;
 10
 011        return new GetRoleOut
 012        {
 013            Id = role.Id,
 014            Name = role.Name!,
 015            Description = role.Description,
 016            BaseType = role.BaseType,
 017            Permissions = role.Permissions,
 018        };
 019    }
 20}