More Polish (#2320)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
Joe Milazzo 2023-10-17 11:05:14 -05:00 committed by GitHub
parent cd3a15fa3b
commit 5f11973696
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 337 additions and 161 deletions

View file

@ -191,6 +191,7 @@ public class AccountController : BaseApiController
.SingleOrDefaultAsync(x => x.NormalizedUserName == loginDto.Username.ToUpper());
}
_logger.LogInformation("{UserName} attempting to login from {IpAddress}", loginDto.Username, HttpContext.Connection.RemoteIpAddress?.ToString());
if (user == null)
{

View file

@ -93,7 +93,6 @@ public class ReviewController : BaseApiController
if (totalReviews > 10)
{
//var stepSize = Math.Max(totalReviews / 10, 1); // Calculate step size, ensuring it's at least 1
var stepSize = Math.Max((totalReviews - 4) / 8, 1);
var selectedReviews = new List<UserReviewDto>()

View file

@ -41,7 +41,7 @@ public class SeriesController : BaseApiController
private readonly IEasyCachingProvider _reviewCacheProvider;
private readonly IEasyCachingProvider _recommendationCacheProvider;
private readonly IEasyCachingProvider _externalSeriesCacheProvider;
public const string CacheKey = "recommendation_";
private const string CacheKey = "recommendation_";
public SeriesController(ILogger<SeriesController> logger, ITaskScheduler taskScheduler, IUnitOfWork unitOfWork,
@ -584,14 +584,14 @@ public class SeriesController : BaseApiController
[Authorize(Policy = "RequireAdminRole")]
[HttpGet("external-series-detail")]
public async Task<ActionResult<ExternalSeriesDto>> GetExternalSeriesInfo(int? aniListId, long? malId)
public async Task<ActionResult<ExternalSeriesDto>> GetExternalSeriesInfo(int? aniListId, long? malId, int? seriesId)
{
if (!await _licenseService.HasActiveLicense())
{
return BadRequest();
}
var cacheKey = $"{CacheKey}-{aniListId ?? 0}-{malId ?? 0}";
var cacheKey = $"{CacheKey}-{aniListId ?? 0}-{malId ?? 0}-{seriesId ?? 0}";
var results = await _externalSeriesCacheProvider.GetAsync<ExternalSeriesDto>(cacheKey);
if (results.HasValue)
{
@ -600,7 +600,7 @@ public class SeriesController : BaseApiController
try
{
var ret = await _externalMetadataService.GetExternalSeriesDetail(aniListId, malId);
var ret = await _externalMetadataService.GetExternalSeriesDetail(aniListId, malId, seriesId);
await _externalSeriesCacheProvider.SetAsync(cacheKey, ret, TimeSpan.FromMinutes(15));
return Ok(ret);
}