feat: return reports in audit log entries

This commit is contained in:
sam 2024-12-27 13:21:02 -05:00
parent 53006ea313
commit dc9c11ec52
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
5 changed files with 61 additions and 5 deletions

View file

@ -46,12 +46,26 @@ public class ModerationRendererService(
public AuditLogResponse RenderAuditLogEntry(AuditLogEntry entry)
{
PartialReport? report = null;
if (entry.Report != null)
{
report = new PartialReport(
entry.Report.Id,
entry.Report.ReporterId,
entry.Report.TargetUserId,
entry.Report.TargetMemberId,
entry.Report.Reason,
entry.Report.Context,
entry.Report.TargetType
);
}
return new AuditLogResponse(
Id: entry.Id,
Moderator: ToEntity(entry.ModeratorId, entry.ModeratorUsername)!,
TargetUser: ToEntity(entry.TargetUserId, entry.TargetUsername),
TargetMember: ToEntity(entry.TargetMemberId, entry.TargetMemberName),
ReportId: entry.ReportId,
Report: report,
Type: entry.Type,
Reason: entry.Reason,
ClearedFields: entry.ClearedFields