FIle detail page

This commit is contained in:
2025-07-26 14:32:37 +08:00
parent f1867e7916
commit 186e9c00aa
14 changed files with 749 additions and 33 deletions

View File

@@ -0,0 +1,25 @@
using DysonNetwork.Shared.Proto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace DysonNetwork.Drive.Storage;
[ApiController]
[Route("/api/pools")]
public class FilePoolController(AppDatabase db) : ControllerBase
{
[HttpGet]
[Authorize]
public async Task<ActionResult<List<FilePool>>> ListUsablePools()
{
if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized();
var accountId = Guid.Parse(currentUser.Id);
var pools = await db.Pools
.Where(p => p.PublicUsable || p.AccountId == accountId)
.ToListAsync();
return Ok(pools);
}
}