feat: send learning business audit events
Some checks failed
CI / hygiene (push) Successful in 2s
Build and Deploy / build-and-deploy (push) Successful in 35s
CI / test (push) Failing after 24s

This commit is contained in:
Grendgi
2026-06-17 12:52:57 +03:00
parent 94dd530823
commit ae2ac23a3a
5 changed files with 406 additions and 3 deletions

View File

@@ -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)