feat: add points risk report

This commit is contained in:
Codex
2026-06-30 15:12:32 +08:00
parent a5a2caa2e9
commit 87f4cf9c4e
15 changed files with 522 additions and 25 deletions

View File

@@ -0,0 +1,13 @@
create index if not exists idx_score_events_tenant_created_user_negative
on public.user_score_events(tenant_id, created_at desc, user_id)
where points < 0;
create index if not exists idx_score_events_tenant_created_abs_points
on public.user_score_events(tenant_id, created_at desc, (abs(points)) desc);
create index if not exists idx_point_activity_claims_tenant_claimed_user
on public.user_point_activity_claims(tenant_id, claimed_at desc, user_id)
where status = 'claimed';
create index if not exists idx_point_exchange_orders_tenant_exchanged_user
on public.user_point_exchange_orders(tenant_id, exchanged_at desc, user_id);