aboutsummaryrefslogtreecommitdiff
path: root/src/Services
diff options
context:
space:
mode:
Diffstat (limited to 'src/Services')
-rw-r--r--src/Services/DevHive.Services.Models/Post/Rating/CreateRatingServiceModel.cs (renamed from src/Services/DevHive.Services.Models/Post/Rating/RatePostServiceModel.cs)4
-rw-r--r--src/Services/DevHive.Services.Models/Post/Rating/ReadRatingServiceModel.cs (renamed from src/Services/DevHive.Services.Models/Post/Rating/ReadPostRatingServiceModel.cs)2
-rw-r--r--src/Services/DevHive.Services.Models/Post/ReadPostServiceModel.cs3
-rw-r--r--src/Services/DevHive.Services/Interfaces/IRatingService.cs (renamed from src/Services/DevHive.Services/Interfaces/IRateService.cs)4
-rw-r--r--src/Services/DevHive.Services/Services/PostService.cs1
-rw-r--r--src/Services/DevHive.Services/Services/RatingService.cs (renamed from src/Services/DevHive.Services/Services/RateService.cs)8
6 files changed, 12 insertions, 10 deletions
diff --git a/src/Services/DevHive.Services.Models/Post/Rating/RatePostServiceModel.cs b/src/Services/DevHive.Services.Models/Post/Rating/CreateRatingServiceModel.cs
index d4eb7bd..aaeab73 100644
--- a/src/Services/DevHive.Services.Models/Post/Rating/RatePostServiceModel.cs
+++ b/src/Services/DevHive.Services.Models/Post/Rating/CreateRatingServiceModel.cs
@@ -2,12 +2,12 @@ using System;
namespace DevHive.Services.Models.Post.Rating
{
- public class RatePostServiceModel
+ public class CreateRatingServiceModel
{
public Guid UserId { get; set; }
public Guid PostId { get; set; }
- public bool Liked { get; set; }
+ public bool IsLike { get; set; }
}
}
diff --git a/src/Services/DevHive.Services.Models/Post/Rating/ReadPostRatingServiceModel.cs b/src/Services/DevHive.Services.Models/Post/Rating/ReadRatingServiceModel.cs
index 8c73aaf..dbc7ecc 100644
--- a/src/Services/DevHive.Services.Models/Post/Rating/ReadPostRatingServiceModel.cs
+++ b/src/Services/DevHive.Services.Models/Post/Rating/ReadRatingServiceModel.cs
@@ -2,7 +2,7 @@ using System;
namespace DevHive.Services.Models.Post.Rating
{
- public class ReadPostRatingServiceModel
+ public class ReadRatingServiceModel
{
public Guid Id { get; set; }
diff --git a/src/Services/DevHive.Services.Models/Post/ReadPostServiceModel.cs b/src/Services/DevHive.Services.Models/Post/ReadPostServiceModel.cs
index a7aa882..33d6520 100644
--- a/src/Services/DevHive.Services.Models/Post/ReadPostServiceModel.cs
+++ b/src/Services/DevHive.Services.Models/Post/ReadPostServiceModel.cs
@@ -21,6 +21,7 @@ namespace DevHive.Services.Models.Post
public List<IdModel> Comments { get; set; } = new();
public List<string> FileUrls { get; set; }
- // public List<FileContentResult> Files { get; set; } = new();
+
+ public int CurrentRating { get; set; }
}
}
diff --git a/src/Services/DevHive.Services/Interfaces/IRateService.cs b/src/Services/DevHive.Services/Interfaces/IRatingService.cs
index 359ef55..adb4313 100644
--- a/src/Services/DevHive.Services/Interfaces/IRateService.cs
+++ b/src/Services/DevHive.Services/Interfaces/IRatingService.cs
@@ -5,9 +5,9 @@ using DevHive.Services.Models.Post.Rating;
namespace DevHive.Services.Interfaces
{
- public interface IRateService
+ public interface IRatingService
{
- Task<ReadPostRatingServiceModel> RatePost(RatePostServiceModel ratePostServiceModel);
+ Task<ReadRatingServiceModel> RatePost(CreateRatingServiceModel ratePostServiceModel);
bool HasUserRatedThisPost(User user, Post post);
}
diff --git a/src/Services/DevHive.Services/Services/PostService.cs b/src/Services/DevHive.Services/Services/PostService.cs
index a3d5117..4bece90 100644
--- a/src/Services/DevHive.Services/Services/PostService.cs
+++ b/src/Services/DevHive.Services/Services/PostService.cs
@@ -46,6 +46,7 @@ namespace DevHive.Services.Services
post.Creator = await this._userRepository.GetByIdAsync(createPostServiceModel.CreatorId);
post.TimeCreated = DateTime.Now;
+ post.CurrentRating = 0;
bool success = await this._postRepository.AddAsync(post);
if (success)
diff --git a/src/Services/DevHive.Services/Services/RateService.cs b/src/Services/DevHive.Services/Services/RatingService.cs
index caf4b80..45ff7c0 100644
--- a/src/Services/DevHive.Services/Services/RateService.cs
+++ b/src/Services/DevHive.Services/Services/RatingService.cs
@@ -9,14 +9,14 @@ using DevHive.Services.Models.Post.Rating;
namespace DevHive.Services.Services
{
- public class RateService : IRateService
+ public class RatingService : IRatingService
{
private readonly IPostRepository _postRepository;
private readonly IUserRepository _userRepository;
private readonly IRatingRepository _ratingRepository;
private readonly IMapper _mapper;
- public RateService(IPostRepository postRepository, IRatingRepository ratingRepository, IUserRepository userRepository, IMapper mapper)
+ public RatingService(IPostRepository postRepository, IRatingRepository ratingRepository, IUserRepository userRepository, IMapper mapper)
{
this._postRepository = postRepository;
this._ratingRepository = ratingRepository;
@@ -24,7 +24,7 @@ namespace DevHive.Services.Services
this._mapper = mapper;
}
- public async Task<ReadPostRatingServiceModel> RatePost(RatePostServiceModel ratePostServiceModel)
+ public async Task<ReadRatingServiceModel> RatePost(CreateRatingServiceModel ratePostServiceModel)
{
throw new NotImplementedException();
// if (!await this._postRepository.DoesPostExist(ratePostServiceModel.PostId))
@@ -49,7 +49,7 @@ namespace DevHive.Services.Services
// return this._mapper.Map<ReadPostRatingServiceModel>(newRating);
}
- public async Task<ReadPostRatingServiceModel> RemoveUserRateFromPost(Guid userId, Guid postId)
+ public async Task<ReadRatingServiceModel> RemoveUserRateFromPost(Guid userId, Guid postId)
{
throw new NotImplementedException();
// Post post = await this._postRepository.GetByIdAsync(postId);