Implemented the ability to correct a match from UI and further scans will show that new Series name.

This commit is contained in:
Joseph Milazzo 2021-03-08 09:33:35 -06:00
parent 5186508aff
commit c6e1fec9f2
11 changed files with 806 additions and 18 deletions

View file

@ -51,8 +51,9 @@ namespace API.Controllers
result = await _userManager.AddPasswordAsync(user, resetPasswordDto.Password);
if (!result.Succeeded) return BadRequest("Unable to update password");
return Ok($"{resetPasswordDto.UserName}'s Password has been reset.");
_logger.LogInformation("{User}'s Password has been reset", resetPasswordDto.UserName);
return Ok();
}
[HttpPost("register")]

View file

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using API.Data;
@ -42,9 +43,32 @@ namespace API.Controllers
file.Page = page;
file.MangaFileName = mangaFile.FilePath;
file.NeedsSplitting = file.Width > file.Height;
// TODO: Validate if sending page whole (not base64 encoded) fixes Tablet issue
//Response.Headers.Add("Transfer-Encoding", "gzip");
return Ok(file);
}
[HttpGet("image2")]
public async Task<ActionResult> GetImage2(int chapterId, int page)
{
// Temp let's iterate the directory each call to get next image
var chapter = await _cacheService.Ensure(chapterId);
if (chapter == null) return BadRequest("There was an issue finding image file for reading");
var (path, mangaFile) = await _cacheService.GetCachedPagePath(chapter, page);
if (string.IsNullOrEmpty(path)) return BadRequest($"No such image for page {page}");
var file = await _directoryService.ReadImageAsync(path);
file.Page = page;
file.MangaFileName = mangaFile.FilePath;
file.NeedsSplitting = file.Width > file.Height;
// TODO: Validate if sending page whole (not base64 encoded) fixes Tablet issue
return File(file.Content, "image/jpeg", mangaFile.FilePath);
}
[HttpGet("get-bookmark")]
public async Task<ActionResult<int>> GetBookmark(int chapterId)

View file

@ -104,11 +104,16 @@ namespace API.Controllers
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;
// TODO: check if new name isn't an existing series
var existingSeries = await _unitOfWork.SeriesRepository.GetSeriesByNameAsync(updateSeries.Name); // NOTE: This isnt checking library
if (existingSeries != null && existingSeries.Id != series.Id)
{
return BadRequest("A series already exists with this name. Name must be unique.");
}
series.Name = updateSeries.Name;
series.LocalizedName = updateSeries.LocalizedName;
series.SortName = updateSeries.SortName;
series.Summary = updateSeries.Summary;
//series.CoverImage = updateSeries.CoverImage;

View file

@ -76,14 +76,12 @@ namespace API.Controllers
if (!_unitOfWork.HasChanges()) return Ok("Nothing was updated");
if (_unitOfWork.HasChanges() && await _unitOfWork.Complete())
{
_logger.LogInformation("Server Settings updated");
_taskScheduler.ScheduleTasks();
return Ok(updateSettingsDto);
}
return BadRequest("There was a critical issue. Please try again.");
if (!_unitOfWork.HasChanges() || !await _unitOfWork.Complete())
return BadRequest("There was a critical issue. Please try again.");
_logger.LogInformation("Server Settings updated");
_taskScheduler.ScheduleTasks();
return Ok(updateSettingsDto);
}
[Authorize(Policy = "RequireAdminRole")]