diff options
| author | Danail Dimitrov <danaildimitrov321@gmail.com> | 2021-03-03 10:27:26 +0200 |
|---|---|---|
| committer | Danail Dimitrov <danaildimitrov321@gmail.com> | 2021-03-03 10:27:26 +0200 |
| commit | f986ca67edd425c32eaec5a20fecdc5786f9d8e3 (patch) | |
| tree | 1d63feb6622257735a4a5e878ba9e7fd1cafbfc7 /src/Services | |
| parent | 804d274223734ea1c67920622ceb453cca602fc9 (diff) | |
| download | DevHive-f986ca67edd425c32eaec5a20fecdc5786f9d8e3.tar DevHive-f986ca67edd425c32eaec5a20fecdc5786f9d8e3.tar.gz DevHive-f986ca67edd425c32eaec5a20fecdc5786f9d8e3.zip | |
Fixing bugs in rating layer
Diffstat (limited to 'src/Services')
| -rw-r--r-- | src/Services/DevHive.Services/Interfaces/IRatingService.cs | 2 | ||||
| -rw-r--r-- | src/Services/DevHive.Services/Services/RatingService.cs | 8 |
2 files changed, 1 insertions, 9 deletions
diff --git a/src/Services/DevHive.Services/Interfaces/IRatingService.cs b/src/Services/DevHive.Services/Interfaces/IRatingService.cs index beea821..b262f45 100644 --- a/src/Services/DevHive.Services/Interfaces/IRatingService.cs +++ b/src/Services/DevHive.Services/Interfaces/IRatingService.cs @@ -16,7 +16,5 @@ namespace DevHive.Services.Interfaces Task<ReadRatingServiceModel> UpdateRating(UpdateRatingServiceModel updateRatingServiceModel); Task<bool> DeleteRating(Guid ratingId); - - Task<bool> HasUserRatedThisPost(Guid userId, Guid postId); } } diff --git a/src/Services/DevHive.Services/Services/RatingService.cs b/src/Services/DevHive.Services/Services/RatingService.cs index 6ddba1c..6d0d0b9 100644 --- a/src/Services/DevHive.Services/Services/RatingService.cs +++ b/src/Services/DevHive.Services/Services/RatingService.cs @@ -81,7 +81,7 @@ namespace DevHive.Services.Services #region Update public async Task<ReadRatingServiceModel> UpdateRating(UpdateRatingServiceModel updateRatingServiceModel) { - Rating rating = await this._ratingRepository.GetByIdAsync(updateRatingServiceModel.Id) ?? + Rating rating = await this._ratingRepository.GetRatingByUserAndPostId(updateRatingServiceModel.UserId, updateRatingServiceModel.PostId) ?? throw new ArgumentException("Rating does not exist!"); User user = await this._userRepository.GetByIdAsync(updateRatingServiceModel.UserId) ?? @@ -115,11 +115,5 @@ namespace DevHive.Services.Services return await this._ratingRepository.DeleteAsync(rating); } #endregion - - public async Task<bool> HasUserRatedThisPost(Guid userId, Guid postId) - { - return await this._ratingRepository - .UserRatedPost(userId, postId); - } } } |
