fix: align backend APIs and upload flow
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
using System.Text.Json;
|
||||
using IM.Admin.Services;
|
||||
using IM.InitCommon.Management;
|
||||
|
||||
namespace IM.Admin.Api;
|
||||
public static class MonitoringEndpoints
|
||||
{
|
||||
public static void MapMonitoring(this WebApplication app)
|
||||
{
|
||||
var api = app.MapGroup("/api/admin").RequireAuthorization("operate");
|
||||
api.MapGet("/health", async (HealthSampler sampler, InternalClient client, CancellationToken ct) => {
|
||||
var health = await sampler.Read(ct); JsonElement? connections = null;
|
||||
try { connections = await client.Send<JsonElement>("connector", "/internal/management/connections", ct: ct); } catch { }
|
||||
return ManagementResult.Ok(new { services = health, connections, sampledAt = DateTime.UtcNow });
|
||||
});
|
||||
api.MapGet("/storage", async (HttpContext c, InternalClient client) => ManagementResult.Ok(await client.Send<JsonElement>("file", "/internal/management/storage/summary" + c.Request.QueryString, ct: c.RequestAborted)));
|
||||
app.MapGet("/api/admin/groups/{id:guid}/members", async (Guid id, HttpContext c, InternalClient client) => ManagementResult.Ok(await client.Send<JsonElement>("group", $"/internal/management/members/{id}" + c.Request.QueryString, ct: c.RequestAborted))).RequireAuthorization();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user