mirror of
https://github.com/JogmansonReal/Radicade.git
synced 2026-10-25 15:09:26 -07:00
27 lines
852 B
C#
27 lines
852 B
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using RadicadeServer.DB;
|
|
using RadicadeServer.Extensions;
|
|
using RadicadeServer.RecNet.Progression;
|
|
using RadicadeServer.RecNet.Royale;
|
|
|
|
namespace RadicadeServer.API.Royale.V1
|
|
{
|
|
[Route("api/royale/v1")]
|
|
public class RoyaleV1(RecDBContext db) : Controller
|
|
{
|
|
[HttpGet("current"), Authorize]
|
|
public async Task<ActionResult<RoyaleProgressDTO>> GetCurrentProgress()
|
|
{
|
|
var userId = User.GetUserId();
|
|
if (userId == null) return Unauthorized();
|
|
|
|
var data = await db.Progression.FirstOrDefaultAsync(x => x.PlayerId == userId.Value);
|
|
data ??= new ProgressionData { PlayerId = userId.Value };
|
|
|
|
return Ok(RoyaleShared.BuildProgress(data));
|
|
}
|
|
}
|
|
}
|