< Summary

Information
Class: Syki.Back.Features.Cross.SendResetPasswordToken.SendResetPasswordTokenService
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Cross/SendResetPasswordToken/SendResetPasswordTokenService.cs
Tag: 22_11348620282
Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
Total lines: 22
Line coverage: 100%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Send()50%22100%

File(s)

/home/runner/work/syki/syki/Back/Features/Cross/SendResetPasswordToken/SendResetPasswordTokenService.cs

#LineLine coverage
 1using Syki.Back.Features.Cross.CreateUser;
 2
 3namespace Syki.Back.Features.Cross.SendResetPasswordToken;
 4
 4945public class SendResetPasswordTokenService(SykiDbContext ctx, UserManager<SykiUser> userManager) : ICrossService
 6{
 7    public async Task<OneOf<SykiSuccess, SykiError>> Send(SendResetPasswordTokenIn data)
 8    {
 1919        var user = await userManager.FindByEmailAsync(data.Email);
 19110        if (user == null) return new UserNotFound();
 11
 19112        var token = await userManager.GeneratePasswordResetTokenAsync(user);
 13
 19114        var reset = new ResetPasswordToken(user.Id, token);
 19115        ctx.Add(reset);
 19116        ctx.Add(SykiTask.SendResetPasswordEmail(user.Id));
 17
 19118        await ctx.SaveChangesAsync();
 19
 19120        return new SykiSuccess();
 19121    }
 22}