Reworked some of the logic to be less round trips to db.
Fixed a localization "off" issue. Don't allow users to rename the Default Reading Profile.
This commit is contained in:
parent
82f557490a
commit
29c29976f1
9 changed files with 112 additions and 79 deletions
|
|
@ -15,6 +15,7 @@ using Microsoft.Extensions.Logging;
|
|||
|
||||
namespace API.Controllers;
|
||||
|
||||
[Route("api/reading-profile")]
|
||||
public class ReadingProfileController(ILogger<ReadingProfileController> logger, IUnitOfWork unitOfWork,
|
||||
IReadingProfileService readingProfileService): BaseApiController
|
||||
{
|
||||
|
|
@ -26,8 +27,7 @@ public class ReadingProfileController(ILogger<ReadingProfileController> logger,
|
|||
[HttpGet("all")]
|
||||
public async Task<ActionResult<IList<UserReadingProfileDto>>> GetAllReadingProfiles()
|
||||
{
|
||||
var profiles = await unitOfWork.AppUserReadingProfileRepository.GetProfilesDtoForUser(User.GetUserId());
|
||||
return Ok(profiles);
|
||||
return Ok(await unitOfWork.AppUserReadingProfileRepository.GetProfilesDtoForUser(User.GetUserId(), true));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -95,16 +95,14 @@ public class ReadingProfileController(ILogger<ReadingProfileController> logger,
|
|||
/// Updates the given reading profile, must belong to the current user
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The updated reading profile</returns>
|
||||
/// <remarks>
|
||||
/// This does not update connected series, and libraries.
|
||||
/// Deletes all implicit profiles for series linked to this profile
|
||||
/// This does not update connected series and libraries.
|
||||
/// </remarks>
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<UserReadingProfileDto>> UpdateReadingProfile([FromBody] UserReadingProfileDto dto)
|
||||
public async Task<ActionResult<UserReadingProfileDto>> UpdateReadingProfile(UserReadingProfileDto dto)
|
||||
{
|
||||
var newProfile = await readingProfileService.UpdateReadingProfile(User.GetUserId(), dto);
|
||||
return Ok(newProfile);
|
||||
return Ok(await readingProfileService.UpdateReadingProfile(User.GetUserId(), dto));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue