Update src/services/cv_service.py
Browse files
src/services/cv_service.py
CHANGED
|
@@ -50,18 +50,20 @@ class CVParsingService:
|
|
| 50 |
else:
|
| 51 |
logger.warning("No skill levels calculated, adding empty analysis")
|
| 52 |
cv_data["candidat"]["analyse_competences"] = []
|
| 53 |
-
|
| 54 |
-
# Stockage automatique dans MongoDB
|
| 55 |
-
self._save_profile(cv_data["candidat"], user_id)
|
| 56 |
|
| 57 |
return cv_data
|
| 58 |
|
| 59 |
-
def _save_profile(self,
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
| 61 |
return
|
| 62 |
|
| 63 |
try:
|
| 64 |
-
|
|
|
|
| 65 |
profile_data["created_at"] = datetime.utcnow()
|
| 66 |
profile_data["updated_at"] = datetime.utcnow()
|
| 67 |
|
|
|
|
| 50 |
else:
|
| 51 |
logger.warning("No skill levels calculated, adding empty analysis")
|
| 52 |
cv_data["candidat"]["analyse_competences"] = []
|
| 53 |
+
self._save_profile(cv_data, user_id)
|
|
|
|
|
|
|
| 54 |
|
| 55 |
return cv_data
|
| 56 |
|
| 57 |
+
def _save_profile(self, cv_data: Dict[str, Any], user_id: str = None):
|
| 58 |
+
"""
|
| 59 |
+
Sauvegarde le CV avec la structure complète incluant la clé 'candidat'
|
| 60 |
+
"""
|
| 61 |
+
if self.candidate_collection is None or not isinstance(cv_data, dict):
|
| 62 |
return
|
| 63 |
|
| 64 |
try:
|
| 65 |
+
# Garder la structure complète avec la clé 'candidat'
|
| 66 |
+
profile_data = cv_data.copy()
|
| 67 |
profile_data["created_at"] = datetime.utcnow()
|
| 68 |
profile_data["updated_at"] = datetime.utcnow()
|
| 69 |
|