bugfix get roles
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from fastapi import HTTPException, status,Depends
|
||||
import httpx
|
||||
from app.db.schemas import ErrorCreate
|
||||
from app.db.session import get_tenant_db
|
||||
from app.core.dbmanager import get_log_db
|
||||
from app.db.crud import create_log
|
||||
|
||||
class APIException(Exception):
|
||||
@@ -31,9 +31,10 @@ class APIException(Exception):
|
||||
self.error = ErrorCreate(location=location, title=title, content=content)
|
||||
super().__init__(self.error)
|
||||
|
||||
def writedblog(exc: APIException,db = Depends(get_tenant_db())):
|
||||
def writedblog(exc: APIException,):
|
||||
#db = SessionLocal()
|
||||
#try:
|
||||
create_log(db,exc.error)
|
||||
#finally:
|
||||
#db.close()
|
||||
db = get_log_db()
|
||||
try:
|
||||
create_log(db,exc.error)
|
||||
finally:
|
||||
db.close()
|
||||
@@ -2,6 +2,7 @@
|
||||
from fastapi import Depends
|
||||
from app.db.session import get_tenant_db,get_user_db
|
||||
from app.core import tenantCacheService
|
||||
from app.db.session import tenantdb
|
||||
|
||||
def get_db(tenant:str = "1",tenantdb = Depends(get_tenant_db)):
|
||||
db_url = tenantCacheService.get_tenant_db(tenantdb,tenant)
|
||||
@@ -10,3 +11,8 @@ def get_db(tenant:str = "1",tenantdb = Depends(get_tenant_db)):
|
||||
yield db
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
|
||||
def get_log_db():
|
||||
db = tenantdb.get_db()
|
||||
return db
|
||||
Reference in New Issue
Block a user