< Summary

Information
Class: Syki.Back.Features.Adm.SetupFeatureFlags.SetupFeatureFlagsService
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Adm/SetupFeatureFlags/SetupFeatureFlagsService.cs
Tag: 22_11348620282
Line coverage
0%
Covered lines: 0
Uncovered lines: 13
Coverable lines: 13
Total lines: 27
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 4
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%
Setup()0%2040%

File(s)

/home/runner/work/syki/syki/Back/Features/Adm/SetupFeatureFlags/SetupFeatureFlagsService.cs

#LineLine coverage
 1namespace Syki.Back.Features.Adm.SetupFeatureFlags;
 2
 03public class SetupFeatureFlagsService(SykiDbContext ctx, FeaturesSettings settings) : IAdmService
 4{
 5    public async Task Setup(SetupFeatureFlagsIn data)
 6    {
 07        var features = await ctx.FeatureFlags
 08            .Where(f => f.Id == Guid.Empty)
 09            .FirstOrDefaultAsync();
 10
 011        if (features == null)
 12        {
 013            features ??= new(data);
 014            ctx.Add(features);
 15        }
 16        else
 17        {
 018            features.Settings.SkipUserRegister = data.SkipUserRegister;
 019            features.Settings.CrossLogin = data.CrossLogin;
 20        }
 21
 022        await ctx.SaveChangesAsync();
 23
 024        settings.SkipUserRegister = features.Settings.SkipUserRegister;
 025        settings.CrossLogin = features.Settings.CrossLogin;
 026    }
 27}