From 35f0e8abb45767bfa235a3c2ae51094e9f73ef56 Mon Sep 17 00:00:00 2001 From: HeshamTB Date: Wed, 8 Jun 2022 14:31:47 +0300 Subject: [PATCH] sql_app: Use ORM relations for access log requests Signed-off-by: HeshamTB --- sql_app/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql_app/main.py b/sql_app/main.py index 7aa5c7f..3e31d02 100644 --- a/sql_app/main.py +++ b/sql_app/main.py @@ -285,14 +285,14 @@ def get_access_log_history_for_user(request : schemas.UserAccessLogRequestEmail, db : Session = Depends(get_db)): user = crud.get_user_by_email(db, request.email) if not user: raise HTTPException(status.HTTP_404_NOT_FOUND, detail="User not found") - return crud.get_access_log_for_user_by_id(db, user.id) + return user.access_log @app.post("/admin/user/accesslog/username/", tags=['Admin']) def get_access_log_history_for_user(request : schemas.UserAccessLogRequestUsername, db : Session = Depends(get_db)): user = crud.get_user_by_username(db, request.username) if not user: raise HTTPException(status.HTTP_404_NOT_FOUND, detail="User not found") - return crud.get_access_log_for_user_by_id(db, user.id) + return user.access_log @app.get("/admin/roominfo/now/", tags=['Admin']) def get_room_data(db: Session = Depends(get_db)):