@@ -373,14 +373,11 @@ func buildAPIDependencies(
373373 relationPGRepository := postgres .NewRelationRepository (dbc )
374374 relationService := relation .NewService (relationPGRepository , authzRelationRepository )
375375
376- roleRepository := postgres .NewRoleRepository (dbc )
377- roleService := role .NewService (roleRepository , relationService , permissionService )
376+ auditRecordRepository := postgres .NewAuditRecordRepository (dbc )
378377
378+ roleRepository := postgres .NewRoleRepository (dbc )
379379 policyPGRepository := postgres .NewPolicyRepository (dbc )
380- policyService := policy .NewService (policyPGRepository , relationService , roleService )
381-
382380 userRepository := postgres .NewUserRepository (dbc )
383- userService := user .NewService (userRepository , relationService , policyService , roleService )
384381
385382 prospectRepository := postgres .NewProspectRepository (dbc )
386383 prospectService := prospect .NewService (prospectRepository )
@@ -415,15 +412,20 @@ func buildAPIDependencies(
415412 return api.Deps {}, fmt .Errorf ("failed to parse passkey config: %w" , err )
416413 }
417414 }
418- authnService := authenticate .NewService (logger , cfg .App .Authentication ,
419- postgres .NewFlowRepository (logger , dbc ), mailDialer , tokenService , sessionService , userService , serviceUserService , webAuthConfig )
420415
421416 groupRepository := postgres .NewGroupRepository (dbc )
422- groupService := group .NewService (groupRepository , relationService , authnService , policyService )
423-
424417 organizationRepository := postgres .NewOrganizationRepository (dbc )
418+
419+ roleService := role .NewService (roleRepository , relationService , permissionService , auditRecordRepository )
420+ policyService := policy .NewService (policyPGRepository , relationService , roleService )
421+ userService := user .NewService (userRepository , relationService , policyService , roleService )
422+ authnService := authenticate .NewService (logger , cfg .App .Authentication ,
423+ postgres .NewFlowRepository (logger , dbc ), mailDialer , tokenService , sessionService , userService , serviceUserService , webAuthConfig )
424+ groupService := group .NewService (groupRepository , relationService , authnService , policyService )
425425 organizationService := organization .NewService (organizationRepository , relationService , userService ,
426- authnService , policyService , preferenceService )
426+ authnService , policyService , preferenceService , auditRecordRepository )
427+
428+ auditRecordService := auditrecord .NewService (auditRecordRepository , userService , serviceUserService , sessionService )
427429
428430 orgKycRepository := postgres .NewOrgKycRepository (dbc )
429431 orgKycService := kyc .NewService (orgKycRepository )
@@ -478,7 +480,8 @@ func buildAPIDependencies(
478480 )
479481
480482 invitationService := invitation .NewService (mailDialer , postgres .NewInvitationRepository (logger , dbc ),
481- organizationService , groupService , userService , relationService , policyService , preferenceService )
483+ organizationService , groupService , userService , relationService , policyService , preferenceService ,
484+ auditRecordRepository )
482485
483486 if GetStripeClientFunc == nil {
484487 // allow to override the stripe client creation function in tests
@@ -562,9 +565,6 @@ func buildAPIDependencies(
562565 audit .WithIgnoreList (cfg .Log .IgnoredAuditEvents ),
563566 )
564567
565- auditRecordRepository := postgres .NewAuditRecordRepository (dbc )
566- auditRecordService := auditrecord .NewService (auditRecordRepository , userService , serviceUserService , sessionService )
567-
568568 dependencies := api.Deps {
569569 OrgService : organizationService ,
570570 OrgKycService : orgKycService ,
0 commit comments