On branch main

modified:   internal/domain/auth/dto.go
	modified:   internal/domain/auth/handler.go
	modified:   internal/domain/auth/router.go
	modified:   internal/domain/auth/servcie.go
	modified:   internal/middleware/auth.go
	modified:   internal/router/router.go
auth implemented without reset password
This commit is contained in:
2026-03-31 04:22:54 +05:00
parent 659cd3584c
commit 8b40d1bfe5
6 changed files with 372 additions and 119 deletions
@@ -1,9 +1,11 @@
// router.go
package auth
import (
"api_yal/internal/logger"
"api_yal/internal/middleware"
"api_yal/internal/repository"
"time"
"github.com/go-chi/chi/v5"
"gorm.io/gorm"
@@ -13,8 +15,16 @@ import (
func RegisterRoutes(r chi.Router, db *gorm.DB, jwtSecret string) {
// Создаем репозиторий и сервис
accountRepo := repository.NewAccountRepository(db)
authService := NewAuthService(accountRepo, jwtSecret)
handler := NewAuthHandler(&authService)
// Конфигурация токенов
authConfig := AuthServiceConfig{
JWTSecret: jwtSecret,
AccessTokenTTL: 15 * time.Minute, // Access token живет 15 минут
RefreshTokenTTL: 7 * 24 * time.Hour, // Refresh token живет 7 дней
}
authService := NewAuthService(accountRepo, authConfig)
handler := NewAuthHandler(authService)
l := logger.Get()
l.Debug("Регистрация маршрутов аутентификации")