Reports and statistics answer in ClientModels' shapes
The moderators' reports and the admin statistics (overview, hosts, crawler) were anonymous objects, so a client could read them only as loose JSON. They are now ViewReport, ViewStatisticsOverview, ViewHostsPage and ViewCrawler in PrivaPub.ClientModels, with the same JSON as before, for decePub's Administration page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
This commit is contained in:
1 parent
b146e182c6
commit
ea5e607779
4 files changed
+145
-26
No files matched your search
@@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using MongoDB.Entities;
|
||||
|
||||
using PrivaPub.ClientModels;
|
||||
using PrivaPub.ClientModels.Admin;
|
||||
using PrivaPub.Extensions;
|
||||
using PrivaPub.Models.Social;
|
||||
|
||||
@@ -17,20 +18,20 @@ namespace PrivaPub.Controllers.ClientToServer
|
||||
[HttpGet, Route("/clientapi/moderator/reports")]
|
||||
public async Task<IActionResult> Reports([FromQuery] bool resolved, CancellationToken token) =>
|
||||
Ok((await DB.Default.Find<Report>().Match(r => r.IsResolved == resolved).Sort(r => r.ID, Order.Descending).Limit(100).ExecuteAsync(token))
|
||||
.Select(r => new
|
||||
.Select(r => new ViewReport
|
||||
{
|
||||
r.ID,
|
||||
ID = r.ID,
|
||||
Reporter = r.ReporterAvatarId != default ? "local" : r.ReporterActorURI,
|
||||
r.TargetAccountId,
|
||||
r.TargetActorURI,
|
||||
r.PostIds,
|
||||
r.ObjectURIs,
|
||||
r.Category,
|
||||
r.Comment,
|
||||
r.Forwarded,
|
||||
r.IsResolved,
|
||||
r.CreatedAt,
|
||||
r.ResolvedAt
|
||||
TargetAccountId = r.TargetAccountId,
|
||||
TargetActorURI = r.TargetActorURI,
|
||||
PostIds = r.PostIds,
|
||||
ObjectURIs = r.ObjectURIs,
|
||||
Category = r.Category,
|
||||
Comment = r.Comment,
|
||||
Forwarded = r.Forwarded,
|
||||
IsResolved = r.IsResolved,
|
||||
CreatedAt = r.CreatedAt,
|
||||
ResolvedAt = r.ResolvedAt
|
||||
}));
|
||||
|
||||
[HttpPost, Route("/clientapi/moderator/reports/{id}/resolve")]
|
||||
|
||||
Reference in new issue
Block a user