Academatica.Api/Academatica.Api.Users/Controllers/UsersController.cs
/// <summary>
/// Endpoint used to get current user state (the amount of buoys left and the duration of a day streak).
/// </summary>
/// <param name="id">User ID.</param>
Endpoint used to get current user state (the amount of buoys left and the duration of a day streak).
Endpoint used to get current user state ( the amount of buoys left and the duration of a day streak ) .
[HttpGet]
        [Route("{id}/state")]
        public IActionResult GetUserState(Guid id)
        {
            var userStats = _academaticaDbContext.UserStats.Where(x => x.UserId == id).FirstOrDefault();
            if (userStats == null)
            {
                return NotFound("Stats entry could not be found.");
            }
            return Ok(new GetUserStatsResponseDto()
            {
                BuoysLeft = userStats.BuoysLeft,
                DaysStreak = userStats.DaysStreak
            });
        }
[ HttpGet ] [ Route ( " " ) ] public IActionResult GetUserState ( Guid id ) { var userStats = _academaticaDbContext . UserStats . Where ( x => x . UserId == id ) . FirstOrDefault ( ) ; if ( userStats == null ) { return NotFound ( " " ) ; } return Ok ( new GetUserStatsResponseDto ( ) { BuoysLeft = userStats . BuoysLeft , DaysStreak = userStats . DaysStreak } ) ; }
Endpoint used to get current user state (the amount of buoys left and the duration of a day streak).
Endpoint used to get current user state ( the amount of buoys left and the duration of a day streak ) .
id
Guid
None