aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Data/Interfaces
diff options
context:
space:
mode:
Diffstat (limited to 'src/DevHive.Data/Interfaces')
-rw-r--r--src/DevHive.Data/Interfaces/Models/IPost.cs2
-rw-r--r--src/DevHive.Data/Interfaces/Models/IRating.cs14
-rw-r--r--src/DevHive.Data/Interfaces/Models/IUser.cs3
-rw-r--r--src/DevHive.Data/Interfaces/Repositories/IRatingRepository.cs15
4 files changed, 33 insertions, 1 deletions
diff --git a/src/DevHive.Data/Interfaces/Models/IPost.cs b/src/DevHive.Data/Interfaces/Models/IPost.cs
index 86469a7..65c0fb4 100644
--- a/src/DevHive.Data/Interfaces/Models/IPost.cs
+++ b/src/DevHive.Data/Interfaces/Models/IPost.cs
@@ -14,6 +14,8 @@ namespace DevHive.Data.Interfaces.Models
List<Comment> Comments { get; set; }
+ Rating Rating { get; set; }
+
List<string> FileUrls { get; set; }
}
}
diff --git a/src/DevHive.Data/Interfaces/Models/IRating.cs b/src/DevHive.Data/Interfaces/Models/IRating.cs
new file mode 100644
index 0000000..4604a75
--- /dev/null
+++ b/src/DevHive.Data/Interfaces/Models/IRating.cs
@@ -0,0 +1,14 @@
+using DevHive.Data.Interfaces.Models;
+using DevHive.Data.Models;
+
+namespace DevHive.Data.Interfaces.Models
+{
+ public interface IRating : IModel
+ {
+ Post Post { get; set; }
+
+ int Likes { get; set; }
+
+ int Dislikes { get; set; }
+ }
+}
diff --git a/src/DevHive.Data/Interfaces/Models/IUser.cs b/src/DevHive.Data/Interfaces/Models/IUser.cs
index 08ce385..90923fa 100644
--- a/src/DevHive.Data/Interfaces/Models/IUser.cs
+++ b/src/DevHive.Data/Interfaces/Models/IUser.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using DevHive.Data.Models;
+using DevHive.Data.RelationModels;
namespace DevHive.Data.Interfaces.Models
{
@@ -11,6 +12,6 @@ namespace DevHive.Data.Interfaces.Models
HashSet<Language> Languages { get; set; }
HashSet<Technology> Technologies { get; set; }
HashSet<Role> Roles { get; set; }
- HashSet<User> Friends { get; set; }
+ HashSet<UserFriends> Friends { get; set; }
}
}
diff --git a/src/DevHive.Data/Interfaces/Repositories/IRatingRepository.cs b/src/DevHive.Data/Interfaces/Repositories/IRatingRepository.cs
new file mode 100644
index 0000000..de4e3f2
--- /dev/null
+++ b/src/DevHive.Data/Interfaces/Repositories/IRatingRepository.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Threading.Tasks;
+using DevHive.Data.Models;
+using DevHive.Data.Repositories.Interfaces;
+
+namespace DevHive.Data.Interfaces.Repositories
+{
+ public interface IRatingRepository : IRepository<Rating>
+ {
+ Task<Rating> GetByPostId(Guid postId);
+ Task<Tuple<int, int>> GetRating(Guid postId);
+
+ Task<bool> HasUserRatedThisPost(Guid userId, Guid postId);
+ }
+}