Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add user brief many #309

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
15 changes: 12 additions & 3 deletions W3ChampionsStatisticService/PlayerProfiles/PlayersController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,20 @@ public async Task<IActionResult> GetPlayerGameLengthStats([FromRoute] string bat
[HttpGet("{battleTag}/user-brief")]
public async Task<IActionResult> GetUserBrief([FromRoute] string battleTag)
{
PersonalSetting settings = await _personalSettingsRepository.Find(battleTag);
if (settings == null) {
PersonalSetting personalSetting = await _personalSettingsRepository.Find(battleTag);
if (personalSetting == null) {
return NotFound();
}
return Ok(new UserBrief(settings.Id, settings.ProfilePicture));
return Ok(new UserBrief(personalSetting.Id, personalSetting.ProfilePicture));
}

[HttpGet("{commaSeparatedBattleTags}/user-brief/many")]
public async Task<IActionResult> GetUserBriefMany([FromRoute] string commaSeparatedBattleTags)
{
var battleTags = commaSeparatedBattleTags.Split(',');
List<PersonalSetting> personalSettings = await _personalSettingsRepository.LoadMany(battleTags);
List<UserBrief> users = personalSettings.Select((x) => new UserBrief(x.Id, x.ProfilePicture)).ToList();
return Ok(users);
}
}

Expand Down