from app.utils import read_json, write_json from pathlib import Path from app.config import settings class RelationManager: def path(self): p = Path(settings.data_root) / "cache" / "relations" / "relations.json" p.parent.mkdir(parents=True, exist_ok=True) return p def list(self): return read_json(self.path(), []) def save(self, relations): write_json(self.path(), relations) return relations relation_manager = RelationManager()