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/IRating.cs14
-rw-r--r--src/DevHive.Data/Interfaces/Models/IUser.cs1
-rw-r--r--src/DevHive.Data/Interfaces/Repositories/IRatingRepository.cs15
3 files changed, 30 insertions, 0 deletions
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..3e3ee7d 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
{
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);
+ }
+}