removed unnessesary features

This commit is contained in:
2026-04-27 19:31:16 +02:00
parent 1b24d484af
commit 0d7a877584
5 changed files with 14 additions and 20 deletions

View File

@@ -34,11 +34,22 @@ async def health():
@app.post("/api/log")
async def ingest_event(payload: Event | BatchEvents, game: str = Depends(verify_api_key)):
def check_event(e: Event):
if not e.type or not e.type.strip():
raise HTTPException(400, "Event type is required")
if not e.serverId:
raise HTTPException(400, "serverId is required")
if e.time <= 0:
raise HTTPException(400, "Invalid timestamp")
# Optionally refuse huge data (e.g., >1KB per event)
if isinstance(payload, BatchEvents):
for event in payload.events:
check_event(event)
enriched = enrich_event(event, game)
write_event(enriched)
else:
check_event(payload)
enriched = enrich_event(payload, game)
write_event(enriched)
return {"success": True}