Radicade Public Code

This commit is contained in:
JogmansonReal
2026-10-16 23:33:13 -07:00
commit 55175acdf6
832 changed files with 363261 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using RadicadeServer.DB;
using RadicadeServer.Extensions;
namespace RadicadeServer.Clubs;
[Route("clubs")]
[Route("api/clubs/v1")]
[Route("api/clubs/v2")]
public class ClubsSearchAPI : Controller
{
private readonly RecDBContext db;
public ClubsSearchAPI(RecDBContext db)
{
this.db = db;
}
private long ViewerId => User.GetUserId() ?? 0;
[HttpGet("search/mostactivenow"), Authorize]
[HttpGet("mostactivenow"), Authorize]
public async Task<IActionResult> GetMostActiveClubs([FromQuery] int skip = 0, [FromQuery] int take = 30)
{
var clubs = await ClubStore.LoadAsync(db);
clubs = ClubStore.FilterByCategory(clubs, ClubStore.CategoryFilter(Request.Query));
var items = clubs
.Skip(Math.Max(0, skip))
.Take(Math.Max(1, take))
.Select(x => ClubStore.BuildClub(x, ViewerId))
.ToArray();
return Ok(items);
}
}