383 lines
20 KiB
TypeScript
383 lines
20 KiB
TypeScript
import { Provider } from '@nestjs/common';
|
|
import { LeagueService } from './LeagueService';
|
|
|
|
// Import core interfaces
|
|
import type { IDriverRepository } from '@core/racing/domain/repositories/IDriverRepository';
|
|
import type { ILeagueMembershipRepository } from '@core/racing/domain/repositories/ILeagueMembershipRepository';
|
|
import type { ILeagueRepository } from '@core/racing/domain/repositories/ILeagueRepository';
|
|
import type { IProtestRepository } from '@core/racing/domain/repositories/IProtestRepository';
|
|
import type { IRaceRepository } from '@core/racing/domain/repositories/IRaceRepository';
|
|
import type { ISeasonRepository } from '@core/racing/domain/repositories/ISeasonRepository';
|
|
import type { ISeasonSponsorshipRepository } from '@core/racing/domain/repositories/ISeasonSponsorshipRepository';
|
|
import type { IStandingRepository } from '@core/racing/domain/repositories/IStandingRepository';
|
|
import type { Logger } from '@core/shared/application/Logger';
|
|
|
|
// Import concrete in-memory implementations
|
|
import type { ILeagueWalletRepository } from "@core/racing/domain/repositories/ILeagueWalletRepository";
|
|
import type { ITransactionRepository } from "@core/racing/domain/repositories/ITransactionRepository";
|
|
import { listLeagueScoringPresets } from '@adapters/bootstrap/LeagueScoringPresets';
|
|
import { getPointsSystems } from '@adapters/bootstrap/PointsSystems';
|
|
import { ConsoleLogger } from '@adapters/logging/ConsoleLogger';
|
|
import { InMemoryDriverRepository } from '@adapters/racing/persistence/inmemory/InMemoryDriverRepository';
|
|
import { InMemoryGameRepository } from '@adapters/racing/persistence/inmemory/InMemoryGameRepository';
|
|
import { InMemoryLeagueMembershipRepository } from '@adapters/racing/persistence/inmemory/InMemoryLeagueMembershipRepository';
|
|
import { InMemoryLeagueRepository } from '@adapters/racing/persistence/inmemory/InMemoryLeagueRepository';
|
|
import { InMemoryLeagueScoringConfigRepository } from '@adapters/racing/persistence/inmemory/InMemoryLeagueScoringConfigRepository';
|
|
import { InMemoryLeagueStandingsRepository } from '@adapters/racing/persistence/inmemory/InMemoryLeagueStandingsRepository';
|
|
import { InMemoryLeagueWalletRepository } from '@adapters/racing/persistence/inmemory/InMemoryLeagueWalletRepository';
|
|
import { InMemoryProtestRepository } from '@adapters/racing/persistence/inmemory/InMemoryProtestRepository';
|
|
import { InMemoryRaceRepository } from '@adapters/racing/persistence/inmemory/InMemoryRaceRepository';
|
|
import { InMemorySeasonRepository } from '@adapters/racing/persistence/inmemory/InMemorySeasonRepository';
|
|
import { InMemorySeasonSponsorshipRepository } from '@adapters/racing/persistence/inmemory/InMemorySeasonSponsorshipRepository';
|
|
import { InMemoryStandingRepository } from '@adapters/racing/persistence/inmemory/InMemoryStandingRepository';
|
|
import { InMemoryTransactionRepository } from '@adapters/racing/persistence/inmemory/InMemoryTransactionRepository';
|
|
|
|
// Import use cases
|
|
import { ApproveLeagueJoinRequestUseCase } from '@core/racing/application/use-cases/ApproveLeagueJoinRequestUseCase';
|
|
import { CreateLeagueWithSeasonAndScoringUseCase } from '@core/racing/application/use-cases/CreateLeagueWithSeasonAndScoringUseCase';
|
|
import { GetAllLeaguesWithCapacityUseCase } from '@core/racing/application/use-cases/GetAllLeaguesWithCapacityUseCase';
|
|
import { GetLeagueAdminPermissionsUseCase } from '@core/racing/application/use-cases/GetLeagueAdminPermissionsUseCase';
|
|
import { GetLeagueFullConfigUseCase } from '@core/racing/application/use-cases/GetLeagueFullConfigUseCase';
|
|
import { GetLeagueJoinRequestsUseCase } from '@core/racing/application/use-cases/GetLeagueJoinRequestsUseCase';
|
|
import { GetLeagueMembershipsUseCase } from '@core/racing/application/use-cases/GetLeagueMembershipsUseCase';
|
|
import { GetLeagueOwnerSummaryUseCase } from '@core/racing/application/use-cases/GetLeagueOwnerSummaryUseCase';
|
|
import { GetLeagueProtestsUseCase } from '@core/racing/application/use-cases/GetLeagueProtestsUseCase';
|
|
import { GetLeagueScheduleUseCase } from '@core/racing/application/use-cases/GetLeagueScheduleUseCase';
|
|
import { GetLeagueScoringConfigUseCase } from '@core/racing/application/use-cases/GetLeagueScoringConfigUseCase';
|
|
import { GetLeagueSeasonsUseCase } from '@core/racing/application/use-cases/GetLeagueSeasonsUseCase';
|
|
import { GetLeagueStandingsUseCase } from '@core/racing/application/use-cases/GetLeagueStandingsUseCase';
|
|
import { GetLeagueStatsUseCase } from '@core/racing/application/use-cases/GetLeagueStatsUseCase';
|
|
import { GetLeagueWalletUseCase } from '@core/racing/application/use-cases/GetLeagueWalletUseCase';
|
|
import { GetRaceProtestsUseCase } from '@core/racing/application/use-cases/GetRaceProtestsUseCase';
|
|
import { GetSeasonSponsorshipsUseCase } from '@core/racing/application/use-cases/GetSeasonSponsorshipsUseCase';
|
|
import { GetTotalLeaguesUseCase } from '@core/racing/application/use-cases/GetTotalLeaguesUseCase';
|
|
import { JoinLeagueUseCase } from '@core/racing/application/use-cases/JoinLeagueUseCase';
|
|
import { ListLeagueScoringPresetsUseCase } from '@core/racing/application/use-cases/ListLeagueScoringPresetsUseCase';
|
|
import { RejectLeagueJoinRequestUseCase } from '@core/racing/application/use-cases/RejectLeagueJoinRequestUseCase';
|
|
import { RemoveLeagueMemberUseCase } from '@core/racing/application/use-cases/RemoveLeagueMemberUseCase';
|
|
import { TransferLeagueOwnershipUseCase } from '@core/racing/application/use-cases/TransferLeagueOwnershipUseCase';
|
|
import { UpdateLeagueMemberRoleUseCase } from '@core/racing/application/use-cases/UpdateLeagueMemberRoleUseCase';
|
|
import { WithdrawFromLeagueWalletUseCase } from '@core/racing/application/use-cases/WithdrawFromLeagueWalletUseCase';
|
|
|
|
// Import presenters
|
|
import { AllLeaguesWithCapacityPresenter } from './presenters/AllLeaguesWithCapacityPresenter';
|
|
import { GetLeagueProtestsPresenter } from './presenters/GetLeagueProtestsPresenter';
|
|
import { GetSeasonSponsorshipsPresenter } from './presenters/GetSeasonSponsorshipsPresenter';
|
|
import { LeagueScoringPresetsPresenter } from './presenters/LeagueScoringPresetsPresenter';
|
|
import { LeagueStandingsPresenter } from './presenters/LeagueStandingsPresenter';
|
|
import { GetLeagueWalletPresenter } from './presenters/GetLeagueWalletPresenter';
|
|
import { WithdrawFromLeagueWalletPresenter } from './presenters/WithdrawFromLeagueWalletPresenter';
|
|
|
|
export const LEAGUE_REPOSITORY_TOKEN = 'ILeagueRepository';
|
|
export const LEAGUE_MEMBERSHIP_REPOSITORY_TOKEN = 'ILeagueMembershipRepository';
|
|
export const LEAGUE_STANDINGS_REPOSITORY_TOKEN = 'ILeagueStandingsRepository';
|
|
export const STANDING_REPOSITORY_TOKEN = 'IStandingRepository';
|
|
export const SEASON_REPOSITORY_TOKEN = 'ISeasonRepository';
|
|
export const LEAGUE_SCORING_CONFIG_REPOSITORY_TOKEN = 'ILeagueScoringConfigRepository';
|
|
export const GAME_REPOSITORY_TOKEN = 'IGameRepository';
|
|
export const PROTEST_REPOSITORY_TOKEN = 'IProtestRepository';
|
|
export const RACE_REPOSITORY_TOKEN = 'IRaceRepository';
|
|
export const DRIVER_REPOSITORY_TOKEN = 'IDriverRepository';
|
|
export const LEAGUE_WALLET_REPOSITORY_TOKEN = 'ILeagueWalletRepository';
|
|
export const TRANSACTION_REPOSITORY_TOKEN = 'ITransactionRepository';
|
|
export const LOGGER_TOKEN = 'Logger';
|
|
export const GET_LEAGUE_STANDINGS_USE_CASE = 'GetLeagueStandingsUseCase';
|
|
export const GET_ALL_LEAGUES_WITH_CAPACITY_USE_CASE = 'GetAllLeaguesWithCapacityUseCase';
|
|
export const GET_LEAGUE_STATS_USE_CASE = 'GetLeagueStatsUseCase';
|
|
export const GET_LEAGUE_FULL_CONFIG_USE_CASE = 'GetLeagueFullConfigUseCase';
|
|
export const GET_LEAGUE_SCORING_CONFIG_USE_CASE = 'GetLeagueScoringConfigUseCase';
|
|
export const LIST_LEAGUE_SCORING_PRESETS_USE_CASE = 'ListLeagueScoringPresetsUseCase';
|
|
export const JOIN_LEAGUE_USE_CASE = 'JoinLeagueUseCase';
|
|
export const TRANSFER_LEAGUE_OWNERSHIP_USE_CASE = 'TransferLeagueOwnershipUseCase';
|
|
export const CREATE_LEAGUE_WITH_SEASON_AND_SCORING_USE_CASE = 'CreateLeagueWithSeasonAndScoringUseCase';
|
|
export const GET_RACE_PROTESTS_USE_CASE = 'GetRaceProtestsUseCase';
|
|
export const GET_TOTAL_LEAGUES_USE_CASE = 'GetTotalLeaguesUseCase';
|
|
export const GET_LEAGUE_JOIN_REQUESTS_USE_CASE = 'GetLeagueJoinRequestsUseCase';
|
|
export const APPROVE_LEAGUE_JOIN_REQUEST_USE_CASE = 'ApproveLeagueJoinRequestUseCase';
|
|
export const REJECT_LEAGUE_JOIN_REQUEST_USE_CASE = 'RejectLeagueJoinRequestUseCase';
|
|
export const REMOVE_LEAGUE_MEMBER_USE_CASE = 'RemoveLeagueMemberUseCase';
|
|
export const UPDATE_LEAGUE_MEMBER_ROLE_USE_CASE = 'UpdateLeagueMemberRoleUseCase';
|
|
export const GET_LEAGUE_OWNER_SUMMARY_USE_CASE = 'GetLeagueOwnerSummaryUseCase';
|
|
export const GET_LEAGUE_PROTESTS_USE_CASE = 'GetLeagueProtestsUseCase';
|
|
export const GET_LEAGUE_SEASONS_USE_CASE = 'GetLeagueSeasonsUseCase';
|
|
export const GET_LEAGUE_MEMBERSHIPS_USE_CASE = 'GetLeagueMembershipsUseCase';
|
|
export const GET_LEAGUE_SCHEDULE_USE_CASE = 'GetLeagueScheduleUseCase';
|
|
export const GET_LEAGUE_ADMIN_PERMISSIONS_USE_CASE = 'GetLeagueAdminPermissionsUseCase';
|
|
export const GET_LEAGUE_WALLET_USE_CASE = 'GetLeagueWalletUseCase';
|
|
export const WITHDRAW_FROM_LEAGUE_WALLET_USE_CASE = 'WithdrawFromLeagueWalletUseCase';
|
|
export const GET_SEASON_SPONSORSHIPS_USE_CASE = 'GetSeasonSponsorshipsUseCase';
|
|
|
|
export const GET_ALL_LEAGUES_WITH_CAPACITY_OUTPUT_PORT_TOKEN = 'GetAllLeaguesWithCapacityOutputPort_TOKEN';
|
|
export const GET_LEAGUE_STANDINGS_OUTPUT_PORT_TOKEN = 'GetLeagueStandingsOutputPort_TOKEN';
|
|
export const GET_LEAGUE_PROTESTS_OUTPUT_PORT_TOKEN = 'GetLeagueProtestsOutputPort_TOKEN';
|
|
export const GET_SEASON_SPONSORSHIPS_OUTPUT_PORT_TOKEN = 'GetSeasonSponsorshipsOutputPort_TOKEN';
|
|
export const LIST_LEAGUE_SCORING_PRESETS_OUTPUT_PORT_TOKEN = 'ListLeagueScoringPresetsOutputPort_TOKEN';
|
|
export const APPROVE_LEAGUE_JOIN_REQUEST_OUTPUT_PORT_TOKEN = 'ApproveLeagueJoinRequestOutputPort_TOKEN';
|
|
export const CREATE_LEAGUE_OUTPUT_PORT_TOKEN = 'CreateLeagueOutputPort_TOKEN';
|
|
export const GET_LEAGUE_ADMIN_PERMISSIONS_OUTPUT_PORT_TOKEN = 'GetLeagueAdminPermissionsOutputPort_TOKEN';
|
|
export const GET_LEAGUE_MEMBERSHIPS_OUTPUT_PORT_TOKEN = 'GetLeagueMembershipsOutputPort_TOKEN';
|
|
export const GET_LEAGUE_OWNER_SUMMARY_OUTPUT_PORT_TOKEN = 'GetLeagueOwnerSummaryOutputPort_TOKEN';
|
|
export const GET_LEAGUE_SEASONS_OUTPUT_PORT_TOKEN = 'GetLeagueSeasonsOutputPort_TOKEN';
|
|
export const JOIN_LEAGUE_OUTPUT_PORT_TOKEN = 'JoinLeagueOutputPort_TOKEN';
|
|
export const GET_LEAGUE_SCHEDULE_OUTPUT_PORT_TOKEN = 'GetLeagueScheduleOutputPort_TOKEN';
|
|
export const GET_LEAGUE_STATS_OUTPUT_PORT_TOKEN = 'GetLeagueStatsOutputPort_TOKEN';
|
|
export const REJECT_LEAGUE_JOIN_REQUEST_OUTPUT_PORT_TOKEN = 'RejectLeagueJoinRequestOutputPort_TOKEN';
|
|
export const REMOVE_LEAGUE_MEMBER_OUTPUT_PORT_TOKEN = 'RemoveLeagueMemberOutputPort_TOKEN';
|
|
export const TOTAL_LEAGUES_OUTPUT_PORT_TOKEN = 'TotalLeaguesOutputPort_TOKEN';
|
|
export const TRANSFER_LEAGUE_OWNERSHIP_OUTPUT_PORT_TOKEN = 'TransferLeagueOwnershipOutputPort_TOKEN';
|
|
export const UPDATE_LEAGUE_MEMBER_ROLE_OUTPUT_PORT_TOKEN = 'UpdateLeagueMemberRoleOutputPort_TOKEN';
|
|
export const GET_LEAGUE_FULL_CONFIG_OUTPUT_PORT_TOKEN = 'GetLeagueFullConfigOutputPort_TOKEN';
|
|
export const GET_LEAGUE_SCORING_CONFIG_OUTPUT_PORT_TOKEN = 'GetLeagueScoringConfigOutputPort_TOKEN';
|
|
export const GET_LEAGUE_WALLET_OUTPUT_PORT_TOKEN = 'GetLeagueWalletOutputPort_TOKEN';
|
|
export const WITHDRAW_FROM_LEAGUE_WALLET_OUTPUT_PORT_TOKEN = 'WithdrawFromLeagueWalletOutputPort_TOKEN';
|
|
|
|
export const LeagueProviders: Provider[] = [
|
|
LeagueService, // Provide the service itself
|
|
{
|
|
provide: LEAGUE_REPOSITORY_TOKEN,
|
|
useFactory: (logger: Logger) => new InMemoryLeagueRepository(logger), // Factory for InMemoryLeagueRepository
|
|
inject: [LOGGER_TOKEN],
|
|
},
|
|
{
|
|
provide: LEAGUE_MEMBERSHIP_REPOSITORY_TOKEN,
|
|
useFactory: (logger: Logger) => new InMemoryLeagueMembershipRepository(logger), // Factory for InMemoryLeagueMembershipRepository
|
|
inject: [LOGGER_TOKEN],
|
|
},
|
|
{
|
|
provide: LEAGUE_STANDINGS_REPOSITORY_TOKEN,
|
|
useFactory: (logger: Logger) => new InMemoryLeagueStandingsRepository(logger), // Factory for InMemoryLeagueStandingsRepository
|
|
inject: [LOGGER_TOKEN],
|
|
},
|
|
{
|
|
provide: STANDING_REPOSITORY_TOKEN,
|
|
useFactory: (logger: Logger) => new InMemoryStandingRepository(logger, getPointsSystems()), // Factory for InMemoryStandingRepository
|
|
inject: [LOGGER_TOKEN],
|
|
},
|
|
{
|
|
provide: SEASON_REPOSITORY_TOKEN,
|
|
useFactory: (logger: Logger) => new InMemorySeasonRepository(logger), // Factory for InMemorySeasonRepository
|
|
inject: [LOGGER_TOKEN],
|
|
},
|
|
{
|
|
provide: 'ISeasonSponsorshipRepository',
|
|
useFactory: (logger: Logger) => new InMemorySeasonSponsorshipRepository(logger),
|
|
inject: [LOGGER_TOKEN],
|
|
},
|
|
{
|
|
provide: LEAGUE_SCORING_CONFIG_REPOSITORY_TOKEN,
|
|
useFactory: (logger: Logger) => new InMemoryLeagueScoringConfigRepository(logger), // Factory for InMemoryLeagueScoringConfigRepository
|
|
inject: [LOGGER_TOKEN],
|
|
},
|
|
{
|
|
provide: GAME_REPOSITORY_TOKEN,
|
|
useFactory: (logger: Logger) => new InMemoryGameRepository(logger),
|
|
inject: [LOGGER_TOKEN],
|
|
},
|
|
{
|
|
provide: PROTEST_REPOSITORY_TOKEN,
|
|
useFactory: (logger: Logger) => new InMemoryProtestRepository(logger),
|
|
inject: [LOGGER_TOKEN],
|
|
},
|
|
{
|
|
provide: RACE_REPOSITORY_TOKEN,
|
|
useFactory: (logger: Logger) => new InMemoryRaceRepository(logger),
|
|
inject: [LOGGER_TOKEN],
|
|
},
|
|
{
|
|
provide: DRIVER_REPOSITORY_TOKEN,
|
|
useFactory: (logger: Logger) => new InMemoryDriverRepository(logger),
|
|
inject: [LOGGER_TOKEN],
|
|
},
|
|
{
|
|
provide: LEAGUE_WALLET_REPOSITORY_TOKEN,
|
|
useFactory: (logger: Logger) => new InMemoryLeagueWalletRepository(logger),
|
|
inject: [LOGGER_TOKEN],
|
|
},
|
|
{
|
|
provide: TRANSACTION_REPOSITORY_TOKEN,
|
|
useFactory: (logger: Logger) => new InMemoryTransactionRepository(logger),
|
|
inject: [LOGGER_TOKEN],
|
|
},
|
|
{
|
|
provide: LOGGER_TOKEN,
|
|
useClass: ConsoleLogger,
|
|
},
|
|
// Presenters
|
|
AllLeaguesWithCapacityPresenter,
|
|
LeagueStandingsPresenter,
|
|
GetLeagueProtestsPresenter,
|
|
GetSeasonSponsorshipsPresenter,
|
|
LeagueScoringPresetsPresenter,
|
|
GetLeagueWalletPresenter,
|
|
WithdrawFromLeagueWalletPresenter,
|
|
// Output ports
|
|
{
|
|
provide: GET_ALL_LEAGUES_WITH_CAPACITY_OUTPUT_PORT_TOKEN,
|
|
useExisting: AllLeaguesWithCapacityPresenter,
|
|
},
|
|
{
|
|
provide: GET_LEAGUE_STANDINGS_OUTPUT_PORT_TOKEN,
|
|
useExisting: LeagueStandingsPresenter,
|
|
},
|
|
{
|
|
provide: GET_LEAGUE_PROTESTS_OUTPUT_PORT_TOKEN,
|
|
useExisting: GetLeagueProtestsPresenter,
|
|
},
|
|
{
|
|
provide: GET_SEASON_SPONSORSHIPS_OUTPUT_PORT_TOKEN,
|
|
useExisting: GetSeasonSponsorshipsPresenter,
|
|
},
|
|
{
|
|
provide: LIST_LEAGUE_SCORING_PRESETS_OUTPUT_PORT_TOKEN,
|
|
useExisting: LeagueScoringPresetsPresenter,
|
|
},
|
|
{
|
|
provide: GET_LEAGUE_WALLET_OUTPUT_PORT_TOKEN,
|
|
useExisting: GetLeagueWalletPresenter,
|
|
},
|
|
{
|
|
provide: WITHDRAW_FROM_LEAGUE_WALLET_OUTPUT_PORT_TOKEN,
|
|
useExisting: WithdrawFromLeagueWalletPresenter,
|
|
},
|
|
// Use cases
|
|
{
|
|
provide: GetAllLeaguesWithCapacityUseCase,
|
|
useFactory: (leagueRepo: ILeagueRepository, membershipRepo: ILeagueMembershipRepository, presenter: AllLeaguesWithCapacityPresenter) =>
|
|
new GetAllLeaguesWithCapacityUseCase(leagueRepo, membershipRepo, presenter),
|
|
inject: [LEAGUE_REPOSITORY_TOKEN, LEAGUE_MEMBERSHIP_REPOSITORY_TOKEN, 'AllLeaguesWithCapacityPresenter'],
|
|
},
|
|
{
|
|
provide: GET_LEAGUE_STANDINGS_USE_CASE,
|
|
useFactory: (standingRepo: IStandingRepository, driverRepo: IDriverRepository, presenter: LeagueStandingsPresenter) =>
|
|
new GetLeagueStandingsUseCase(standingRepo, driverRepo, presenter),
|
|
inject: [STANDING_REPOSITORY_TOKEN, DRIVER_REPOSITORY_TOKEN, 'LeagueStandingsPresenter'],
|
|
},
|
|
{
|
|
provide: GET_LEAGUE_STATS_USE_CASE,
|
|
useClass: GetLeagueStatsUseCase,
|
|
},
|
|
{
|
|
provide: GET_LEAGUE_FULL_CONFIG_USE_CASE,
|
|
useClass: GetLeagueFullConfigUseCase,
|
|
},
|
|
{
|
|
provide: CREATE_LEAGUE_WITH_SEASON_AND_SCORING_USE_CASE,
|
|
useClass: CreateLeagueWithSeasonAndScoringUseCase,
|
|
},
|
|
{
|
|
provide: GET_RACE_PROTESTS_USE_CASE,
|
|
useClass: GetRaceProtestsUseCase,
|
|
},
|
|
{
|
|
provide: GET_TOTAL_LEAGUES_USE_CASE,
|
|
useClass: GetTotalLeaguesUseCase,
|
|
},
|
|
{
|
|
provide: GET_LEAGUE_JOIN_REQUESTS_USE_CASE,
|
|
useClass: GetLeagueJoinRequestsUseCase,
|
|
},
|
|
{
|
|
provide: APPROVE_LEAGUE_JOIN_REQUEST_USE_CASE,
|
|
useClass: ApproveLeagueJoinRequestUseCase,
|
|
},
|
|
{
|
|
provide: REJECT_LEAGUE_JOIN_REQUEST_USE_CASE,
|
|
useClass: RejectLeagueJoinRequestUseCase,
|
|
},
|
|
{
|
|
provide: REMOVE_LEAGUE_MEMBER_USE_CASE,
|
|
useClass: RemoveLeagueMemberUseCase,
|
|
},
|
|
{
|
|
provide: UPDATE_LEAGUE_MEMBER_ROLE_USE_CASE,
|
|
useClass: UpdateLeagueMemberRoleUseCase,
|
|
},
|
|
{
|
|
provide: GET_LEAGUE_OWNER_SUMMARY_USE_CASE,
|
|
useClass: GetLeagueOwnerSummaryUseCase,
|
|
},
|
|
{
|
|
provide: GET_LEAGUE_PROTESTS_USE_CASE,
|
|
useFactory: (
|
|
raceRepo: IRaceRepository,
|
|
protestRepo: IProtestRepository,
|
|
driverRepo: IDriverRepository,
|
|
leagueRepo: ILeagueRepository,
|
|
presenter: GetLeagueProtestsPresenter,
|
|
) => new GetLeagueProtestsUseCase(raceRepo, protestRepo, driverRepo, leagueRepo, presenter),
|
|
inject: [RACE_REPOSITORY_TOKEN, PROTEST_REPOSITORY_TOKEN, DRIVER_REPOSITORY_TOKEN, LEAGUE_REPOSITORY_TOKEN, 'GetLeagueProtestsPresenter'],
|
|
},
|
|
{
|
|
provide: GET_LEAGUE_SEASONS_USE_CASE,
|
|
useClass: GetLeagueSeasonsUseCase,
|
|
},
|
|
{
|
|
provide: GET_LEAGUE_MEMBERSHIPS_USE_CASE,
|
|
useClass: GetLeagueMembershipsUseCase,
|
|
},
|
|
{
|
|
provide: GET_LEAGUE_SCHEDULE_USE_CASE,
|
|
useClass: GetLeagueScheduleUseCase,
|
|
},
|
|
{
|
|
provide: GET_LEAGUE_ADMIN_PERMISSIONS_USE_CASE,
|
|
useClass: GetLeagueAdminPermissionsUseCase,
|
|
},
|
|
{
|
|
provide: GET_LEAGUE_WALLET_USE_CASE,
|
|
useFactory: (
|
|
leagueRepo: ILeagueRepository,
|
|
walletRepo: ILeagueWalletRepository,
|
|
transactionRepo: ITransactionRepository,
|
|
presenter: GetLeagueWalletPresenter,
|
|
) => new GetLeagueWalletUseCase(leagueRepo, walletRepo, transactionRepo, presenter),
|
|
inject: [LEAGUE_REPOSITORY_TOKEN, LEAGUE_WALLET_REPOSITORY_TOKEN, TRANSACTION_REPOSITORY_TOKEN, 'GetLeagueWalletPresenter'],
|
|
},
|
|
{
|
|
provide: WITHDRAW_FROM_LEAGUE_WALLET_USE_CASE,
|
|
useFactory: (
|
|
leagueRepo: ILeagueRepository,
|
|
walletRepo: ILeagueWalletRepository,
|
|
transactionRepo: ITransactionRepository,
|
|
logger: Logger,
|
|
presenter: WithdrawFromLeagueWalletPresenter,
|
|
) => new WithdrawFromLeagueWalletUseCase(leagueRepo, walletRepo, transactionRepo, logger, presenter),
|
|
inject: [LEAGUE_REPOSITORY_TOKEN, LEAGUE_WALLET_REPOSITORY_TOKEN, TRANSACTION_REPOSITORY_TOKEN, LOGGER_TOKEN, 'WithdrawFromLeagueWalletPresenter'],
|
|
},
|
|
{
|
|
provide: GET_SEASON_SPONSORSHIPS_USE_CASE,
|
|
useFactory: (
|
|
seasonSponsorshipRepo: ISeasonSponsorshipRepository,
|
|
seasonRepo: ISeasonRepository,
|
|
leagueRepo: ILeagueRepository,
|
|
leagueMembershipRepo: ILeagueMembershipRepository,
|
|
raceRepo: IRaceRepository,
|
|
presenter: GetSeasonSponsorshipsPresenter,
|
|
) => new GetSeasonSponsorshipsUseCase(seasonSponsorshipRepo, seasonRepo, leagueRepo, leagueMembershipRepo, raceRepo, presenter),
|
|
inject: [
|
|
'ISeasonSponsorshipRepository',
|
|
SEASON_REPOSITORY_TOKEN,
|
|
LEAGUE_REPOSITORY_TOKEN,
|
|
LEAGUE_MEMBERSHIP_REPOSITORY_TOKEN,
|
|
RACE_REPOSITORY_TOKEN,
|
|
'GetSeasonSponsorshipsPresenter',
|
|
],
|
|
},
|
|
{ // TODO wtf is this here? doesn't look like it adhers to our concepts
|
|
provide: LIST_LEAGUE_SCORING_PRESETS_USE_CASE,
|
|
useFactory: (presenter: LeagueScoringPresetsPresenter) => new ListLeagueScoringPresetsUseCase(listLeagueScoringPresets(), presenter),
|
|
inject: ['LeagueScoringPresetsPresenter'],
|
|
},
|
|
{
|
|
provide: JOIN_LEAGUE_USE_CASE,
|
|
useClass: JoinLeagueUseCase,
|
|
},
|
|
{
|
|
provide: TRANSFER_LEAGUE_OWNERSHIP_USE_CASE,
|
|
useClass: TransferLeagueOwnershipUseCase,
|
|
},
|
|
{
|
|
provide: GET_LEAGUE_SCORING_CONFIG_USE_CASE,
|
|
useClass: GetLeagueScoringConfigUseCase,
|
|
}
|
|
]; |