Merge pull request #175 from Vaibhavee89/fix/profile-duplicate-name-validation

Fix #134: Add validation for duplicate profile names
This commit is contained in:
Jamie Pine
2026-03-13 01:55:30 -07:00
committed by GitHub
4 changed files with 262 additions and 14 deletions
+10 -4
View File
@@ -222,7 +222,10 @@ async def create_profile(
"""Create a new voice profile."""
try:
return await profiles.create_profile(data, db)
except ValueError as e:
raise HTTPException(status_code=400, detail=str(e))
except Exception as e:
# Fallback for unexpected errors
raise HTTPException(status_code=400, detail=str(e))
@@ -278,10 +281,13 @@ async def update_profile(
db: Session = Depends(get_db),
):
"""Update a voice profile."""
profile = await profiles.update_profile(profile_id, data, db)
if not profile:
raise HTTPException(status_code=404, detail="Profile not found")
return profile
try:
profile = await profiles.update_profile(profile_id, data, db)
if not profile:
raise HTTPException(status_code=404, detail="Profile not found")
return profile
except ValueError as e:
raise HTTPException(status_code=400, detail=str(e))
@app.delete("/profiles/{profile_id}")