Skip to content

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.

Implemented update series

Joseph Milazzocdd44340a290
diff --git a/API/Controllers/SeriesController.cs b/API/Controllers/SeriesController.cs
index 408ad9b86..f981f2dec 100644
--- a/API/Controllers/SeriesController.cs
+++ b/API/Controllers/SeriesController.cs
@@ -95,5 +95,31 @@ namespace API.Controllers
return Ok();
}
+
+ [HttpPost]
+ public async Task<ActionResult> UpdateSeries(UpdateSeriesDto updateSeries)
+ {
+ _logger.LogInformation("{UserName} is updating Series {SeriesName}", User.GetUsername(), updateSeries.Name);
+
+ var series = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(updateSeries.Id);
+
+ if (series == null) return BadRequest("Series does not exist");
+
+ // TODO: Support changing series properties once "locking" is implemented.
+ // series.Name = updateSeries.Name;
+ // series.OriginalName = updateSeries.OriginalName;
+ // series.SortName = updateSeries.SortName;
+ series.Summary = updateSeries.Summary;
+ //series.CoverImage = updateSeries.CoverImage;
+
+ _unitOfWork.SeriesRepository.Update(series);
+
+ if (await _unitOfWork.Complete())
+ {
+ return Ok();
+ }
+
+ return BadRequest("There was an error with updating the series");
+ }
}
}
\ No newline at end of file
diff --git a/API/DTOs/UpdateSeriesDto.cs b/API/DTOs/UpdateSeriesDto.cs
new file mode 100644
index 000000000..c25e99764
--- /dev/null
+++ b/API/DTOs/UpdateSeriesDto.cs
@@ -0,0 +1,14 @@
+namespace API.DTOs
+{
+ public class UpdateSeriesDto
+ {
+ public int Id { get; init; }
+ public string Name { get; init; }
+ public string OriginalName { get; init; }
+ public string SortName { get; init; }
+ public string Summary { get; init; }
+ public byte[] CoverImage { get; init; }
+ public int UserRating { get; set; }
+ public string UserReview { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/API/Services/ArchiveService.cs b/API/Services/ArchiveService.cs
index e7fd988b8..f1c52a0d0 100644
--- a/API/Services/ArchiveService.cs
+++ b/API/Services/ArchiveService.cs
@@ -80,7 +80,7 @@ namespace API.Services
{
using var stream = entry.Open();
using var thumbnail = Image.ThumbnailStream(stream, ThumbnailWidth);
- return thumbnail.WriteToBuffer(".jpg");
+ return thumbnail.WriteToBuffer(".jpg"); // TODO: Validate this code works with .png files
}
catch (Exception ex)
{