Library filtering and display enhancements (#214)

* Implement infinite scrolling and paging (selected via preference) (closes #202)
* Display game counts on more filter types (closes #194)
* Make game counts larger (closes #194)
* Include age groups in filtering (closes #200)
* Add sorting options (closes #145)
This commit is contained in:
Michael Green
2023-12-07 13:20:53 +11:00
committed by GitHub
parent 9288eb8f12
commit e7239c428b
32 changed files with 1659 additions and 379 deletions

View File

@@ -1,3 +1,4 @@
using System.Data;
using System.Security.Claims;
using System.Text;
using Authentication;
@@ -95,6 +96,7 @@ namespace gaseous_server.Controllers
profile.EmailAddress = await _userManager.GetEmailAsync(user);
profile.Roles = new List<string>(await _userManager.GetRolesAsync(user));
profile.SecurityProfile = user.SecurityProfile;
profile.UserPreferences = user.UserPreferences;
profile.Roles.Sort();
return Ok(profile);
@@ -115,6 +117,7 @@ namespace gaseous_server.Controllers
profile.EmailAddress = await _userManager.GetEmailAsync(user);
profile.Roles = new List<string>(await _userManager.GetRolesAsync(user));
profile.SecurityProfile = user.SecurityProfile;
profile.UserPreferences = user.UserPreferences;
profile.Roles.Sort();
string profileString = "var userProfile = " + Newtonsoft.Json.JsonConvert.SerializeObject(profile, Newtonsoft.Json.Formatting.Indented) + ";";
@@ -392,5 +395,23 @@ namespace gaseous_server.Controllers
return NotFound();
}
}
[HttpPost]
[Route("Preferences")]
public async Task<IActionResult> SetPreferences(List<UserPreferenceViewModel> model)
{
ApplicationUser? user = await _userManager.GetUserAsync(User);
if (user == null)
{
return Unauthorized();
}
else
{
user.UserPreferences = model;
await _userManager.UpdateAsync(user);
return Ok();
}
}
}
}