Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ public async Task<Player> Handle(UpdateConnectedPlayerCommand request, Cancellat

if (summonerIdFromRiot is not null)
{
playerInDb.LolSummonerId = summonerIdFromRiot.SummonerId;
playerInDb.LolSummonerLevel = summonerIdFromRiot.SummonerLevel;
playerInDb.LolIconId = summonerIdFromRiot.ProfileIconId;
playerInDb.LolRefreshedOn = DateTime.Now;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
// Copyright (c) LeadOn's Corp'. All rights reserved.
// </copyright>

using GameOn.Application.FIFA.Tournaments.Queries.GetTournamentById;

namespace GameOn.Application.FIFA.Tournaments.Commands.UpdateTournamentPicture
{
using GameOn.Application.Common.Players.Queries.GetPlayerById;
using GameOn.Common.Exceptions;
using GameOn.Common.Interfaces;
using GameOn.Domain;
using GameOn.External.NetworkStorage.Interfaces;
using MediatR;
using Microsoft.EntityFrameworkCore;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
// Copyright (c) LeadOn's Corp'. All rights reserved.
// </copyright>

using GameOn.Application.FIFA.Tournaments.Queries.GetTournamentById;

namespace GameOn.Application.FIFA.Tournaments.Queries.GetTournamentLogo
{
using GameOn.Application.Common.Players.Queries.GetPlayerById;
using GameOn.Application.FIFA.Tournaments.Queries.GetTournamentById;
using GameOn.Common.DTOs;
using GameOn.Common.Exceptions;
using GameOn.External.NetworkStorage.Interfaces;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,12 @@ public async Task<Player> Handle(UpdatePlayerSummonerCommand request, Cancellati

if (summonerIdFromRiot is not null)
{
playerInDb.LolSummonerId = summonerIdFromRiot.SummonerId;
playerInDb.LolSummonerLevel = summonerIdFromRiot.SummonerLevel;
playerInDb.LolIconId = summonerIdFromRiot.ProfileIconId;
playerInDb.LolRefreshedOn = DateTime.Now;

// Updating player Rank
var playerRank = await this.leagueService.GetLeagueEntries(summonerIdFromRiot.SummonerId, cancellationToken);
var playerRank = await this.leagueService.GetLeagueEntries(playerInDb.RiotGamesPUUID, cancellationToken);

if (playerRank is not null)
{
Expand Down
4 changes: 2 additions & 2 deletions GameOn.External/RiotGames/Implementations/LeagueV4Service.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public LeagueV4Service(HttpClient client)
}

/// <inheritdoc/>
public async Task<IEnumerable<LeagueEntryDto>> GetLeagueEntries(string summonerId, CancellationToken cancellationToken)
public async Task<IEnumerable<LeagueEntryDto>> GetLeagueEntries(string puuid, CancellationToken cancellationToken)
{
var request = new HttpRequestMessage(HttpMethod.Get, $"https://{Environment.GetEnvironmentVariable("RIOT_GAMES_SUMMONER_API_ROUTE")}/lol/league/v4/entries/by-summoner/{summonerId}?api_key={Environment.GetEnvironmentVariable("RIOT_GAMES_API_KEY")}");
var request = new HttpRequestMessage(HttpMethod.Get, $"https://{Environment.GetEnvironmentVariable("RIOT_GAMES_SUMMONER_API_ROUTE")}/lol/league/v4/entries/by-puuid/{puuid}?api_key={Environment.GetEnvironmentVariable("RIOT_GAMES_API_KEY")}");
#pragma warning disable CS8603 // Existence possible d'un retour de référence null.
return await RunRequest<IEnumerable<LeagueEntryDto>>(this.client, request, cancellationToken);
#pragma warning restore CS8603 // Existence possible d'un retour de référence null
Expand Down
6 changes: 3 additions & 3 deletions GameOn.External/RiotGames/Interfaces/ILeagueService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ namespace GameOn.External.RiotGames.Interfaces
public interface ILeagueService
{
/// <summary>
/// Gets League Entries by Summoner's ID.
/// Gets League Entries by its PUUID.
/// </summary>
/// <param name="summonerId">Summoner ID.</param>
/// <param name="puuid">PUUID ID.</param>
/// <param name="cancellationToken"><see cref="CancellationToken"/>.</param>
/// <returns><see cref="IEnumerable{LeagueEntryDto}"/>.</returns>
Task<IEnumerable<LeagueEntryDto>> GetLeagueEntries(string summonerId, CancellationToken cancellationToken);
Task<IEnumerable<LeagueEntryDto>> GetLeagueEntries(string puuid, CancellationToken cancellationToken);
}
}