mirror of
https://github.com/JogmansonReal/Radicade.git
synced 2026-10-25 23:18:56 -07:00
Radicade Public Code
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using RadicadeServer.DB;
|
||||
using RadicadeServer.RecNet.Store;
|
||||
using RadicadeServer.Utils;
|
||||
|
||||
namespace RadicadeServer.Admin;
|
||||
|
||||
[Route("admin/store")]
|
||||
[EnableCors("AdminPanel")]
|
||||
public class AdminStorefrontsAPI(RecDBContext db) : Controller
|
||||
{
|
||||
private Task<IActionResult?> RejectInvalidKey(string key)
|
||||
{
|
||||
return Task.FromResult<IActionResult?>(key.IsAdminKey() ? null : Unauthorized("Invalid secret"));
|
||||
}
|
||||
|
||||
[HttpGet("{key}/itemset/{itemSetId}")]
|
||||
public async Task<IActionResult> GetItemSet(string key, long itemSetId)
|
||||
{
|
||||
var rejection = await RejectInvalidKey(key);
|
||||
if (rejection != null) return rejection;
|
||||
|
||||
return Ok("Item sets not implemented for GiftDropDB.");
|
||||
}
|
||||
|
||||
[HttpGet("{key}/gift/{giftId}")]
|
||||
public async Task<IActionResult> GetGift(string key, long giftId)
|
||||
{
|
||||
var rejection = await RejectInvalidKey(key);
|
||||
if (rejection != null) return rejection;
|
||||
|
||||
var gift = await db.GiftItems.FirstOrDefaultAsync(x => x.GiftDropId == giftId);
|
||||
if (gift == null) return Ok("Not found.");
|
||||
|
||||
return Ok(gift);
|
||||
}
|
||||
|
||||
[HttpGet("{key}/gift/{giftId}/set")]
|
||||
public async Task<ActionResult> SetGift()
|
||||
{
|
||||
return Ok("todo.");
|
||||
}
|
||||
|
||||
[HttpGet("{key}/gift/new")]
|
||||
public async Task<ActionResult> CreateGift()
|
||||
{
|
||||
return Ok("todo.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user