Перенести WithUser в httpx
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/google/uuid"
|
||||
|
||||
"messenger/internal/auth"
|
||||
"messenger/internal/platform/apperr"
|
||||
"messenger/internal/platform/httpx"
|
||||
"messenger/internal/platform/ident"
|
||||
@@ -21,13 +20,13 @@ func NewHandler(chats *Service) *Handler {
|
||||
return &Handler{chats: chats}
|
||||
}
|
||||
|
||||
// Register mounts the chat endpoints on a router guarded by RequireUser.
|
||||
// Register mounts the chat endpoints on a router guarded by the authentication middleware.
|
||||
func (h *Handler) Register(protected gin.IRouter) {
|
||||
protected.POST("/chats", auth.WithUser(h.create))
|
||||
protected.GET("/chats", auth.WithUser(h.list))
|
||||
protected.GET("/chats/:chat_id", auth.WithUser(h.get))
|
||||
protected.POST("/chats/:chat_id/messages", auth.WithUser(h.send))
|
||||
protected.GET("/chats/:chat_id/messages", auth.WithUser(h.history))
|
||||
protected.POST("/chats", httpx.WithUser(h.create))
|
||||
protected.GET("/chats", httpx.WithUser(h.list))
|
||||
protected.GET("/chats/:chat_id", httpx.WithUser(h.get))
|
||||
protected.POST("/chats/:chat_id/messages", httpx.WithUser(h.send))
|
||||
protected.GET("/chats/:chat_id/messages", httpx.WithUser(h.history))
|
||||
}
|
||||
|
||||
type createChatRequest struct {
|
||||
|
||||
Reference in New Issue
Block a user