Update users/services.py
Browse files- users/services.py +4 -3
users/services.py
CHANGED
@@ -3,7 +3,8 @@ from fastapi.exceptions import HTTPException
|
|
3 |
from core.security import get_password_hash
|
4 |
from datetime import datetime
|
5 |
from sqlalchemy.orm import Session
|
6 |
-
from users.schemas import UserCreate, UserUpdate,
|
|
|
7 |
|
8 |
|
9 |
async def create_user_account(data:UserCreate, db:Session):
|
@@ -27,7 +28,7 @@ async def create_user_account(data:UserCreate, db:Session):
|
|
27 |
db.refresh(new_user)
|
28 |
return new_user
|
29 |
|
30 |
-
async def create_user_embeddings(user_id:int, embeddings:
|
31 |
user = db.query(User).filter(User.id == user_id).first()
|
32 |
if not user:
|
33 |
embeddings = UserEmbeddings(user_id=user_id, embeddings=embeddings.embeddings)
|
@@ -72,7 +73,7 @@ def delete_user(user_id, db:Session):
|
|
72 |
return None
|
73 |
|
74 |
|
75 |
-
async def update_user_embeddings(user_id:int, embeddings:
|
76 |
embeddings = db.query(UserEmbeddings).filter(UserEmbeddings.user_id == user_id).first()
|
77 |
if embeddings:
|
78 |
embeddings.embeddings = embeddings.embeddings
|
|
|
3 |
from core.security import get_password_hash
|
4 |
from datetime import datetime
|
5 |
from sqlalchemy.orm import Session
|
6 |
+
from users.schemas import UserCreate, UserUpdate, UserEmbeddings
|
7 |
+
|
8 |
|
9 |
|
10 |
async def create_user_account(data:UserCreate, db:Session):
|
|
|
28 |
db.refresh(new_user)
|
29 |
return new_user
|
30 |
|
31 |
+
async def create_user_embeddings(user_id:int, embeddings:UserEmbeddings, db:Session):
|
32 |
user = db.query(User).filter(User.id == user_id).first()
|
33 |
if not user:
|
34 |
embeddings = UserEmbeddings(user_id=user_id, embeddings=embeddings.embeddings)
|
|
|
73 |
return None
|
74 |
|
75 |
|
76 |
+
async def update_user_embeddings(user_id:int, embeddings:UserEmbeddings, db:Session):
|
77 |
embeddings = db.query(UserEmbeddings).filter(UserEmbeddings.user_id == user_id).first()
|
78 |
if embeddings:
|
79 |
embeddings.embeddings = embeddings.embeddings
|