Rework top level services injection of business level services

Signed-off-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
Émile Ré
2025-12-11 18:35:46 +01:00
parent 69f876484e
commit ec13bd8108
7 changed files with 11 additions and 21 deletions

View File

@@ -77,7 +77,7 @@ type (
TrustCenterFiles *TrustCenterFileService
Reports *ReportService
Organizations *OrganizationService
slack *slack.TenantService
SlackMessages *slack.SlackMessageService
}
)
@@ -126,7 +126,6 @@ func (s *Service) WithTenant(tenantID gid.TenantID) *TenantService {
fileManager: s.fileManager,
logger: s.logger,
trustConfig: s.trustConfig,
slack: s.slack.WithTenant(tenantID),
}
tenantService.TrustCenters = &TrustCenterService{svc: tenantService}
@@ -139,6 +138,7 @@ func (s *Service) WithTenant(tenantID gid.TenantID) *TenantService {
tenantService.TrustCenterFiles = &TrustCenterFileService{svc: tenantService}
tenantService.Reports = &ReportService{svc: tenantService}
tenantService.Organizations = &OrganizationService{svc: tenantService}
tenantService.SlackMessages = s.slack.WithTenant(tenantID).SlackMessages
return tenantService
}

View File

@@ -232,8 +232,7 @@ func (s TrustCenterAccessService) Request(
return nil, err
}
slackMessageService := s.svc.slack.GetSlackMessageService()
if err := slackMessageService.QueueSlackNotification(ctx, access.Email, req.TrustCenterID); err != nil {
if err := s.svc.SlackMessages.QueueSlackNotification(ctx, access.Email, req.TrustCenterID); err != nil {
s.logger.ErrorCtx(ctx, "cannot queue slack notification", log.Error(err))
}