mirror of
https://github.com/imartinez/privateGPT.git
synced 2025-08-17 15:06:56 +00:00
Removed / from audit routes
This commit is contained in:
parent
333a3f3913
commit
c6847859b0
4
.env
4
.env
@ -1,11 +1,11 @@
|
||||
PORT=8000
|
||||
ENVIRONMENT=dev
|
||||
|
||||
DB_HOST=db
|
||||
DB_HOST=localhost
|
||||
DB_USER=postgres
|
||||
DB_PORT=5432
|
||||
DB_PASSWORD=admin
|
||||
DB_NAME=QuickGpt
|
||||
DB_NAME=GPT
|
||||
|
||||
SUPER_ADMIN_EMAIL=superadmin@email.com
|
||||
SUPER_ADMIN_PASSWORD=supersecretpassword
|
||||
|
@ -54,7 +54,7 @@ def create_app(root_injector: Injector) -> FastAPI:
|
||||
"http://192.168.1.98", "http://192.168.1.98:3000", "http://localhost:3000","https://globaldocquery.gibl.com.np/", "http://127.0.0.1/", "http://localhost/",
|
||||
"http://localhost:80", "http://192.168.1.131", 'http://192.168.1.131:3000'
|
||||
, "http://192.168.1.127", 'http://192.168.1.127:3000'
|
||||
, "http://192.168.1.89", 'http://192.168.1.89:3000'
|
||||
, "http://192.168.1.89", 'http://192.168.1.89:3000',
|
||||
],
|
||||
allow_methods=["DELETE", "GET", "POST", "PUT", "OPTIONS", "PATCH"],
|
||||
allow_headers=["*"],
|
||||
|
@ -232,7 +232,4 @@ async def prompt_completion(
|
||||
except Exception as e:
|
||||
print(traceback.format_exc())
|
||||
logger.error(f"There was an error: {str(e)}")
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
detail="Internal Server Error",
|
||||
)
|
||||
raise
|
@ -40,26 +40,26 @@ def list_auditlog(
|
||||
logs = crud.audit.get_multi_desc(db, skip=skip, limit=limit)
|
||||
return convert_audit_logs(db, logs)
|
||||
|
||||
@router.get("filter/", response_model=List[schemas.Audit])
|
||||
@router.get("/filter", response_model=List[schemas.Audit])
|
||||
def filter_auditlog(
|
||||
db: Session = Depends(deps.get_db),
|
||||
filter_in= Depends(schemas.AuditFilter),
|
||||
# current_user: models.User = Security(
|
||||
# deps.get_current_user,
|
||||
# scopes=[Role.SUPER_ADMIN["name"]],
|
||||
# ),
|
||||
current_user: models.User = Security(
|
||||
deps.get_current_user,
|
||||
scopes=[Role.SUPER_ADMIN["name"]],
|
||||
),
|
||||
) -> List[schemas.Audit]:
|
||||
logs = crud.audit.filter(db, obj_in=filter_in)
|
||||
return convert_audit_logs(db, logs)
|
||||
|
||||
@router.get("download/")
|
||||
@router.get("/download")
|
||||
def download_auditlog(
|
||||
db: Session = Depends(deps.get_db),
|
||||
filter_in= Depends(schemas.ExcelFilter),
|
||||
# current_user: models.User = Security(
|
||||
# deps.get_current_user,
|
||||
# scopes=[Role.SUPER_ADMIN["name"]],
|
||||
# ),
|
||||
current_user: models.User = Security(
|
||||
deps.get_current_user,
|
||||
scopes=[Role.SUPER_ADMIN["name"]],
|
||||
),
|
||||
):
|
||||
logs = crud.audit.excel_filter(db, obj_in=filter_in)
|
||||
username = filter_in.username if filter_in.username else None
|
||||
|
@ -49,7 +49,7 @@ def list_departments(
|
||||
"""
|
||||
try:
|
||||
role = current_user.user_role.role.name if current_user.user_role else None
|
||||
if role == "SUPER_ADMIN":
|
||||
if (role == "SUPER_ADMIN") or (role == "OPERATOR"):
|
||||
deps = crud.department.get_multi(db)
|
||||
else:
|
||||
deps = crud.department.get_multi_department(
|
||||
|
@ -366,7 +366,7 @@ async def verify_documents(
|
||||
checker = schemas.DocumentCheckerUpdate(
|
||||
action_type=MakerCheckerActionType.UPDATE,
|
||||
status=MakerCheckerStatus.APPROVED,
|
||||
is_enabled=False,
|
||||
is_enabled=True,
|
||||
verified_at=datetime.now(),
|
||||
verified_by=current_user.id,
|
||||
verified=True,
|
||||
|
@ -5,11 +5,11 @@ from pydantic import BaseModel
|
||||
|
||||
class AuditBase(BaseModel):
|
||||
id: int
|
||||
model: str
|
||||
user_id: int
|
||||
action: str
|
||||
details: dict
|
||||
ip_address: str
|
||||
model: Optional[str] = None
|
||||
user_id: Optional[int] = None
|
||||
action: Optional[str] = None
|
||||
details: Optional[dict] = None
|
||||
ip_address: Optional[str] = None
|
||||
timestamp: Optional[datetime]
|
||||
|
||||
|
||||
@ -29,12 +29,12 @@ class AuditInDB(AuditBase):
|
||||
|
||||
class Audit(BaseModel):
|
||||
id: int
|
||||
model: str
|
||||
username: str
|
||||
action: str
|
||||
details: dict
|
||||
timestamp: Optional[datetime]
|
||||
ip_address: str
|
||||
model: Optional[str] = None
|
||||
username: Optional[str] = None
|
||||
action: Optional[str] = None
|
||||
details: Optional[dict] = None
|
||||
timestamp: Optional[datetime]= None
|
||||
ip_address: Optional[str] = None
|
||||
|
||||
|
||||
class GetAudit(BaseModel):
|
||||
|
Loading…
Reference in New Issue
Block a user