refactor: gate sign-in notification email with an explicit flag

Pass emailLoginNotificationEnabled to CreateNewSignInWithEmail instead of
the whole AppConfigModel, so the sign-in audit business logic no longer
takes the config struct just to read one flag. The caller evaluates the
flag from the config it already loaded.

The background notification email, which is sent in a detached goroutine
after the request completes, now resolves the current config from the app
config service rather than threading the request's snapshot into the
goroutine.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YZ6SoJpmnLggZqactXxrak
This commit is contained in:
Claude
2026-07-19 23:13:22 +00:00
parent 0e0187dbc6
commit 10c0f1d5d7
5 changed files with 24 additions and 14 deletions
@@ -74,7 +74,7 @@ func initServices(
}
svc.geoLiteService = service.NewGeoLiteService(httpClient)
svc.auditLogService = service.NewAuditLogService(db, svc.emailService, svc.geoLiteService)
svc.auditLogService = service.NewAuditLogService(db, svc.emailService, svc.geoLiteService, svc.appConfigService)
svc.jwtService, err = service.NewJwtService(ctx, db, instanceID)
if err != nil {
return nil, fmt.Errorf("failed to create JWT service: %w", err)