Coverage for mpcforces_extractor\api\dependencies.py: 40%

5 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-11-06 21:34 +0100

1from fastapi import Request, HTTPException 

2 

3 

4def get_db(request: Request): 

5 """ 

6 Get the database session 

7 """ 

8 if not hasattr(request.app, "db"): 

9 raise HTTPException(status_code=500, detail="Database not initialized") 

10 return request.app.db