Summary

Class:ProjectX.PublicApi.Actions.Signin.SigninController
Assembly:ProjectX.PublicApi
File(s):C:\private\projects\projectx\backend\src\ProjectX.PublicApi\Actions\Signin\SigninController.cs
Covered lines:19
Uncovered lines:0
Coverable lines:19
Total lines:52
Line coverage:100%

History

Metrics

MethodCyclomatic complexity  NPath complexity  Sequence coverage  Branch coverage  
.ctor(...)10100100
Post()30100100

File(s)

C:\private\projects\projectx\backend\src\ProjectX.PublicApi\Actions\Signin\SigninController.cs

#LineLine coverage
 1using System.Threading.Tasks;
 2using Microsoft.AspNetCore.Mvc;
 3using Microsoft.Extensions.Logging;
 4using ProjectX.PublicApi.Filters;
 5using ProjectX.Services;
 6
 7namespace ProjectX.PublicApi.Actions.Signin
 8{
 9    [Route("/signin")]
 10    public class SigninController : Controller
 11    {
 12        private readonly ILogger<SigninController> _logger;
 13        private readonly AuthService _authService;
 14
 115        public SigninController(
 116            ILogger<SigninController> logger,
 117            AuthService authService)
 18        {
 119            this._logger = logger;
 120            this._authService = authService;
 121        }
 22
 23        /// <summary>
 24        /// Initiates signin process, user will receive a SMS with confirmation
 25        /// code
 26        /// </summary>
 27        /// <param name="input"></param>
 28        /// <returns></returns>
 29        [HttpPost]
 30        [ValidateModel]
 31        public async Task<IActionResult> Post(
 32            [FromBody]SigninInputModel input)
 33        {
 134            this._logger.LogTrace("Start signin request");
 35
 136            var user = await this._authService.CreateUserAsync(
 137                   input.Phone,
 138                   input.ClientOS,
 139                   input.Locale);
 40
 141            var result = new SigninResultModel
 142            {
 143                UserId = user.Id
 144            };
 45
 146            this._logger.LogTrace(
 147                $"End signin request. User confirmed {user.Id}");
 48
 149            return new ObjectResult(result);
 150        }
 51    }
 52}