Testys commited on
Commit
c308253
1 Parent(s): ce07356

Pushing changes to database session

Browse files
Files changed (1) hide show
  1. users/routes.py +2 -1
users/routes.py CHANGED
@@ -2,6 +2,7 @@ from fastapi import APIRouter, status, Depends, Request, UploadFile, File, HTTPE
2
  from fastapi.responses import JSONResponse
3
  from sqlalchemy.orm import Session
4
  from core.database import get_db
 
5
  from core.security import get_current_user, create_refresh_token, create_access_token
6
  from users.schemas import UserCreate, UserBase, UserEmbeddingsBase, User, UserUpdate
7
  from users.services import create_user_account, create_user_embeddings, update_user, update_user_embeddings, get_user_by_id, get_user_by_email
@@ -60,7 +61,7 @@ async def create_face_embeddings(file: UploadFile = File(...), user: User = Depe
60
 
61
  @router.get("/me/face/", status_code=status.HTTP_200_OK)
62
  async def get_face_embeddings(user: User = Depends(get_current_user), db: Session = Depends(get_db)):
63
- face = db.query(UserEmbeddingsBase).filter(UserEmbeddingsBase.user_id == user.id).first()
64
  if not face:
65
  raise HTTPException(status_code=404, detail="Face embeddings not found")
66
  return JSONResponse(content={"embeddings": face.embeddings}, status_code=status.HTTP_200_OK)
 
2
  from fastapi.responses import JSONResponse
3
  from sqlalchemy.orm import Session
4
  from core.database import get_db
5
+ from users.models import UserEmbeddings
6
  from core.security import get_current_user, create_refresh_token, create_access_token
7
  from users.schemas import UserCreate, UserBase, UserEmbeddingsBase, User, UserUpdate
8
  from users.services import create_user_account, create_user_embeddings, update_user, update_user_embeddings, get_user_by_id, get_user_by_email
 
61
 
62
  @router.get("/me/face/", status_code=status.HTTP_200_OK)
63
  async def get_face_embeddings(user: User = Depends(get_current_user), db: Session = Depends(get_db)):
64
+ face = db.query(UserEmbeddings).filter(UserEmbeddings.user_id == user.id).first()
65
  if not face:
66
  raise HTTPException(status_code=404, detail="Face embeddings not found")
67
  return JSONResponse(content={"embeddings": face.embeddings}, status_code=status.HTTP_200_OK)