refactor(api): emit moderation events and apply account actions (#3031)

This commit is contained in:
Hampus
2026-09-29 12:24:15 +02:00
committed by GitHub
parent c488906131
commit 364084c819
385 changed files with 8994 additions and 22221 deletions
+8 -631
View File
@@ -1502,17 +1502,6 @@
"primary_key": "(ip)",
"options": ""
},
{
"name": "banned_phone_prefixes",
"columns": [
{
"name": "prefix",
"type": "text"
}
],
"primary_key": "(prefix)",
"options": ""
},
{
"name": "banned_phrases",
"columns": [
@@ -3629,17 +3618,6 @@
"primary_key": "((shard_id), index_name)",
"options": ""
},
{
"name": "disposable_email_domains",
"columns": [
{
"name": "domain",
"type": "text"
}
],
"primary_key": "(domain)",
"options": ""
},
{
"name": "dm_states",
"columns": [
@@ -5847,64 +5825,6 @@
"primary_key": "((report_id))",
"options": ""
},
{
"name": "inbound_sms_challenges",
"columns": [
{
"name": "challenge_code",
"type": "text"
},
{
"name": "user_id",
"type": "bigint"
},
{
"name": "our_number",
"type": "text"
},
{
"name": "created_at",
"type": "timestamp"
},
{
"name": "expires_at",
"type": "timestamp"
},
{
"name": "consumed_at",
"type": "timestamp"
},
{
"name": "consumed_from_phone",
"type": "text"
}
],
"primary_key": "(challenge_code)",
"options": "default_time_to_live = 900 AND gc_grace_seconds = 864000 AND compaction = {'class': 'TimeWindowCompactionStrategy', 'compaction_window_unit': 'HOURS', 'compaction_window_size': '1'}"
},
{
"name": "inbound_sms_challenges_by_user",
"columns": [
{
"name": "user_id",
"type": "bigint"
},
{
"name": "created_at",
"type": "timestamp"
},
{
"name": "challenge_code",
"type": "text"
},
{
"name": "expires_at",
"type": "timestamp"
}
],
"primary_key": "(user_id, created_at)",
"options": "CLUSTERING ORDER BY (created_at DESC) AND default_time_to_live = 900 AND gc_grace_seconds = 864000 AND compaction = {'class': 'TimeWindowCompactionStrategy', 'compaction_window_unit': 'HOURS', 'compaction_window_size': '1'}"
},
{
"name": "instance_configuration",
"columns": [
@@ -6291,37 +6211,6 @@
"primary_key": "(job_id)",
"options": "default_time_to_live = 7776000"
},
{
"name": "latest_risk_context_by_user",
"columns": [
{
"name": "user_id",
"type": "bigint"
},
{
"name": "updated_at",
"type": "timestamp"
},
{
"name": "ip",
"type": "text"
},
{
"name": "subnet",
"type": "text"
},
{
"name": "email_domain",
"type": "text"
},
{
"name": "asn",
"type": "int"
}
],
"primary_key": "(user_id)",
"options": ""
},
{
"name": "message_reactions",
"columns": [
@@ -7054,107 +6943,6 @@
"primary_key": "((user_id), created_at)",
"options": "CLUSTERING ORDER BY (created_at DESC)"
},
{
"name": "phone_lookup_cache",
"columns": [
{
"name": "phone",
"type": "text"
},
{
"name": "looked_up_at",
"type": "timestamp"
},
{
"name": "valid",
"type": "boolean"
},
{
"name": "line_type",
"type": "text"
},
{
"name": "country_code",
"type": "text"
},
{
"name": "carrier_name",
"type": "text"
},
{
"name": "sms_pumping_risk_score",
"type": "int"
}
],
"primary_key": "(phone)",
"options": "default_time_to_live = 604800 AND gc_grace_seconds = 864000 AND compaction = {'class': 'TimeWindowCompactionStrategy', 'compaction_window_unit': 'HOURS', 'compaction_window_size': '6'}"
},
{
"name": "phone_tokens",
"columns": [
{
"name": "token_",
"type": "text"
},
{
"name": "phone",
"type": "text"
},
{
"name": "user_id",
"type": "bigint"
}
],
"primary_key": "(token_)",
"options": "default_time_to_live = 2592000 AND gc_grace_seconds = 864000 AND compaction = {'class': 'TimeWindowCompactionStrategy', 'compaction_window_unit': 'DAYS', 'compaction_window_size': '1'}"
},
{
"name": "phone_verification_attempts",
"columns": [
{
"name": "attempt_id",
"type": "uuid"
},
{
"name": "created_at",
"type": "timestamp"
},
{
"name": "phone",
"type": "text"
},
{
"name": "country_code",
"type": "text"
},
{
"name": "line_type",
"type": "text"
},
{
"name": "carrier_name",
"type": "text"
},
{
"name": "sms_pumping_risk_score",
"type": "int"
},
{
"name": "verdict",
"type": "text"
},
{
"name": "reject_reason",
"type": "text"
},
{
"name": "lookup_cache_hit",
"type": "boolean"
}
],
"primary_key": "(attempt_id)",
"options": "default_time_to_live = 7776000 AND gc_grace_seconds = 864000 AND compaction = {'class': 'TimeWindowCompactionStrategy', 'compaction_window_unit': 'DAYS', 'compaction_window_size': '3'}"
},
{
"name": "pinned_dms",
"columns": [
@@ -7377,134 +7165,6 @@
"primary_key": "((user_id, guild_id), message_id)",
"options": "CLUSTERING ORDER BY (message_id DESC) AND default_time_to_live = 604800 AND gc_grace_seconds = 864000 AND compaction = {'class': 'TimeWindowCompactionStrategy', 'compaction_window_unit': 'HOURS', 'compaction_window_size': '6'}"
},
{
"name": "registration_events_by_email_domain",
"columns": [
{
"name": "email_domain",
"type": "text"
},
{
"name": "created_at",
"type": "timestamp"
},
{
"name": "user_id",
"type": "bigint"
},
{
"name": "ip",
"type": "text"
},
{
"name": "email",
"type": "text"
},
{
"name": "locale",
"type": "text"
}
],
"primary_key": "(email_domain, created_at, user_id)",
"options": "CLUSTERING ORDER BY (created_at DESC, user_id ASC) AND default_time_to_live = 2592000 AND gc_grace_seconds = 864000 AND compaction = {'class': 'TimeWindowCompactionStrategy', 'compaction_window_unit': 'DAYS', 'compaction_window_size': '1'}"
},
{
"name": "registration_events_by_ip",
"columns": [
{
"name": "ip",
"type": "text"
},
{
"name": "created_at",
"type": "timestamp"
},
{
"name": "user_id",
"type": "bigint"
},
{
"name": "email",
"type": "text"
},
{
"name": "email_domain",
"type": "text"
},
{
"name": "locale",
"type": "text"
}
],
"primary_key": "(ip, created_at, user_id)",
"options": "CLUSTERING ORDER BY (created_at DESC, user_id ASC) AND default_time_to_live = 2592000 AND gc_grace_seconds = 864000 AND compaction = {'class': 'TimeWindowCompactionStrategy', 'compaction_window_unit': 'DAYS', 'compaction_window_size': '1'}"
},
{
"name": "registration_events_by_plus_address_base",
"columns": [
{
"name": "plus_address_base",
"type": "text"
},
{
"name": "created_at",
"type": "timestamp"
},
{
"name": "user_id",
"type": "bigint"
},
{
"name": "ip",
"type": "text"
},
{
"name": "email",
"type": "text"
},
{
"name": "locale",
"type": "text"
}
],
"primary_key": "(plus_address_base, created_at, user_id)",
"options": "CLUSTERING ORDER BY (created_at DESC, user_id ASC) AND default_time_to_live = 2592000 AND gc_grace_seconds = 864000 AND compaction = {'class': 'TimeWindowCompactionStrategy', 'compaction_window_unit': 'DAYS', 'compaction_window_size': '1'}"
},
{
"name": "registration_events_by_subnet",
"columns": [
{
"name": "subnet",
"type": "text"
},
{
"name": "created_at",
"type": "timestamp"
},
{
"name": "user_id",
"type": "bigint"
},
{
"name": "ip",
"type": "text"
},
{
"name": "email",
"type": "text"
},
{
"name": "email_domain",
"type": "text"
},
{
"name": "locale",
"type": "text"
}
],
"primary_key": "(subnet, created_at, user_id)",
"options": "CLUSTERING ORDER BY (created_at DESC, user_id ASC) AND default_time_to_live = 2592000 AND gc_grace_seconds = 864000 AND compaction = {'class': 'TimeWindowCompactionStrategy', 'compaction_window_unit': 'DAYS', 'compaction_window_size': '1'}"
},
{
"name": "relationships",
"columns": [
@@ -7575,204 +7235,6 @@
"primary_key": "((target_user_id), source_user_id, type)",
"options": "CLUSTERING ORDER BY (source_user_id ASC, type ASC)"
},
{
"name": "risk_assessments",
"columns": [
{
"name": "assessment_id",
"type": "uuid"
},
{
"name": "created_at",
"type": "timestamp"
},
{
"name": "user_id",
"type": "bigint"
},
{
"name": "ip",
"type": "text"
},
{
"name": "email",
"type": "text"
},
{
"name": "locale",
"type": "text"
},
{
"name": "risk_level",
"type": "text"
},
{
"name": "risk_score",
"type": "int"
},
{
"name": "suspicious",
"type": "boolean"
},
{
"name": "method",
"type": "text"
},
{
"name": "recommended_action",
"type": "text"
},
{
"name": "reasoning",
"type": "text"
},
{
"name": "signals_json",
"type": "text"
},
{
"name": "model_used",
"type": "text"
}
],
"primary_key": "(assessment_id)",
"options": ""
},
{
"name": "risk_assessments_by_user",
"columns": [
{
"name": "user_id",
"type": "bigint"
},
{
"name": "created_at",
"type": "timestamp"
},
{
"name": "assessment_id",
"type": "uuid"
},
{
"name": "risk_level",
"type": "text"
},
{
"name": "risk_score",
"type": "int"
}
],
"primary_key": "(user_id, created_at)",
"options": "CLUSTERING ORDER BY (created_at DESC)"
},
{
"name": "risk_outcomes_by_asn",
"columns": [
{
"name": "asn",
"type": "int"
},
{
"name": "created_at",
"type": "timestamp"
},
{
"name": "user_id",
"type": "bigint"
},
{
"name": "outcome_code",
"type": "text"
},
{
"name": "source",
"type": "text"
}
],
"primary_key": "(asn, created_at, user_id, outcome_code)",
"options": "CLUSTERING ORDER BY (created_at DESC, user_id ASC, outcome_code ASC) AND default_time_to_live = 15552000 AND gc_grace_seconds = 864000 AND compaction = {'class': 'TimeWindowCompactionStrategy', 'compaction_window_unit': 'DAYS', 'compaction_window_size': '7'}"
},
{
"name": "risk_outcomes_by_email_domain",
"columns": [
{
"name": "email_domain",
"type": "text"
},
{
"name": "created_at",
"type": "timestamp"
},
{
"name": "user_id",
"type": "bigint"
},
{
"name": "outcome_code",
"type": "text"
},
{
"name": "source",
"type": "text"
}
],
"primary_key": "(email_domain, created_at, user_id, outcome_code)",
"options": "CLUSTERING ORDER BY (created_at DESC, user_id ASC, outcome_code ASC) AND default_time_to_live = 15552000 AND gc_grace_seconds = 864000 AND compaction = {'class': 'TimeWindowCompactionStrategy', 'compaction_window_unit': 'DAYS', 'compaction_window_size': '7'}"
},
{
"name": "risk_outcomes_by_ip",
"columns": [
{
"name": "ip",
"type": "text"
},
{
"name": "created_at",
"type": "timestamp"
},
{
"name": "user_id",
"type": "bigint"
},
{
"name": "outcome_code",
"type": "text"
},
{
"name": "source",
"type": "text"
}
],
"primary_key": "(ip, created_at, user_id, outcome_code)",
"options": "CLUSTERING ORDER BY (created_at DESC, user_id ASC, outcome_code ASC) AND default_time_to_live = 15552000 AND gc_grace_seconds = 864000 AND compaction = {'class': 'TimeWindowCompactionStrategy', 'compaction_window_unit': 'DAYS', 'compaction_window_size': '7'}"
},
{
"name": "risk_outcomes_by_subnet",
"columns": [
{
"name": "subnet",
"type": "text"
},
{
"name": "created_at",
"type": "timestamp"
},
{
"name": "user_id",
"type": "bigint"
},
{
"name": "outcome_code",
"type": "text"
},
{
"name": "source",
"type": "text"
}
],
"primary_key": "(subnet, created_at, user_id, outcome_code)",
"options": "CLUSTERING ORDER BY (created_at DESC, user_id ASC, outcome_code ASC) AND default_time_to_live = 15552000 AND gc_grace_seconds = 864000 AND compaction = {'class': 'TimeWindowCompactionStrategy', 'compaction_window_unit': 'DAYS', 'compaction_window_size': '7'}"
},
{
"name": "saved_messages",
"columns": [
@@ -7796,76 +7258,6 @@
"primary_key": "((user_id), message_id)",
"options": "CLUSTERING ORDER BY (message_id DESC)"
},
{
"name": "suspicious_email_domains",
"columns": [
{
"name": "domain",
"type": "text"
}
],
"primary_key": "(domain)",
"options": ""
},
{
"name": "suspicious_ips",
"columns": [
{
"name": "ip",
"type": "text"
},
{
"name": "created_at",
"type": "timestamp"
},
{
"name": "updated_at",
"type": "timestamp"
},
{
"name": "expires_at",
"type": "timestamp"
},
{
"name": "source",
"type": "text"
},
{
"name": "reason",
"type": "text"
},
{
"name": "source_user_id",
"type": "bigint"
},
{
"name": "deletion_reason_code",
"type": "int"
},
{
"name": "provider_name",
"type": "text"
},
{
"name": "asn",
"type": "int"
},
{
"name": "asn_name",
"type": "text"
},
{
"name": "asn_type",
"type": "text"
},
{
"name": "risk_note",
"type": "text"
}
],
"primary_key": "(ip)",
"options": "default_time_to_live = 15552000 AND gc_grace_seconds = 864000 AND compaction = {'class': 'TimeWindowCompactionStrategy', 'compaction_window_unit': 'DAYS', 'compaction_window_size': '7'}"
},
{
"name": "user_connections",
"columns": [
@@ -7984,29 +7376,6 @@
"primary_key": "((user_id), event_id)",
"options": "CLUSTERING ORDER BY (event_id DESC)"
},
{
"name": "user_country_history",
"columns": [
{
"name": "user_id",
"type": "bigint"
},
{
"name": "country",
"type": "text"
},
{
"name": "first_seen_at",
"type": "timestamp"
},
{
"name": "last_seen_at",
"type": "timestamp"
}
],
"primary_key": "(user_id, country)",
"options": "default_time_to_live = 31536000 AND gc_grace_seconds = 864000 AND compaction = {'class': 'TimeWindowCompactionStrategy', 'compaction_window_unit': 'DAYS', 'compaction_window_size': '14'}"
},
{
"name": "user_dm_history",
"columns": [
@@ -8638,6 +8007,14 @@
"name": "deletion_audit_log_reason",
"type": "text"
},
{
"name": "deletion_scheduled_by",
"type": "bigint"
},
{
"name": "deletion_scheduled_at",
"type": "timestamp"
},
{
"name": "first_refund_at",
"type": "timestamp"