using Galaeth.Core.Dtos; using Galaeth.Services.Interfaces; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace Galaeth.ApiServer.Controllers; /// /// Api methods for the requesting authorised user. /// [ApiController] [Authorize] [Route("v1/me")] public class MeController : ApiController { private readonly IIdentityProvider _identityProvider; private readonly IUserService _userService; /// /// Initializes a new instance of the class. /// /// Instance of . /// Instance of . public MeController( IIdentityProvider identityProvider, IUserService userService) { _identityProvider = identityProvider; _userService = userService; } /// /// Get the requesting user information and return it. /// /// Instance of . [HttpGet] public async Task GetMe() { var userId = _identityProvider.GetRequestingUserId(); var user = await _userService.FindById(userId); return SuccessResult(user); } }