You've already forked reloading-manager
I'll explain when you're older!
This commit is contained in:
@@ -27,9 +27,9 @@ func Photo(c echo.Context) error {
|
||||
}()
|
||||
|
||||
id := c.Param("id")
|
||||
uid := handlers.ParseUuidOrBadRequest(c, id)
|
||||
if uid == nil {
|
||||
return nil
|
||||
uid, err := handlers.ParseUuidOrBadRequest(c, id)
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "Invalid UUID format")
|
||||
}
|
||||
|
||||
byId, err := db.Bullets.GetBulletById(context.Background(), *uid)
|
||||
@@ -57,12 +57,12 @@ func Delete(c echo.Context) error {
|
||||
}()
|
||||
|
||||
id := c.Param("id")
|
||||
uid := handlers.ParseUuidOrBadRequest(c, id)
|
||||
if uid == nil {
|
||||
return nil
|
||||
uid, err := handlers.ParseUuidOrBadRequest(c, id)
|
||||
if err != nil || uid == nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "Invalid UUID format")
|
||||
}
|
||||
|
||||
err := db.Bullets.DeleteBullet(context.Background(), *uid)
|
||||
err = db.Bullets.DeleteBullet(context.Background(), *uid)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -77,9 +77,9 @@ func Put(c echo.Context) error {
|
||||
}()
|
||||
|
||||
id := c.Param("id")
|
||||
uid := handlers.ParseUuidOrBadRequest(c, id)
|
||||
if uid == nil {
|
||||
return nil
|
||||
uid, err := handlers.ParseUuidOrBadRequest(c, id)
|
||||
if err != nil || uid == nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "Invalid UUID format")
|
||||
}
|
||||
|
||||
byId, err := db.Bullets.GetBulletById(context.Background(), *uid)
|
||||
@@ -109,9 +109,9 @@ func Put(c echo.Context) error {
|
||||
weight, _ := strconv.ParseInt(c.FormValue("weight"), 10, 32)
|
||||
diameter, _ := strconv.ParseInt(c.FormValue("diameter"), 10, 32)
|
||||
manufacturerId := c.FormValue("manufacturer_id")
|
||||
manufacturerUid := handlers.ParseUuidOrBadRequest(c, manufacturerId)
|
||||
if manufacturerUid == nil {
|
||||
return nil
|
||||
manufacturerUid, err := handlers.ParseUuidOrBadRequest(c, manufacturerId)
|
||||
if err == nil || manufacturerUid == nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "Invalid UUID format")
|
||||
}
|
||||
|
||||
name := c.FormValue("name")
|
||||
@@ -161,9 +161,9 @@ func Get(c echo.Context) error {
|
||||
|
||||
if c.Param("id") != "" {
|
||||
id := c.Param("id")
|
||||
uid := handlers.ParseUuidOrBadRequest(c, id)
|
||||
if uid == nil {
|
||||
return nil
|
||||
uid, err := handlers.ParseUuidOrBadRequest(c, id)
|
||||
if err != nil || uid == nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "Invalid UUID format")
|
||||
}
|
||||
|
||||
byId, err := db.Bullets.GetBulletById(context.Background(), *uid)
|
||||
@@ -258,9 +258,9 @@ func Post(c echo.Context) error {
|
||||
_ = db.Db.Close(context.Background())
|
||||
}()
|
||||
|
||||
manufacturerUid := handlers.ParseUuidOrBadRequest(c, manufacturerId)
|
||||
if manufacturerUid == nil {
|
||||
return nil
|
||||
manufacturerUid, err := handlers.ParseUuidOrBadRequest(c, manufacturerId)
|
||||
if err != nil || manufacturerUid == nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "Invalid UUID format")
|
||||
}
|
||||
|
||||
manufacturer, err := db.Manufacturer.GetById(context.Background(), *manufacturerUid)
|
||||
|
||||
Reference in New Issue
Block a user