2019-07-17 11:45:36 +00:00
|
|
|
using System.Threading.Tasks;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
namespace PluralKit.API.Controllers
|
|
|
|
{
|
|
|
|
[ApiController]
|
|
|
|
[Route("a")]
|
|
|
|
[Route("v1/a")]
|
|
|
|
public class AccountController: ControllerBase
|
|
|
|
{
|
2019-10-26 17:45:30 +00:00
|
|
|
private IDataStore _data;
|
2019-07-17 11:45:36 +00:00
|
|
|
|
2019-10-26 17:45:30 +00:00
|
|
|
public AccountController(IDataStore data)
|
2019-07-17 11:45:36 +00:00
|
|
|
{
|
2019-10-26 17:45:30 +00:00
|
|
|
_data = data;
|
2019-07-17 11:45:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[HttpGet("{aid}")]
|
|
|
|
public async Task<ActionResult<PKSystem>> GetSystemByAccount(ulong aid)
|
|
|
|
{
|
2019-10-26 17:45:30 +00:00
|
|
|
var system = await _data.GetSystemByAccount(aid);
|
2019-07-17 11:45:36 +00:00
|
|
|
if (system == null) return NotFound("Account not found.");
|
|
|
|
|
|
|
|
return Ok(system);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|