Skip to content

Commit

Permalink
feat: add transactional support for access service (#8311)
Browse files Browse the repository at this point in the history
Continuing splitting #8271 into smaller pieces. This PR adds
transactional support for access service.
  • Loading branch information
FredrikOseberg authored Oct 1, 2024
1 parent 60206f8 commit ab81528
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ import {
} from '../features/change-request-segment-usage-service/createChangeRequestSegmentUsageReadModel';
import ConfigurationRevisionService from '../features/feature-toggle/configuration-revision-service';
import {
createAccessService,
createEnvironmentService,
createEventsService,
createFakeAccessService,
createFakeEnvironmentService,
createFakeEventsService,
createFakeProjectService,
Expand Down Expand Up @@ -165,6 +167,11 @@ export const createServices = (
? createEventsService(db, config)
: createFakeEventsService(config, stores);
const groupService = new GroupService(stores, config, eventService);

const transactionalAccessService = db
? withTransactional((db) => createAccessService(db, config), db)
: withFakeTransactional(createFakeAccessService(config).accessService);

const accessService = new AccessService(
stores,
config,
Expand Down Expand Up @@ -411,6 +418,7 @@ export const createServices = (
: createFakePersonalDashboardService(config);

return {
transactionalAccessService,
accessService,
accountService,
addonService,
Expand Down
1 change: 1 addition & 0 deletions src/lib/types/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import type { OnboardingService } from '../features/onboarding/onboarding-servic
import type { PersonalDashboardService } from '../features/personal-dashboard/personal-dashboard-service';

export interface IUnleashServices {
transactionalAccessService: WithTransactional<AccessService>;
accessService: AccessService;
accountService: AccountService;
addonService: AddonService;
Expand Down

0 comments on commit ab81528

Please sign in to comment.