mirror of
https://github.com/djdevin/recflare.git
synced 2026-09-08 14:41:28 -07:00
[events] event tagging and reporting
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
-- Reporting a player EVENT (`POST /api/playerevents/v1/report`) reuses the report
|
||||
-- table rather than getting one of its own: it is the same submission with the same
|
||||
-- fields (category, free-text details, the reporter from the token) and the same
|
||||
-- moderation life — a moderator acting on it sets `banned` on the row exactly as they
|
||||
-- would for a player report. Generated from src/reports-db.ts (SCHEMA_DDL) — keep in
|
||||
-- sync.
|
||||
--
|
||||
-- `event_id` names the reported event; NULL on every ordinary player report, which is
|
||||
-- what tells the two kinds apart. The row's other columns are still filled in from the
|
||||
-- event: `reported_player_id` is its CREATOR (the person a moderator would act
|
||||
-- against — the column is NOT NULL, and "who is answerable for this event" is the only
|
||||
-- honest answer), and `room_id` the room it runs in, read from the event table so the
|
||||
-- client doesn't have to send either.
|
||||
--
|
||||
-- Partial index: event reports are a small minority of rows, so indexing only the ones
|
||||
-- that name an event keeps "reports against this event" off a full scan without paying
|
||||
-- for the NULLs.
|
||||
|
||||
ALTER TABLE report ADD COLUMN event_id INTEGER;
|
||||
CREATE INDEX IF NOT EXISTS idx_report_event ON report (event_id) WHERE event_id IS NOT NULL;
|
||||
Reference in New Issue
Block a user