fix: push back label body id
This commit is contained in:
parent
3cf551c2c0
commit
2aec86a6da
|
@ -3,7 +3,6 @@ package label
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"gorm.io/gorm"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type LabelHandler struct {
|
type LabelHandler struct {
|
||||||
|
@ -113,7 +112,7 @@ func (h *LabelHandler) updateLabel(c *fiber.Ctx) error {
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
targetLabelId := c.Locals("labelID").(int)
|
targetLabelId := c.Locals("labelID").(int)
|
||||||
label := &Label{Model: gorm.Model{ID: uint(targetLabelId)}}
|
label := &Label{}
|
||||||
|
|
||||||
if err := c.BodyParser(label); err != nil {
|
if err := c.BodyParser(label); err != nil {
|
||||||
return c.Status(fiber.StatusBadRequest).JSON(&fiber.Map{
|
return c.Status(fiber.StatusBadRequest).JSON(&fiber.Map{
|
||||||
|
@ -121,6 +120,7 @@ func (h *LabelHandler) updateLabel(c *fiber.Ctx) error {
|
||||||
"message": err.Error(),
|
"message": err.Error(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
label.ID = uint(targetLabelId)
|
||||||
|
|
||||||
err := h.labelService.UpdateLabel(customContext, label)
|
err := h.labelService.UpdateLabel(customContext, label)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user