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,50 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using RadicadeServer.API.Avatars.V2;
|
||||
using RadicadeServer.DB;
|
||||
using RadicadeServer.Extensions;
|
||||
using RadicadeServer.RecNet.Avatar;
|
||||
|
||||
namespace RadicadeServer.API.Avatars.V3;
|
||||
|
||||
[Route("api/avatar/v3")]
|
||||
[Route("econ/api/avatar/v3")]
|
||||
public class AvatarV3(RecDBContext db) : Controller
|
||||
{
|
||||
[HttpGet("saved"), Authorize]
|
||||
public async Task<List<Outfit>> GetSavedOutfits()
|
||||
{
|
||||
var userId = User.GetUserId();
|
||||
if (userId == null) return new List<Outfit>();
|
||||
|
||||
return await SavedOutfits.GetAsync(db, userId.Value);
|
||||
}
|
||||
|
||||
[HttpGet("saved/{accountId:long}"), Authorize]
|
||||
public async Task<List<Outfit>> GetSavedOutfitsForAccount(long accountId)
|
||||
{
|
||||
return await SavedOutfits.GetAsync(db, accountId);
|
||||
}
|
||||
|
||||
[HttpPost("saved/set"), Authorize]
|
||||
public async Task<IActionResult> SetSavedOutfit([FromBody] Outfit? outfit)
|
||||
{
|
||||
var userId = User.GetUserId();
|
||||
if (userId == null) return Unauthorized();
|
||||
|
||||
var saved = await SavedOutfits.SaveAsync(db, userId.Value, outfit);
|
||||
if (saved == null) return BadRequest(new { error = "invalid_slot" });
|
||||
|
||||
return Ok(saved);
|
||||
}
|
||||
|
||||
[HttpPost("gifts/generate"), Authorize]
|
||||
public Task<IActionResult> GenerateGift()
|
||||
{
|
||||
var compatibilityController = new AvatarV2(db)
|
||||
{
|
||||
ControllerContext = ControllerContext
|
||||
};
|
||||
return compatibilityController.GenerateGift();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user