This commit is contained in:
Alex
2025-04-10 15:40:22 +02:00
parent 87f08dd3be
commit 18f5dadb06
48 changed files with 1650 additions and 981 deletions

View File

@@ -89,9 +89,7 @@ func (cr *CarController) GetAll(c *gin.Context) {
func (cr *CarController) Delete(c *gin.Context) {
type input struct {
Car struct {
ID uint `json:"id" binding:"required,numeric"`
} `json:"car"`
ID uint `json:"id" binding:"required,numeric"`
}
var deleteData input
requestUser, err := cr.UserService.FromContext(c)
@@ -109,7 +107,7 @@ func (cr *CarController) Delete(c *gin.Context) {
utils.HandleValidationError(c, err)
return
}
err = cr.S.Delete(&deleteData.Car.ID)
err = cr.S.Delete(&deleteData.ID)
if err != nil {
utils.RespondWithError(c, err, "Error deleting car", http.StatusInternalServerError, errors.Responses.Fields.Car, errors.Responses.Keys.InternalServerError)
return