mirror of
https://github.com/Kareadita/Kavita.git
synced 2026-06-05 06:15:25 -04:00
Progress Overhaul + Profile Page and a LOT more! (#4262)
Co-authored-by: Amelia <77553571+Fesaa@users.noreply.github.com> Co-authored-by: Robbie Davis <robbie@therobbiedavis.com>
This commit is contained in:
@@ -3,7 +3,6 @@ using System.Threading.Tasks;
|
||||
using API.Data;
|
||||
using API.Data.Repositories;
|
||||
using API.DTOs;
|
||||
using API.Extensions;
|
||||
using API.Services;
|
||||
using API.Services.Plus;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -37,7 +36,7 @@ public class RatingController : BaseApiController
|
||||
[HttpPost("series")]
|
||||
public async Task<ActionResult> UpdateSeriesRating(UpdateRatingDto updateRating)
|
||||
{
|
||||
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(User.GetUserId(), AppUserIncludes.Ratings | AppUserIncludes.ChapterRatings);
|
||||
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(UserId, AppUserIncludes.Ratings | AppUserIncludes.ChapterRatings);
|
||||
if (user == null) throw new UnauthorizedAccessException();
|
||||
|
||||
if (await _ratingService.UpdateSeriesRating(user, updateRating))
|
||||
@@ -45,7 +44,7 @@ public class RatingController : BaseApiController
|
||||
return Ok();
|
||||
}
|
||||
|
||||
return BadRequest(await _localizationService.Translate(User.GetUserId(), "generic-error"));
|
||||
return BadRequest(await _localizationService.Translate(UserId, "generic-error"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -57,7 +56,7 @@ public class RatingController : BaseApiController
|
||||
[HttpPost("chapter")]
|
||||
public async Task<ActionResult> UpdateChapterRating(UpdateRatingDto updateRating)
|
||||
{
|
||||
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(User.GetUserId(), AppUserIncludes.Ratings | AppUserIncludes.ChapterRatings);
|
||||
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(UserId, AppUserIncludes.Ratings | AppUserIncludes.ChapterRatings);
|
||||
if (user == null) throw new UnauthorizedAccessException();
|
||||
|
||||
if (await _ratingService.UpdateChapterRating(user, updateRating))
|
||||
@@ -65,7 +64,7 @@ public class RatingController : BaseApiController
|
||||
return Ok();
|
||||
}
|
||||
|
||||
return BadRequest(await _localizationService.Translate(User.GetUserId(), "generic-error"));
|
||||
return BadRequest(await _localizationService.Translate(UserId, "generic-error"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -79,7 +78,7 @@ public class RatingController : BaseApiController
|
||||
return Ok(new RatingDto()
|
||||
{
|
||||
Provider = ScrobbleProvider.Kavita,
|
||||
AverageScore = await _unitOfWork.SeriesRepository.GetAverageUserRating(seriesId, User.GetUserId()),
|
||||
AverageScore = await _unitOfWork.SeriesRepository.GetAverageUserRating(seriesId, UserId),
|
||||
FavoriteCount = 0,
|
||||
});
|
||||
}
|
||||
@@ -95,7 +94,7 @@ public class RatingController : BaseApiController
|
||||
return Ok(new RatingDto()
|
||||
{
|
||||
Provider = ScrobbleProvider.Kavita,
|
||||
AverageScore = await _unitOfWork.ChapterRepository.GetAverageUserRating(chapterId, User.GetUserId()),
|
||||
AverageScore = await _unitOfWork.ChapterRepository.GetAverageUserRating(chapterId, UserId),
|
||||
FavoriteCount = 0,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user