mirror of
https://github.com/Kareadita/Kavita.git
synced 2026-05-13 11:02:18 -04:00
New UX Part 1.5 (#3105)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using System.Threading.Tasks;
|
||||
using API.Data;
|
||||
using API.Data.Repositories;
|
||||
using API.DTOs;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace API.Controllers;
|
||||
|
||||
public class ChapterController : BaseApiController
|
||||
{
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
||||
public ChapterController(IUnitOfWork unitOfWork)
|
||||
{
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<ChapterDto>> GetChapter(int chapterId)
|
||||
{
|
||||
var chapter =
|
||||
await _unitOfWork.ChapterRepository.GetChapterDtoAsync(chapterId,
|
||||
ChapterIncludes.People | ChapterIncludes.Files);
|
||||
|
||||
return Ok(chapter);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -229,22 +229,25 @@ public class SeriesController : BaseApiController
|
||||
{
|
||||
// Trigger a refresh when we are moving from a locked image to a non-locked
|
||||
needsRefreshMetadata = true;
|
||||
series.CoverImage = string.Empty;
|
||||
series.CoverImage = null;
|
||||
series.CoverImageLocked = updateSeries.CoverImageLocked;
|
||||
series.ResetColorScape();
|
||||
|
||||
}
|
||||
|
||||
_unitOfWork.SeriesRepository.Update(series);
|
||||
|
||||
if (await _unitOfWork.CommitAsync())
|
||||
if (!await _unitOfWork.CommitAsync())
|
||||
{
|
||||
if (needsRefreshMetadata)
|
||||
{
|
||||
_taskScheduler.RefreshSeriesMetadata(series.LibraryId, series.Id);
|
||||
}
|
||||
return Ok();
|
||||
return BadRequest(await _localizationService.Translate(User.GetUserId(), "generic-series-update"));
|
||||
}
|
||||
|
||||
return BadRequest(await _localizationService.Translate(User.GetUserId(), "generic-series-update"));
|
||||
if (needsRefreshMetadata)
|
||||
{
|
||||
_taskScheduler.RefreshSeriesMetadata(series.LibraryId, series.Id);
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -377,6 +377,7 @@ public class UploadController : BaseApiController
|
||||
if (string.IsNullOrEmpty(uploadFileDto.Url))
|
||||
{
|
||||
library.CoverImage = null;
|
||||
library.ResetColorScape();
|
||||
_unitOfWork.LibraryRepository.Update(library);
|
||||
if (_unitOfWork.HasChanges())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user