ea586e3ba2
Co-authored-by: multica-agent <github@multica.ai>
36 lines
884 B
Go
36 lines
884 B
Go
package promo
|
|
|
|
import (
|
|
"net/http"
|
|
"strconv"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/perfect-panel/server/internal/logic/admin/promo"
|
|
"github.com/perfect-panel/server/internal/svc"
|
|
"github.com/perfect-panel/server/internal/types"
|
|
"github.com/perfect-panel/server/pkg/result"
|
|
)
|
|
|
|
// Delete promo price
|
|
func DeletePromoPriceHandler(svcCtx *svc.ServiceContext) func(c *gin.Context) {
|
|
return func(c *gin.Context) {
|
|
var req types.DeletePromoPriceRequest
|
|
id, err := strconv.ParseInt(c.Param("id"), 10, 64)
|
|
if err != nil {
|
|
c.String(http.StatusBadRequest, "Invalid Params")
|
|
c.Abort()
|
|
return
|
|
}
|
|
req.Id = id
|
|
_ = c.ShouldBind(&req)
|
|
if err := svcCtx.Validate(&req); err != nil {
|
|
result.ParamErrorResult(c, err)
|
|
return
|
|
}
|
|
|
|
l := promo.NewDeletePromoPriceLogic(c.Request.Context(), svcCtx)
|
|
err = l.DeletePromoPrice(&req)
|
|
result.HttpResult(c, nil, err)
|
|
}
|
|
}
|