MW usage refactor

This commit is contained in:
nquidox 2026-03-21 15:21:30 +03:00
parent 229eebcf66
commit 21b54c4167
9 changed files with 98 additions and 48 deletions

View file

@ -4,6 +4,7 @@ import (
"github.com/gin-gonic/gin"
"merch-api/internal/appLog"
"merch-api/pkg/responses"
"merch-api/pkg/router"
"merch-api/pkg/utils"
"net/http"
)
@ -22,11 +23,11 @@ func newController(s *service, utils utils.Utils) *controller {
}
}
func (h *Handler) RegisterRoutes(r *gin.RouterGroup) {
func (h *Handler) RegisterRoutes(r *gin.RouterGroup, mw *router.Middlewares) {
userGroup := r.Group("/user")
userGroup.POST("", h.controller.create)
userGroup.DELETE("", h.controller.delete)
userGroup.POST("", mw.RegMW, h.controller.create)
userGroup.DELETE("", mw.AuthMW, h.controller.delete)
}
// create godoc

View file

@ -1,7 +0,0 @@
package user
import "context"
type Provider interface {
GetUserId(ctx context.Context, userUuid string) (int64, error)
}