Update some flows

- Promote/Create new from implicit profile
- Fix save to parent updating implicit instead
- Remove skip in the manga reader as the resolver has made it redundant
- Add confirm to delete profile flow
This commit is contained in:
Amelia 2025-06-05 20:52:11 +02:00
parent 9109988514
commit 45a44480e1
13 changed files with 289 additions and 106 deletions

View file

@ -42,22 +42,6 @@ public class ReadingProfileController(ILogger<ReadingProfileController> logger,
return Ok(await readingProfileService.GetReadingProfileDtoForSeries(User.GetUserId(), seriesId));
}
/// <summary>
/// Updates the given reading profile, must belong to the current user
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
/// <remarks>
/// This does not update connected series, and libraries.
/// Deletes all implicit profiles for series linked to this profile
/// </remarks>
[HttpPost]
public async Task<ActionResult> UpdateReadingProfile([FromBody] UserReadingProfileDto dto)
{
await readingProfileService.UpdateReadingProfile(User.GetUserId(), dto);
return Ok();
}
/// <summary>
/// Creates a new reading profile for the current user
/// </summary>
@ -69,6 +53,17 @@ public class ReadingProfileController(ILogger<ReadingProfileController> logger,
return Ok(await readingProfileService.CreateReadingProfile(User.GetUserId(), dto));
}
/// <summary>
/// Promotes the implicit profile to a user profile. Removes the series from other profiles
/// </summary>
/// <param name="profileId"></param>
/// <returns></returns>
[HttpPost("promote")]
public async Task<ActionResult<UserReadingProfileDto>> PromoteImplicitReadingProfile([FromQuery] int profileId)
{
return Ok(await readingProfileService.PromoteImplicitProfile(User.GetUserId(), profileId));
}
/// <summary>
/// Update the implicit reading profile for a series, creates one if none exists
/// </summary>
@ -76,10 +71,39 @@ public class ReadingProfileController(ILogger<ReadingProfileController> logger,
/// <param name="seriesId"></param>
/// <returns></returns>
[HttpPost("series")]
public async Task<ActionResult> UpdateReadingProfileForSeries([FromBody] UserReadingProfileDto dto, [FromQuery] int seriesId)
public async Task<ActionResult<UserReadingProfileDto>> UpdateReadingProfileForSeries([FromBody] UserReadingProfileDto dto, [FromQuery] int seriesId)
{
await readingProfileService.UpdateImplicitReadingProfile(User.GetUserId(), seriesId, dto);
return Ok();
var updatedProfile = await readingProfileService.UpdateImplicitReadingProfile(User.GetUserId(), seriesId, dto);
return Ok(updatedProfile);
}
/// <summary>
/// Updates the non-implicit reading profile for the given series, and removes implicit profiles
/// </summary>
/// <param name="dto"></param>
/// <param name="seriesId"></param>
/// <returns></returns>
[HttpPost("update-parent")]
public async Task<ActionResult<UserReadingProfileDto>> UpdateParentProfileForSeries([FromBody] UserReadingProfileDto dto, [FromQuery] int seriesId)
{
var newParentProfile = await readingProfileService.UpdateParent(User.GetUserId(), seriesId, dto);
return Ok(newParentProfile);
}
/// <summary>
/// Updates the given reading profile, must belong to the current user
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
/// <remarks>
/// This does not update connected series, and libraries.
/// Deletes all implicit profiles for series linked to this profile
/// </remarks>
[HttpPost]
public async Task<ActionResult<UserReadingProfileDto>> UpdateReadingProfile([FromBody] UserReadingProfileDto dto)
{
var newProfile = await readingProfileService.UpdateReadingProfile(User.GetUserId(), dto);
return Ok(newProfile);
}
/// <summary>