//
// Copyright (c) alveus.dev. All rights reserved. Licensed under the MIT License.
//
using Astral.ApiServer.Models;
using Astral.Services.Interfaces;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Astral.ApiServer.Controllers.V1;
///
/// User api controller.
///
[Route("api/v1/user")]
[Authorize]
public class UserApiController : BaseApiController
{
private readonly IIdentityProvider _identityProvider;
///
/// Initializes a new instance of the class.
///
/// Instance of .
public UserApiController(IIdentityProvider identityProvider)
{
_identityProvider = identityProvider;
}
///
/// Get the user's profile.
///
[HttpGet("profile")]
public IActionResult GetUserProfile()
{
var userId = _identityProvider.GetUserId();
var userName = _identityProvider.GetUserName();
return new JsonResult(new UserProfileResultModel()
{
Success = true,
AccountId = userId,
Username = userName,
XmppPassword = string.Empty,
DiscourseApiKey = string.Empty
});
}
///
/// Does nothing for now since I believe the locker feature is deprecated.
///
[HttpPost("locker")]
public IActionResult PostLocker()
{
return SuccessResult();
}
///
/// Does nothing for now since I believe the locker feature is deprecated.
///
[HttpGet("locker")]
public IActionResult GetLocker()
{
return SuccessResult();
}
}