mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
Implemented update series
This commit is contained in:
parent
bdac9e6961
commit
cdd44340a2
@ -95,5 +95,31 @@ namespace API.Controllers
|
|||||||
|
|
||||||
return Ok();
|
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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
14
API/DTOs/UpdateSeriesDto.cs
Normal file
14
API/DTOs/UpdateSeriesDto.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
@ -80,7 +80,7 @@ namespace API.Services
|
|||||||
{
|
{
|
||||||
using var stream = entry.Open();
|
using var stream = entry.Open();
|
||||||
using var thumbnail = Image.ThumbnailStream(stream, ThumbnailWidth);
|
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)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user