diff options
| author | transtrike <transtrike@gmail.com> | 2021-01-11 23:49:34 +0200 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2021-01-11 23:49:34 +0200 |
| commit | 5d67bc4725c45515f0fdbd926cbf2752a794224f (patch) | |
| tree | 884a80c98d37d6292c14937c74df34f44e9189b0 /src/DevHive.Data/Repositories/Contracts | |
| parent | 0412b54d5ed02e1482a31c7f15866d5539adca7d (diff) | |
| parent | 407bc2cb7edd7b50967b691504176ca5c52586a0 (diff) | |
| download | DevHive-5d67bc4725c45515f0fdbd926cbf2752a794224f.tar DevHive-5d67bc4725c45515f0fdbd926cbf2752a794224f.tar.gz DevHive-5d67bc4725c45515f0fdbd926cbf2752a794224f.zip | |
Merge branch 'dev' of github.com:Team-Kaleidoscope/DevHive into dev
Diffstat (limited to 'src/DevHive.Data/Repositories/Contracts')
6 files changed, 109 insertions, 0 deletions
diff --git a/src/DevHive.Data/Repositories/Contracts/ILanguageRepository.cs b/src/DevHive.Data/Repositories/Contracts/ILanguageRepository.cs new file mode 100644 index 0000000..e44d27b --- /dev/null +++ b/src/DevHive.Data/Repositories/Contracts/ILanguageRepository.cs @@ -0,0 +1,13 @@ +using DevHive.Data.Models; +using System; +using System.Threading.Tasks; + +namespace DevHive.Data.Repositories.Contracts +{ + public interface ILanguageRepository : IRepository<Language> + { + public Task<bool> DoesLanguageNameExist(string languageName); + + public Task<bool> DoesLanguageExist(Guid id); + } +} diff --git a/src/DevHive.Data/Repositories/Contracts/IPostRepository.cs b/src/DevHive.Data/Repositories/Contracts/IPostRepository.cs new file mode 100644 index 0000000..930138a --- /dev/null +++ b/src/DevHive.Data/Repositories/Contracts/IPostRepository.cs @@ -0,0 +1,21 @@ +using DevHive.Data.Models; +using System; +using System.Threading.Tasks; + +namespace DevHive.Data.Repositories.Contracts +{ + public interface IPostRepository : IRepository<Post> + { + public Task<bool> AddCommentAsync(Comment entity); + + public Task<Comment> GetCommentByIdAsync(Guid id); + + public Task<bool> EditCommentAsync(Comment newEntity); + + public Task<bool> DeleteCommentAsync(Comment entity); + + public Task<bool> DoesPostExist(Guid postId); + + public Task<bool> DoesCommentExist(Guid id); + } +} diff --git a/src/DevHive.Data/Repositories/Contracts/IRepository.cs b/src/DevHive.Data/Repositories/Contracts/IRepository.cs new file mode 100644 index 0000000..37c5170 --- /dev/null +++ b/src/DevHive.Data/Repositories/Contracts/IRepository.cs @@ -0,0 +1,21 @@ +using System; +using System.Threading.Tasks; + +namespace DevHive.Data.Repositories.Contracts +{ + 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(TEntity newEntity); + + //Delete Entity from database + Task<bool> DeleteAsync(TEntity entity); + } +}
\ No newline at end of file diff --git a/src/DevHive.Data/Repositories/Contracts/IRoleRepository.cs b/src/DevHive.Data/Repositories/Contracts/IRoleRepository.cs new file mode 100644 index 0000000..6cb8a4e --- /dev/null +++ b/src/DevHive.Data/Repositories/Contracts/IRoleRepository.cs @@ -0,0 +1,15 @@ +using DevHive.Data.Models; +using System; +using System.Threading.Tasks; + +namespace DevHive.Data.Repositories.Contracts +{ + public interface IRoleRepository : IRepository<Role> + { + public Task<Role> GetByNameAsync(string name); + + public Task<bool> DoesNameExist(string name); + + public Task<bool> DoesRoleExist(Guid id); + } +} diff --git a/src/DevHive.Data/Repositories/Contracts/ITechnologyRepository.cs b/src/DevHive.Data/Repositories/Contracts/ITechnologyRepository.cs new file mode 100644 index 0000000..3c4a6b6 --- /dev/null +++ b/src/DevHive.Data/Repositories/Contracts/ITechnologyRepository.cs @@ -0,0 +1,13 @@ +using DevHive.Data.Models; +using System; +using System.Threading.Tasks; + +namespace DevHive.Data.Repositories.Contracts +{ + public interface ITechnologyRepository : IRepository<Technology> + { + public Task<bool> DoesTechnologyNameExist(string technologyName); + + public Task<bool> DoesTechnologyExist(Guid id); + } +} diff --git a/src/DevHive.Data/Repositories/Contracts/IUserRepository.cs b/src/DevHive.Data/Repositories/Contracts/IUserRepository.cs new file mode 100644 index 0000000..74c4486 --- /dev/null +++ b/src/DevHive.Data/Repositories/Contracts/IUserRepository.cs @@ -0,0 +1,26 @@ +using DevHive.Data.Models; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace DevHive.Data.Repositories.Contracts +{ + public interface IUserRepository : IRepository<User> + { + public Task<bool> AddFriendAsync(User user, User friend); + + public IEnumerable<User> QueryAll(); + + public Task<User> GetByUsername(string username); + + public Task<bool> RemoveFriendAsync(User user, User friend); + + public bool DoesUserExist(Guid id); + + public bool DoesUserHaveThisUsername(Guid id, string username); + + public Task<bool> DoesUsernameExist(string username); + + public Task<bool> DoesEmailExist(string email); + } +} |
