Add player settings feature and settings API

This commit is contained in:
Holden
2026-06-20 22:58:33 -05:00
parent f4887c3f93
commit e77e479493
17 changed files with 405 additions and 3 deletions

View File

@@ -55,6 +55,31 @@ public class ProfileService(
return mapper.Map<AvatarDTO>(profile.Avatar);
}
public async Task<IReadOnlyList<PlayerSettingDTO>> GetPlayerSettingsAsync(
Guid profileId,
CancellationToken ct = default)
{
var settings = await profileRepository.GetSettingsByProfileIdAsync(profileId, ct);
return mapper.Map<List<PlayerSettingDTO>>(settings);
}
public async Task<bool> UpdatePlayerSettingAsync(
Guid profileId,
UpdatePlayerSettingCommand command,
CancellationToken ct = default)
{
var profile = await profileRepository.GetByIdWithSettingsAsync(profileId, ct);
if (profile is null)
return false;
profile.SetSetting(command.Key, command.Value);
await profileRepository.SaveChangesAsync(ct);
return true;
}
public async Task<IReadOnlyList<ProfileDTO>> GetProfilesAsync(
List<Guid> profileIds,
CancellationToken ct = default)
@@ -123,4 +148,4 @@ public class ProfileService(
expiresIn: token.ExpiresIn
);
}
}
}