mirror of
https://github.com/JogmansonReal/Radicade.git
synced 2026-10-27 07:59:03 -07:00
Radicade Public Code
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user