add tenant logic

This commit is contained in:
2024-12-15 12:28:22 +09:00
parent 2823364148
commit 39775a5179
16 changed files with 138 additions and 55 deletions

View File

@@ -1,7 +1,7 @@
from fastapi import HTTPException, status
from fastapi import HTTPException, status,Depends
import httpx
from app.db.schemas import ErrorCreate
from app.db.session import SessionLocal
from app.db.session import get_tenant_db
from app.db.crud import create_log
class APIException(Exception):
@@ -31,9 +31,9 @@ class APIException(Exception):
self.error = ErrorCreate(location=location, title=title, content=content)
super().__init__(self.error)
def writedblog(exc: APIException):
db = SessionLocal()
try:
create_log(db,exc.error)
finally:
db.close()
def writedblog(exc: APIException,db = Depends(get_tenant_db())):
#db = SessionLocal()
#try:
create_log(db,exc.error)
#finally:
#db.close()