fix: change POST user update profile and delete input.role
This commit is contained in:
@@ -154,7 +154,6 @@ func UpdateProfile(c *gin.Context) {
|
|||||||
FirstName: input.FirstName,
|
FirstName: input.FirstName,
|
||||||
LastName: input.LastName,
|
LastName: input.LastName,
|
||||||
Phone: input.Phone,
|
Phone: input.Phone,
|
||||||
Role: input.Role,
|
|
||||||
}).Error; err != nil {
|
}).Error; err != nil {
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "Не удалось обновить данные", "details": err.Error()})
|
c.JSON(http.StatusInternalServerError, gin.H{"error": "Не удалось обновить данные", "details": err.Error()})
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ func main() {
|
|||||||
protected.POST("/orders/", handlers.CreateOrder)
|
protected.POST("/orders/", handlers.CreateOrder)
|
||||||
protected.GET("/orders", handlers.GetUserOrders)
|
protected.GET("/orders", handlers.GetUserOrders)
|
||||||
protected.GET("/orders/:id", handlers.GetOrder)
|
protected.GET("/orders/:id", handlers.GetOrder)
|
||||||
|
protected.PATCH("/profile", handlers.UpdateProfile)
|
||||||
}
|
}
|
||||||
|
|
||||||
admin := protected.Group("/admin")
|
admin := protected.Group("/admin")
|
||||||
|
|||||||
@@ -4,5 +4,4 @@ type UpdateUserInput struct {
|
|||||||
FirstName string `json:"first_name"`
|
FirstName string `json:"first_name"`
|
||||||
LastName string `json:"last_name"`
|
LastName string `json:"last_name"`
|
||||||
Phone string `json:"phone"`
|
Phone string `json:"phone"`
|
||||||
Role string `json:"role"`
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user