aboutsummaryrefslogtreecommitdiff
path: root/src/Data/DevHive.Data/Interfaces
diff options
context:
space:
mode:
authorKamen Mladenov <kamen.d.mladenov@protonmail.com>2021-04-09 19:51:35 +0300
committerGitHub <noreply@github.com>2021-04-09 19:51:35 +0300
commit233f38915ba0079079233eff55434ef349c05c45 (patch)
tree6c5f69017865bcab87355e910c87339453da1406 /src/Data/DevHive.Data/Interfaces
parentf4a70c6430db923af9fa9958a11c2d6612cb52cc (diff)
parenta992357efcf1bc1ece81b95ecee5e05a0b73bfdc (diff)
downloadDevHive-0.2.tar
DevHive-0.2.tar.gz
DevHive-0.2.zip
Merge pull request #28 from Team-Kaleidoscope/devHEADv0.2mainheroku/main
Second stage: Complete
Diffstat (limited to 'src/Data/DevHive.Data/Interfaces')
-rw-r--r--src/Data/DevHive.Data/Interfaces/ICommentRepository.cs15
-rw-r--r--src/Data/DevHive.Data/Interfaces/IFeedRepository.cs13
-rw-r--r--src/Data/DevHive.Data/Interfaces/ILanguageRepository.cs16
-rw-r--r--src/Data/DevHive.Data/Interfaces/IPostRepository.cs18
-rw-r--r--src/Data/DevHive.Data/Interfaces/IProfilePictureRepository.cs11
-rw-r--r--src/Data/DevHive.Data/Interfaces/IRatingRepository.cs15
-rw-r--r--src/Data/DevHive.Data/Interfaces/IRepository.cs21
-rw-r--r--src/Data/DevHive.Data/Interfaces/IRoleRepository.cs14
-rw-r--r--src/Data/DevHive.Data/Interfaces/ITechnologyRepository.cs16
-rw-r--r--src/Data/DevHive.Data/Interfaces/IUserRepository.cs23
10 files changed, 162 insertions, 0 deletions
diff --git a/src/Data/DevHive.Data/Interfaces/ICommentRepository.cs b/src/Data/DevHive.Data/Interfaces/ICommentRepository.cs
new file mode 100644
index 0000000..7b553ec
--- /dev/null
+++ b/src/Data/DevHive.Data/Interfaces/ICommentRepository.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using DevHive.Data.Models;
+
+namespace DevHive.Data.Interfaces
+{
+ public interface ICommentRepository : IRepository<Comment>
+ {
+ Task<List<Comment>> GetPostComments(Guid postId);
+
+ Task<bool> DoesCommentExist(Guid id);
+ Task<Comment> GetCommentByIssuerAndTimeCreatedAsync(Guid issuerId, DateTime timeCreated);
+ }
+}
diff --git a/src/Data/DevHive.Data/Interfaces/IFeedRepository.cs b/src/Data/DevHive.Data/Interfaces/IFeedRepository.cs
new file mode 100644
index 0000000..bda51fa
--- /dev/null
+++ b/src/Data/DevHive.Data/Interfaces/IFeedRepository.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using DevHive.Data.Models;
+
+namespace DevHive.Data.Interfaces
+{
+ public interface IFeedRepository
+ {
+ Task<List<Post>> GetFriendsPosts(List<User> friendsList, DateTime firstRequestIssued, int pageNumber, int pageSize);
+ Task<List<Post>> GetUsersPosts(User user, DateTime firstRequestIssued, int pageNumber, int pageSize);
+ }
+}
diff --git a/src/Data/DevHive.Data/Interfaces/ILanguageRepository.cs b/src/Data/DevHive.Data/Interfaces/ILanguageRepository.cs
new file mode 100644
index 0000000..af512c5
--- /dev/null
+++ b/src/Data/DevHive.Data/Interfaces/ILanguageRepository.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using DevHive.Data.Models;
+
+namespace DevHive.Data.Interfaces
+{
+ public interface ILanguageRepository : IRepository<Language>
+ {
+ HashSet<Language> GetLanguages();
+ Task<Language> GetByNameAsync(string languageName);
+
+ Task<bool> DoesLanguageExistAsync(Guid id);
+ Task<bool> DoesLanguageNameExistAsync(string languageName);
+ }
+}
diff --git a/src/Data/DevHive.Data/Interfaces/IPostRepository.cs b/src/Data/DevHive.Data/Interfaces/IPostRepository.cs
new file mode 100644
index 0000000..d40a487
--- /dev/null
+++ b/src/Data/DevHive.Data/Interfaces/IPostRepository.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using DevHive.Data.Models;
+
+namespace DevHive.Data.Interfaces
+{
+ public interface IPostRepository : IRepository<Post>
+ {
+ Task<bool> AddNewPostToCreator(Guid userId, Post post);
+
+ Task<Post> GetPostByCreatorAndTimeCreatedAsync(Guid creatorId, DateTime timeCreated);
+ Task<List<string>> GetFileUrls(Guid postId);
+
+ Task<bool> DoesPostExist(Guid postId);
+ Task<bool> DoesPostHaveFiles(Guid postId);
+ }
+}
diff --git a/src/Data/DevHive.Data/Interfaces/IProfilePictureRepository.cs b/src/Data/DevHive.Data/Interfaces/IProfilePictureRepository.cs
new file mode 100644
index 0000000..45beaa0
--- /dev/null
+++ b/src/Data/DevHive.Data/Interfaces/IProfilePictureRepository.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Threading.Tasks;
+using DevHive.Data.Models;
+
+namespace DevHive.Data.Interfaces
+{
+ public interface IProfilePictureRepository : IRepository<ProfilePicture>
+ {
+ Task<ProfilePicture> GetByURLAsync(string picUrl);
+ }
+}
diff --git a/src/Data/DevHive.Data/Interfaces/IRatingRepository.cs b/src/Data/DevHive.Data/Interfaces/IRatingRepository.cs
new file mode 100644
index 0000000..4840c59
--- /dev/null
+++ b/src/Data/DevHive.Data/Interfaces/IRatingRepository.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using DevHive.Data.Models;
+namespace DevHive.Data.Interfaces
+{
+ public interface IRatingRepository : IRepository<Rating>
+ {
+ Task<List<Rating>> GetRatingsByPostId(Guid postId);
+ Task<bool> UserRatedPost(Guid userId, Guid postId);
+ Task<Rating> GetRatingByUserAndPostId(Guid userId, Guid postId);
+
+ Task<bool> DoesRatingExist(Guid id);
+ }
+}
diff --git a/src/Data/DevHive.Data/Interfaces/IRepository.cs b/src/Data/DevHive.Data/Interfaces/IRepository.cs
new file mode 100644
index 0000000..7db8667
--- /dev/null
+++ b/src/Data/DevHive.Data/Interfaces/IRepository.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Threading.Tasks;
+
+namespace DevHive.Data.Interfaces
+{
+ public interface IRepository<TEntity>
+ where TEntity : class
+ {
+ //Add Entity to database
+ Task<bool> AddAsync(TEntity entity);
+
+ //Find entity by id
+ Task<TEntity> GetByIdAsync(Guid id);
+
+ //Modify Entity from database
+ Task<bool> EditAsync(Guid id, TEntity newEntity);
+
+ //Delete Entity from database
+ Task<bool> DeleteAsync(TEntity entity);
+ }
+}
diff --git a/src/Data/DevHive.Data/Interfaces/IRoleRepository.cs b/src/Data/DevHive.Data/Interfaces/IRoleRepository.cs
new file mode 100644
index 0000000..b12772c
--- /dev/null
+++ b/src/Data/DevHive.Data/Interfaces/IRoleRepository.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Threading.Tasks;
+using DevHive.Data.Models;
+
+namespace DevHive.Data.Interfaces
+{
+ public interface IRoleRepository : IRepository<Role>
+ {
+ Task<Role> GetByNameAsync(string name);
+
+ Task<bool> DoesNameExist(string name);
+ Task<bool> DoesRoleExist(Guid id);
+ }
+}
diff --git a/src/Data/DevHive.Data/Interfaces/ITechnologyRepository.cs b/src/Data/DevHive.Data/Interfaces/ITechnologyRepository.cs
new file mode 100644
index 0000000..91c82ea
--- /dev/null
+++ b/src/Data/DevHive.Data/Interfaces/ITechnologyRepository.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using DevHive.Data.Models;
+
+namespace DevHive.Data.Interfaces
+{
+ public interface ITechnologyRepository : IRepository<Technology>
+ {
+ Task<Technology> GetByNameAsync(string technologyName);
+ HashSet<Technology> GetTechnologies();
+
+ Task<bool> DoesTechnologyExistAsync(Guid id);
+ Task<bool> DoesTechnologyNameExistAsync(string technologyName);
+ }
+}
diff --git a/src/Data/DevHive.Data/Interfaces/IUserRepository.cs b/src/Data/DevHive.Data/Interfaces/IUserRepository.cs
new file mode 100644
index 0000000..494f540
--- /dev/null
+++ b/src/Data/DevHive.Data/Interfaces/IUserRepository.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using DevHive.Data.Models;
+
+namespace DevHive.Data.Interfaces
+{
+ public interface IUserRepository : IRepository<User>
+ {
+ Task<bool> AddRoleToUser(User user, string roleName);
+
+ Task<User> GetByUsernameAsync(string username);
+ Task<bool> UpdateProfilePicture(Guid userId, string pictureUrl);
+
+ Task<bool> VerifyPassword(User user, string password);
+ Task<bool> IsInRoleAsync(User user, string roleName);
+ Task<bool> ValidateFriendsCollectionAsync(List<string> usernames);
+ Task<bool> DoesEmailExistAsync(string email);
+ Task<bool> DoesUserExistAsync(Guid id);
+ Task<bool> DoesUsernameExistAsync(string username);
+ Task<bool> DoesUserHaveThisUsernameAsync(Guid id, string username);
+ }
+}