diff --git a/backend/db/report.go b/backend/db/report.go
index f16d1b1..3f04d4f 100644
--- a/backend/db/report.go
+++ b/backend/db/report.go
@@ -12,7 +12,9 @@ import (
type Report struct {
ID int64 `json:"id"`
UserID xid.ID `json:"user_id"`
+ UserName string `json:"user_name"`
MemberID *xid.ID `json:"member_id"`
+ MemberName *string `json:"member_name"`
Reason string `json:"reason"`
ReporterID xid.ID `json:"reporter_id"`
@@ -25,7 +27,12 @@ type Report struct {
const ReportPageSize = 100
func (db *DB) Reports(ctx context.Context, closed bool, before int) (rs []Report, err error) {
- builder := sq.Select("*").From("reports").Limit(ReportPageSize).OrderBy("id DESC")
+ builder := sq.Select("*",
+ "(SELECT username FROM users WHERE id = reports.user_id) AS user_name",
+ "(SELECT name FROM members WHERE id = reports.member_id) AS member_name").
+ From("reports").
+ Limit(ReportPageSize).
+ OrderBy("id DESC")
if before != 0 {
builder = builder.Where("id < ?", before)
}
diff --git a/frontend/src/lib/api/entities.ts b/frontend/src/lib/api/entities.ts
index b285187..3198edb 100644
--- a/frontend/src/lib/api/entities.ts
+++ b/frontend/src/lib/api/entities.ts
@@ -84,7 +84,9 @@ export interface Invite {
export interface Report {
id: string;
user_id: string;
+ user_name: string;
member_id: string | null;
+ member_name: string | null;
reason: string;
reporter_id: string;
diff --git a/frontend/src/routes/reports/+page.svelte b/frontend/src/routes/reports/+page.svelte
index 7f17dcf..1fc086e 100644
--- a/frontend/src/routes/reports/+page.svelte
+++ b/frontend/src/routes/reports/+page.svelte
@@ -1,5 +1,40 @@
+
+
{report.reason}+