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> 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)); } } }