feat: send learning business audit events
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/go-chi/chi/v5"
|
||||
chimw "github.com/go-chi/chi/v5/middleware"
|
||||
|
||||
commonaudit "gitea.estateliga.work/admin/portal-common/audit"
|
||||
commondb "gitea.estateliga.work/admin/portal-common/db"
|
||||
commonmw "gitea.estateliga.work/admin/portal-common/middleware"
|
||||
|
||||
@@ -72,6 +73,11 @@ func main() {
|
||||
lessonRepo := repository.NewLessonRepository(pool)
|
||||
publicTokenRepo := repository.NewPublicTokenRepository(pool)
|
||||
accessRepo := repository.NewAccessGrantRepository(pool)
|
||||
auditClient := commonaudit.NewClient(cfg.PortalURL, cfg.InternalAPIKey)
|
||||
if !auditClient.Enabled() {
|
||||
slog.Warn("portal audit client disabled — business audit events выключены",
|
||||
"portal_url_set", cfg.PortalURL != "", "portal_key_set", cfg.InternalAPIKey != "")
|
||||
}
|
||||
|
||||
healthH := handler.NewHealthHandler(pool)
|
||||
testH := handler.NewTestHandler(testRepo, accessRepo)
|
||||
@@ -91,6 +97,7 @@ func main() {
|
||||
|
||||
r.Route("/api", func(r chi.Router) {
|
||||
r.Use(commonmw.InternalAuth(cfg.InternalAPIKey))
|
||||
r.Use(handler.NewAuditMiddleware(auditClient).Middleware)
|
||||
|
||||
// Tests CRUD
|
||||
r.Get("/tests", testH.List)
|
||||
|
||||
Reference in New Issue
Block a user