ЛР 2 - БВТ2303 - Голиков - на 5 #10

Closed
Maximillan_Mercer wants to merge 61 commits from Maximillan_Mercer/mtusi2026lab2_fork:solution/BVT2303-Golikov into master
Showing only changes of commit c3492128b5 - Show all commits
+4
View File
@@ -12,6 +12,7 @@ type Handlers struct {
User *handler.UserHandler
Chat *handler.ChatHandler
Message *handler.MessageHandler
Auth *handler.AuthHandler
}
func NewRouter(h Handlers, auth gin.HandlerFunc) *gin.Engine {
@@ -28,11 +29,14 @@ func NewRouter(h Handlers, auth gin.HandlerFunc) *gin.Engine {
api := r.Group("/api/v1")
{
api.POST("/users", h.User.Create)
api.POST("/auth/sessions", h.Auth.CreateSession)
}
protected := api.Group("")
protected.Use(auth)
{
protected.DELETE("/auth/sessions/current", h.Auth.RevokeCurrent)
protected.GET("/users/me", h.User.Current)
protected.POST("/chats", h.Chat.Create)
protected.GET("/chats", h.Chat.List)