corpusdb / app /relation_manager.py
mrsavage1's picture
Upload 52 files
723f9ab verified
raw
history blame contribute delete
494 Bytes
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()