diff --git a/__pycache__/main.cpython-311.pyc b/__pycache__/main.cpython-311.pyc index d9a846e..2af41fe 100644 Binary files a/__pycache__/main.cpython-311.pyc and b/__pycache__/main.cpython-311.pyc differ diff --git a/main.py b/main.py index 0d5f1dc..c805534 100644 --- a/main.py +++ b/main.py @@ -85,16 +85,15 @@ async def sync_state_from_file(path: Path, kind: str): # ----------------------------- @app.post("/api/populate_friendly") async def api_populate_friendly(data: FactionRequest): - # call the Torn populater (should write data/friendly_faction.json) await populate_friendly(data.faction_id) # sync STATE from file - await sync_state_from_file(Path("data/friendly_faction.json"), "friendly") + await sync_state_from_file(Path("data/friendly_members.json"), "friendly") return {"status": "friendly populated", "id": data.faction_id} @app.post("/api/populate_enemy") async def api_populate_enemy(data: FactionRequest): await populate_enemy(data.faction_id) - await sync_state_from_file(Path("data/enemy_faction.json"), "enemy") + await sync_state_from_file(Path("data/enemy_memberes.json"), "enemy") return {"status": "enemy populated", "id": data.faction_id} # ----------------------------- @@ -121,14 +120,14 @@ async def get_friendly_members(): if STATE.friendly: return [m.model_dump() for m in STATE.friendly.values()] # fallback to file - path = Path("data/friendly_faction.json") + path = Path("data/friendly_members.json") return _load_json_list(path) @app.get("/api/enemy_members") async def get_enemy_members(): if STATE.enemy: return [m.model_dump() for m in STATE.enemy.values()] - path = Path("data/enemy_faction.json") + path = Path("data/enemy_members.json") return _load_json_list(path) # ============================= @@ -179,7 +178,7 @@ async def api_assign_member(req: AssignMemberRequest): coll = STATE.friendly if kind == "friendly" else STATE.enemy if member_id not in coll: # Try to load members from file into STATE and re-check - file_path = Path("data/friendly_faction.json") if kind == "friendly" else Path("data/enemy_faction.json") + file_path = Path("data/friendly_members.json") if kind == "friendly" else Path("data/enemy_members.json") await sync_state_from_file(file_path, kind) if member_id not in coll: raise HTTPException(status_code=404, detail="member not found") diff --git a/services/__pycache__/server_state.cpython-311.pyc b/services/__pycache__/server_state.cpython-311.pyc index 3a33c31..bd93bb2 100644 Binary files a/services/__pycache__/server_state.cpython-311.pyc and b/services/__pycache__/server_state.cpython-311.pyc differ diff --git a/services/__pycache__/torn_api.cpython-311.pyc b/services/__pycache__/torn_api.cpython-311.pyc index ea1cae7..f1e6394 100644 Binary files a/services/__pycache__/torn_api.cpython-311.pyc and b/services/__pycache__/torn_api.cpython-311.pyc differ