Academatica.Api/Academatica.Api.Users/Controllers/UsersController.cs
/// <summary>
/// Endpoint used to get a list of user's achievements.
/// </summary>
/// <param name="id">User ID.</param>
Endpoint used to get a list of user's achievements.
Endpoint used to get a list of user ' s achievements .
[HttpGet]
        [Route("{id}/achievements")]
        public IActionResult GetUserAchievements(Guid id)
        {
            var user = _academaticaDbContext.Users.Where(x => x.Id == id).FirstOrDefault();
            if (user == null)
            {
                return NotFound("Invalid user ID.");
            }
            return Ok(new GetUserAchievementsResponseDto()
            {
                Achievements = _achievementsManager.GetUserAchievements(id).Select(x => new AchievementDto()
                {
                    Name = x.Name,
                    Description = x.Description,
                    ImageUrl = x.ImageUrl,
                    AchievedAmount = x.AchievedAmount
                })
            });
        }
[ HttpGet ] [ Route ( " " ) ] public IActionResult GetUserAchievements ( Guid id ) { var user = _academaticaDbContext . Users . Where ( x => x . Id == id ) . FirstOrDefault ( ) ; if ( user == null ) { return NotFound ( " " ) ; } return Ok ( new GetUserAchievementsResponseDto ( ) { Achievements = _achievementsManager . GetUserAchievements ( id ) . Select ( x => new AchievementDto ( ) { Name = x . Name , Description = x . Description , ImageUrl = x . ImageUrl , AchievedAmount = x . AchievedAmount } ) } ) ; }
Endpoint used to get a list of user's achievements.
Endpoint used to get a list of user ' s achievements .
id
Guid
None