Allow getting non-rich truth lists
All checks were successful
Build and Publish college-bot-v2 / build_and_publish (push) Successful in 13s

This commit is contained in:
Nexus 2024-06-05 02:17:54 +01:00
parent 65acd62d12
commit d6ee4a3639
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

@ -58,9 +58,11 @@ app = FastAPI(
@app.get("/api/truths/all") @app.get("/api/truths/all")
def get_all_truths(db: redis.Redis = Depends(get_db)): def get_all_truths(rich: bool = True, db: redis.Redis = Depends(get_db)):
"""Retrieves all stored truths""" """Retrieves all stored truths"""
keys = db.keys() keys = db.keys()
if rich is False:
return keys
truths = [json.loads(db.get(key)) for key in keys] truths = [json.loads(db.get(key)) for key in keys]
return truths return truths