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/IComment.cs16
-rw-r--r--src/DevHive.Data/Interfaces/Models/ILanguage.cs11
-rw-r--r--src/DevHive.Data/Interfaces/Models/IModel.cs9
-rw-r--r--src/DevHive.Data/Interfaces/Models/IPost.cs22
-rw-r--r--src/DevHive.Data/Interfaces/Models/IProfilePicture.cs13
-rw-r--r--src/DevHive.Data/Interfaces/Models/IRating.cs14
-rw-r--r--src/DevHive.Data/Interfaces/Models/IRole.cs10
-rw-r--r--src/DevHive.Data/Interfaces/Models/ITechnology.cs11
-rw-r--r--src/DevHive.Data/Interfaces/Models/IUser.cs21
-rw-r--r--src/DevHive.Data/Interfaces/Repositories/ICommentRepository.cs16
-rw-r--r--src/DevHive.Data/Interfaces/Repositories/IFeedRepository.cs13
-rw-r--r--src/DevHive.Data/Interfaces/Repositories/ILanguageRepository.cs17
-rw-r--r--src/DevHive.Data/Interfaces/Repositories/IPostRepository.cs19
-rw-r--r--src/DevHive.Data/Interfaces/Repositories/IRatingRepository.cs13
-rw-r--r--src/DevHive.Data/Interfaces/Repositories/IRepository.cs21
-rw-r--r--src/DevHive.Data/Interfaces/Repositories/IRoleRepository.cs15
-rw-r--r--src/DevHive.Data/Interfaces/Repositories/ITechnologyRepository.cs17
-rw-r--r--src/DevHive.Data/Interfaces/Repositories/IUserRepository.cs22
18 files changed, 280 insertions, 0 deletions
diff --git a/src/DevHive.Data/Interfaces/Models/IComment.cs b/src/DevHive.Data/Interfaces/Models/IComment.cs
new file mode 100644
index 0000000..97c1578
--- /dev/null
+++ b/src/DevHive.Data/Interfaces/Models/IComment.cs
@@ -0,0 +1,16 @@
+using System;
+using DevHive.Data.Models;
+
+namespace DevHive.Data.Interfaces.Models
+{
+ public interface IComment : IModel
+ {
+ Post Post { get; set; }
+
+ User Creator { get; set; }
+
+ string Message { get; set; }
+
+ DateTime TimeCreated { get; set; }
+ }
+}
diff --git a/src/DevHive.Data/Interfaces/Models/ILanguage.cs b/src/DevHive.Data/Interfaces/Models/ILanguage.cs
new file mode 100644
index 0000000..9eed09d
--- /dev/null
+++ b/src/DevHive.Data/Interfaces/Models/ILanguage.cs
@@ -0,0 +1,11 @@
+using System.Collections.Generic;
+using DevHive.Data.Models;
+
+namespace DevHive.Data.Interfaces.Models
+{
+ public interface ILanguage : IModel
+ {
+ string Name { get; set; }
+ HashSet<User> Users { get; set; }
+ }
+}
diff --git a/src/DevHive.Data/Interfaces/Models/IModel.cs b/src/DevHive.Data/Interfaces/Models/IModel.cs
new file mode 100644
index 0000000..f903af3
--- /dev/null
+++ b/src/DevHive.Data/Interfaces/Models/IModel.cs
@@ -0,0 +1,9 @@
+using System;
+
+namespace DevHive.Data.Interfaces.Models
+{
+ public interface IModel
+ {
+ Guid Id { get; set; }
+ }
+}
diff --git a/src/DevHive.Data/Interfaces/Models/IPost.cs b/src/DevHive.Data/Interfaces/Models/IPost.cs
new file mode 100644
index 0000000..712d955
--- /dev/null
+++ b/src/DevHive.Data/Interfaces/Models/IPost.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using DevHive.Data.Models;
+using DevHive.Data.RelationModels;
+
+namespace DevHive.Data.Interfaces.Models
+{
+ public interface IPost : IModel
+ {
+ User Creator { get; set; }
+
+ string Message { get; set; }
+
+ DateTime TimeCreated { get; set; }
+
+ List<Comment> Comments { get; set; }
+
+ // Rating Rating { get; set; }
+
+ List<PostAttachments> Attachments { get; set; }
+ }
+}
diff --git a/src/DevHive.Data/Interfaces/Models/IProfilePicture.cs b/src/DevHive.Data/Interfaces/Models/IProfilePicture.cs
new file mode 100644
index 0000000..c3fcbea
--- /dev/null
+++ b/src/DevHive.Data/Interfaces/Models/IProfilePicture.cs
@@ -0,0 +1,13 @@
+using System;
+using DevHive.Data.Models;
+
+namespace DevHive.Data.Interfaces.Models
+{
+ public interface IProfilePicture : IModel
+ {
+ Guid UserId { get; set; }
+ User User { get; set; }
+
+ string PictureURL { 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..d1b968f
--- /dev/null
+++ b/src/DevHive.Data/Interfaces/Models/IRating.cs
@@ -0,0 +1,14 @@
+using System.Collections.Generic;
+using DevHive.Data.Models;
+
+namespace DevHive.Data.Interfaces.Models
+{
+ public interface IRating : IModel
+ {
+ // Post Post { get; set; }
+
+ int Rate { get; set; }
+
+ // HashSet<User> UsersThatRated { get; set; }
+ }
+}
diff --git a/src/DevHive.Data/Interfaces/Models/IRole.cs b/src/DevHive.Data/Interfaces/Models/IRole.cs
new file mode 100644
index 0000000..c8b7068
--- /dev/null
+++ b/src/DevHive.Data/Interfaces/Models/IRole.cs
@@ -0,0 +1,10 @@
+using System.Collections.Generic;
+using DevHive.Data.Models;
+
+namespace DevHive.Data.Interfaces.Models
+{
+ public interface IRole
+ {
+ HashSet<User> Users { get; set; }
+ }
+}
diff --git a/src/DevHive.Data/Interfaces/Models/ITechnology.cs b/src/DevHive.Data/Interfaces/Models/ITechnology.cs
new file mode 100644
index 0000000..153f75f
--- /dev/null
+++ b/src/DevHive.Data/Interfaces/Models/ITechnology.cs
@@ -0,0 +1,11 @@
+using System.Collections.Generic;
+using DevHive.Data.Models;
+
+namespace DevHive.Data.Interfaces.Models
+{
+ public interface ITechnology : IModel
+ {
+ string Name { get; set; }
+ HashSet<User> Users { get; set; }
+ }
+}
diff --git a/src/DevHive.Data/Interfaces/Models/IUser.cs b/src/DevHive.Data/Interfaces/Models/IUser.cs
new file mode 100644
index 0000000..fcd741c
--- /dev/null
+++ b/src/DevHive.Data/Interfaces/Models/IUser.cs
@@ -0,0 +1,21 @@
+using System.Collections.Generic;
+using DevHive.Data.Models;
+using DevHive.Data.RelationModels;
+
+namespace DevHive.Data.Interfaces.Models
+{
+ public interface IUser : IModel
+ {
+ string FirstName { get; set; }
+
+ string LastName { get; set; }
+
+ ProfilePicture ProfilePicture { get; set; }
+
+ HashSet<Language> Languages { get; set; }
+
+ HashSet<Technology> Technologies { get; set; }
+
+ HashSet<Role> Roles { get; set; }
+ }
+}
diff --git a/src/DevHive.Data/Interfaces/Repositories/ICommentRepository.cs b/src/DevHive.Data/Interfaces/Repositories/ICommentRepository.cs
new file mode 100644
index 0000000..267f251
--- /dev/null
+++ b/src/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/DevHive.Data/Interfaces/Repositories/IFeedRepository.cs b/src/DevHive.Data/Interfaces/Repositories/IFeedRepository.cs
new file mode 100644
index 0000000..7262510
--- /dev/null
+++ b/src/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/DevHive.Data/Interfaces/Repositories/ILanguageRepository.cs b/src/DevHive.Data/Interfaces/Repositories/ILanguageRepository.cs
new file mode 100644
index 0000000..db2949a
--- /dev/null
+++ b/src/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/DevHive.Data/Interfaces/Repositories/IPostRepository.cs b/src/DevHive.Data/Interfaces/Repositories/IPostRepository.cs
new file mode 100644
index 0000000..9f7cf85
--- /dev/null
+++ b/src/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/DevHive.Data/Interfaces/Repositories/IRatingRepository.cs b/src/DevHive.Data/Interfaces/Repositories/IRatingRepository.cs
new file mode 100644
index 0000000..f77f301
--- /dev/null
+++ b/src/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/DevHive.Data/Interfaces/Repositories/IRepository.cs b/src/DevHive.Data/Interfaces/Repositories/IRepository.cs
new file mode 100644
index 0000000..0d11cd3
--- /dev/null
+++ b/src/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/DevHive.Data/Interfaces/Repositories/IRoleRepository.cs b/src/DevHive.Data/Interfaces/Repositories/IRoleRepository.cs
new file mode 100644
index 0000000..e834369
--- /dev/null
+++ b/src/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/DevHive.Data/Interfaces/Repositories/ITechnologyRepository.cs b/src/DevHive.Data/Interfaces/Repositories/ITechnologyRepository.cs
new file mode 100644
index 0000000..9126bfc
--- /dev/null
+++ b/src/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/DevHive.Data/Interfaces/Repositories/IUserRepository.cs b/src/DevHive.Data/Interfaces/Repositories/IUserRepository.cs
new file mode 100644
index 0000000..5ebe3d3
--- /dev/null
+++ b/src/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);
+ }
+}