Skip to content

Commit

Permalink
[MRG] Merged the new code for age in backend branch to main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
pathfindermilan committed Nov 4, 2024
1 parent e7e8fad commit d418719
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions backend/internal/controllers/sync_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,19 @@ func (ctrl *SyncController) SyncData(c *gin.Context) {
userID := userIDInterface.(uint)

contentType := c.PostForm("content_type")
ageStr := c.PostForm("age")
age, err := strconv.Atoi(ageStr)

ageValue := c.PostForm("age")
var age int
if ageValue == "" {
c.JSON(http.StatusBadRequest, gin.H{"error": "Age is required"})
return
}
age, err := strconv.Atoi(ageValue)
if err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid age"})
c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid age format"})
return
}

queryText := c.PostForm("query_text")

feelingLevelStr := c.PostForm("feeling_level")
Expand Down

0 comments on commit d418719

Please sign in to comment.