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
| Parameter | Type | Description |
|---|---|---|
licenses | string[] | Array of license identifiers. |
identifiers | string[] | 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
| Parameter | Type | Description |
|---|---|---|
license | string | The 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
| Parameter | Type | Description |
|---|---|---|
id | string | The player profile ID. |
licenses | string[] | Updated array of license identifiers. |
identifiers | string[] | Updated array of all player identifiers. |
Returns
Promise<PlayerProfile>
The updated player profile.
Throws
Error if the player profile is not found.