Skip to content

Commit 38ab682

Browse files
authored
Implement user analysis creation and retrieval
Added functions to create and retrieve user analyses.
1 parent e6e4866 commit 38ab682

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

app/crud.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,19 @@ def authenticate_user(db: Session, email: str, password: str):
2424
if not pwd_context.verify(password, user.hashed_password):
2525
return None
2626
return user
27+
from . import models
28+
29+
def create_analysis(db, user_id, tech_score, cognitive_score, recommendation):
30+
analysis = models.Analysis(
31+
technical_score=tech_score,
32+
cognitive_score=cognitive_score,
33+
recommended_career_path=recommendation,
34+
user_id=user_id
35+
)
36+
db.add(analysis)
37+
db.commit()
38+
db.refresh(analysis)
39+
return analysis
40+
41+
def get_user_analyses(db, user_id):
42+
return db.query(models.Analysis).filter(models.Analysis.user_id == user_id).all()

0 commit comments

Comments
 (0)