Fixed a deployment bug where we weren't listening on port properly. New way will force firewall exception dialog on Windows and work across board. Implemented user preferences and ability to update them.

This commit is contained in:
Joseph Milazzo 2021-02-06 13:08:48 -06:00
parent 3548a3811c
commit bd5a1338c4
24 changed files with 987 additions and 5 deletions

View file

@ -44,5 +44,25 @@ namespace API.Controllers
var libs = await _unitOfWork.LibraryRepository.GetLibraryDtosForUsernameAsync(User.GetUsername());
return Ok(libs.Any(x => x.Id == libraryId));
}
[HttpPost("update-preferences")]
public async Task<ActionResult<UserPreferencesDto>> UpdatePreferences(UserPreferencesDto preferencesDto)
{
var existingPreferences = await _unitOfWork.UserRepository.GetPreferencesAsync(User.GetUsername());
existingPreferences.ReadingDirection = preferencesDto.ReadingDirection;
existingPreferences.ScalingOption = preferencesDto.ScalingOption;
existingPreferences.PageSplitOption = preferencesDto.PageSplitOption;
existingPreferences.HideReadOnDetails = preferencesDto.HideReadOnDetails;
_unitOfWork.UserRepository.Update(existingPreferences);
if (await _unitOfWork.Complete())
{
return Ok(preferencesDto);
}
return BadRequest("There was an issue saving preferences.");
}
}
}