MegaAntiCheat / masterbase

API/Data Platform for Ingesting, Storing, and Serving Data through Postgres, and Litestar
11 stars 1 forks source link

chore(posts): data/body -> pydantic models + list_demos for non-analysts #61

Closed jayceslesar closed 3 months ago

jayceslesar commented 3 months ago

Litestar rocks because previously these would give a nasty error on both server and client with keyerrors/bad request but with the pydantic models I get a beautiful

{'status_code': 400, 'detail': 'Validation failed for POST /report?api_key=some_key', 'extra': [{'message': 'Field required', 'key': 'target_steam_id'}]}

Also slightly rework the list_demos endpoint to allow one for analysts and for anyone who isn't an analyst to retrieve their own demo sessions.

Also fixes valid_session_guard to work for non-SDR servers

Also adds primary key to reports table to prevent duplicate reports on the same session