Skip to main content

PlayerRepository

Defined in: src/modules/infrastructure/init/player.repository.ts:40

Repository service for player profile database operations.

Example

class MyService {
    private playerRepository = inject(PlayerRepository);
 
    async getPlayer(license: string) {
        return await this.playerRepository.findByLicense(license);
    }
}

Constructors

Constructor

new PlayerRepository(): PlayerRepository;

Returns

PlayerRepository

Methods

create()

create(licenses: string[], identifiers: string[]): Promise\<PlayerProfile\>;

Defined in: src/modules/infrastructure/init/player.repository.ts:62

Create a new player profile with the given licenses and identifiers.

Parameters

ParameterTypeDescription
licensesstring[]Array of license identifiers.
identifiersstring[]Array of all player identifiers.

Returns

Promise<PlayerProfile>

The newly created player profile.


findByLicense()

findByLicense(license: string): Promise<PlayerProfile | null>;

Defined in: src/modules/infrastructure/init/player.repository.ts:48

Find a player profile by their license identifier.

Parameters

ParameterTypeDescription
licensestringThe license identifier to search for.

Returns

Promise<PlayerProfile | null>

The player profile if found, null otherwise.


update()

update(
   id: string, 
   licenses: string[], 
identifiers: string[]): Promise\<PlayerProfile\>;

Defined in: src/modules/infrastructure/init/player.repository.ts:89

Update an existing player profile's licenses and identifiers.

Parameters

ParameterTypeDescription
idstringThe player profile ID.
licensesstring[]Updated array of license identifiers.
identifiersstring[]Updated array of all player identifiers.

Returns

Promise<PlayerProfile>

The updated player profile.

Throws

Error if the player profile is not found.