This commit is contained in:
aditya.siregar
2025-04-10 11:21:08 +07:00
parent c642c5c61b
commit 09c9a4d59d
30 changed files with 1797 additions and 758 deletions
+25
View File
@@ -28,6 +28,7 @@ func (h *Handler) Route(group *gin.RouterGroup, jwt gin.HandlerFunc) {
route.PUT("/:id", jwt, isSuperAdmin, h.Update)
route.GET("/:id", jwt, isSuperAdmin, h.GetByID)
route.DELETE("/:id", jwt, isSuperAdmin, h.Delete)
route.PUT("/update", jwt, h.UpdateMyStore)
}
func NewHandler(service services.Partner) *Handler {
@@ -268,3 +269,27 @@ func (h *Handler) toPartnerResponseList(resp []*entity.Partner, total int64, req
Offset: req.Offset,
}
}
func (h *Handler) UpdateMyStore(c *gin.Context) {
ctx := request.GetMyContext(c)
PartnerID := ctx.GetPartnerID()
var req request.Partner
if err := c.ShouldBindJSON(&req); err != nil {
response.ErrorWrapper(c, errors.ErrorBadRequest)
return
}
updatedPartner, err := h.service.Update(ctx, req.ToEntityUpdate(*PartnerID))
if err != nil {
response.ErrorWrapper(c, err)
return
}
c.JSON(http.StatusOK, response.BaseResponse{
Success: true,
Status: http.StatusOK,
Data: h.toPartnerResponse(updatedPartner),
})
}