This commit is contained in:
2026-04-13 08:14:09 +03:00
commit 0449337ae7
39 changed files with 2726 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
package main
// Домен авторизации.
// Этим файлом владеет команда авторизации.
//
// Что внутри: сессии, проверка токенов, логин/логаут.
// Что НЕ знает: как устроены уведомления, как устроены профили.
//
// Добавить TokenValidator? Правим ТОЛЬКО этот файл:
// 1. Добавляем тип + конструктор
// 2. Добавляем fx.Provide(newTokenValidator) в AuthModule
// 3. main.go не трогаем — ноль мерж-конфликтов
import "go.uber.org/fx"
var AuthModule = fx.Module("auth",
fx.Provide(
newSessionRepo,
newAuthService,
// newTokenValidator, ← команда добавит сюда, не в main.go
),
)
// --- SessionRepo ---
type sessionRepo struct {
db DB
cache Cache
}
func newSessionRepo(db DB, cache Cache) SessionRepository {
return &sessionRepo{db: db, cache: cache}
}
// --- AuthService ---
type authServiceImpl struct {
userRepo UserRepository
sessionRepo SessionRepository
cache Cache
events EventBus
}
func newAuthService(userRepo UserRepository, sessionRepo SessionRepository, cache Cache, events EventBus) AuthService {
return &authServiceImpl{userRepo: userRepo, sessionRepo: sessionRepo, cache: cache, events: events}
}