feat(router): expose /auth/sessions endpoints

This commit is contained in:
Голиков Maximillian Антон
2026-10-02 10:36:02 +03:00
parent 00d3c0feed
commit c3492128b5
+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)