mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-27 07:58:45 -07:00
feat: Update GetMine method to return a list of SettingDto instead of a dictionary
This commit is contained in:
@@ -19,12 +19,13 @@ public class PlayerSettingsController(DorkNetDbContext db) : ControllerBase
|
|||||||
private long CurrentPlayerId => this.RequireCurrentPlayerId();
|
private long CurrentPlayerId => this.RequireCurrentPlayerId();
|
||||||
|
|
||||||
[HttpGet("/playersettings")]
|
[HttpGet("/playersettings")]
|
||||||
public async Task<ActionResult<Dictionary<string, string>>> GetMine()
|
public async Task<ActionResult<List<SettingDto>>> GetMine()
|
||||||
{
|
{
|
||||||
var accountId = CurrentPlayerId;
|
var accountId = CurrentPlayerId;
|
||||||
var settings = await db.PlayerSettings
|
var settings = await db.PlayerSettings
|
||||||
.Where(s => s.PlayerId == accountId)
|
.Where(s => s.PlayerId == accountId)
|
||||||
.ToDictionaryAsync(s => s.Key, s => s.Value);
|
.Select(s => new SettingDto { Key = s.Key, Value = s.Value })
|
||||||
|
.ToListAsync();
|
||||||
return Ok(settings);
|
return Ok(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user