aboutsummaryrefslogtreecommitdiff
path: root/src/Data/DevHive.Data/Interfaces/Repositories
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/DevHive.Data/Interfaces/Repositories')
-rw-r--r--src/Data/DevHive.Data/Interfaces/Repositories/ICommentRepository.cs16
-rw-r--r--src/Data/DevHive.Data/Interfaces/Repositories/IFeedRepository.cs13
-rw-r--r--src/Data/DevHive.Data/Interfaces/Repositories/ILanguageRepository.cs17
-rw-r--r--src/Data/DevHive.Data/Interfaces/Repositories/IPostRepository.cs19
-rw-r--r--src/Data/DevHive.Data/Interfaces/Repositories/IRatingRepository.cs13
-rw-r--r--src/Data/DevHive.Data/Interfaces/Repositories/IRepository.cs21
-rw-r--r--src/Data/DevHive.Data/Interfaces/Repositories/IRoleRepository.cs15
-rw-r--r--src/Data/DevHive.Data/Interfaces/Repositories/ITechnologyRepository.cs17
-rw-r--r--src/Data/DevHive.Data/Interfaces/Repositories/IUserRepository.cs22
9 files changed, 153 insertions, 0 deletions
diff --git a/src/Data/DevHive.Data/Interfaces/Repositories/ICommentRepository.cs b/src/Data/DevHive.Data/Interfaces/Repositories/ICommentRepository.cs
new file mode 100644
index 0000000..267f251
--- /dev/null
+++ b/src/Data/DevHive.Data/Interfaces/Repositories/ICommentRepository.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using DevHive.Data.Models;
+using DevHive.Data.Repositories.Interfaces;
+
+namespace DevHive.Data.Interfaces.Repositories
+{
+ 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/Repositories/IFeedRepository.cs b/src/Data/DevHive.Data/Interfaces/Repositories/IFeedRepository.cs
new file mode 100644
index 0000000..7262510
--- /dev/null
+++ b/src/Data/DevHive.Data/Interfaces/Repositories/IFeedRepository.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using DevHive.Data.Models;
+
+namespace DevHive.Data.Interfaces.Repositories
+{
+ 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/Repositories/ILanguageRepository.cs b/src/Data/DevHive.Data/Interfaces/Repositories/ILanguageRepository.cs
new file mode 100644
index 0000000..db2949a
--- /dev/null
+++ b/src/Data/DevHive.Data/Interfaces/Repositories/ILanguageRepository.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using DevHive.Data.Models;
+using DevHive.Data.Repositories.Interfaces;
+
+namespace DevHive.Data.Interfaces.Repositories
+{
+ public interface ILanguageRepository : IRepository<Language>
+ {
+ HashSet<Language> GetLanguages();
+ Task<Language> GetByNameAsync(string name);
+
+ Task<bool> DoesLanguageExistAsync(Guid id);
+ Task<bool> DoesLanguageNameExistAsync(string languageName);
+ }
+}
diff --git a/src/Data/DevHive.Data/Interfaces/Repositories/IPostRepository.cs b/src/Data/DevHive.Data/Interfaces/Repositories/IPostRepository.cs
new file mode 100644
index 0000000..9f7cf85
--- /dev/null
+++ b/src/Data/DevHive.Data/Interfaces/Repositories/IPostRepository.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using DevHive.Data.Models;
+using DevHive.Data.Repositories.Interfaces;
+
+namespace DevHive.Data.Interfaces.Repositories
+{
+ public interface IPostRepository : IRepository<Post>
+ {
+ Task<bool> AddNewPostToCreator(Guid userId, Post post);
+
+ Task<Post> GetPostByCreatorAndTimeCreatedAsync(Guid issuerId, 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/Repositories/IRatingRepository.cs b/src/Data/DevHive.Data/Interfaces/Repositories/IRatingRepository.cs
new file mode 100644
index 0000000..f77f301
--- /dev/null
+++ b/src/Data/DevHive.Data/Interfaces/Repositories/IRatingRepository.cs
@@ -0,0 +1,13 @@
+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> GetRatingByPostId(Guid postId);
+ Task<bool> UserRatedPost(Guid userId, Guid postId);
+ }
+}
diff --git a/src/Data/DevHive.Data/Interfaces/Repositories/IRepository.cs b/src/Data/DevHive.Data/Interfaces/Repositories/IRepository.cs
new file mode 100644
index 0000000..0d11cd3
--- /dev/null
+++ b/src/Data/DevHive.Data/Interfaces/Repositories/IRepository.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Threading.Tasks;
+
+namespace DevHive.Data.Repositories.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/Repositories/IRoleRepository.cs b/src/Data/DevHive.Data/Interfaces/Repositories/IRoleRepository.cs
new file mode 100644
index 0000000..e834369
--- /dev/null
+++ b/src/Data/DevHive.Data/Interfaces/Repositories/IRoleRepository.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 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/Repositories/ITechnologyRepository.cs b/src/Data/DevHive.Data/Interfaces/Repositories/ITechnologyRepository.cs
new file mode 100644
index 0000000..9126bfc
--- /dev/null
+++ b/src/Data/DevHive.Data/Interfaces/Repositories/ITechnologyRepository.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using DevHive.Data.Models;
+using DevHive.Data.Repositories.Interfaces;
+
+namespace DevHive.Data.Interfaces.Repositories
+{
+ public interface ITechnologyRepository : IRepository<Technology>
+ {
+ Task<Technology> GetByNameAsync(string name);
+ HashSet<Technology> GetTechnologies();
+
+ Task<bool> DoesTechnologyExistAsync(Guid id);
+ Task<bool> DoesTechnologyNameExistAsync(string technologyName);
+ }
+}
diff --git a/src/Data/DevHive.Data/Interfaces/Repositories/IUserRepository.cs b/src/Data/DevHive.Data/Interfaces/Repositories/IUserRepository.cs
new file mode 100644
index 0000000..5ebe3d3
--- /dev/null
+++ b/src/Data/DevHive.Data/Interfaces/Repositories/IUserRepository.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using DevHive.Data.Models;
+using DevHive.Data.Repositories.Interfaces;
+
+namespace DevHive.Data.Interfaces.Repositories
+{
+ public interface IUserRepository : IRepository<User>
+ {
+ //Read
+ Task<User> GetByUsernameAsync(string username);
+ Task<bool> UpdateProfilePicture(Guid userId, string pictureUrl);
+
+ //Validations
+ Task<bool> ValidateFriendsCollectionAsync(List<string> usernames);
+ Task<bool> DoesEmailExistAsync(string email);
+ Task<bool> DoesUserExistAsync(Guid id);
+ Task<bool> DoesUsernameExistAsync(string username);
+ bool DoesUserHaveThisUsername(Guid id, string username);
+ }
+}