From c5b27c7eb62cc5428a0c01ffcf381f429d776122 Mon Sep 17 00:00:00 2001 From: transtrike Date: Sat, 13 Feb 2021 17:57:54 +0200 Subject: Removed all references --- src/Data/DevHive.Data/Interfaces/IPostRepository.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/Data/DevHive.Data/Interfaces/IPostRepository.cs (limited to 'src/Data/DevHive.Data/Interfaces/IPostRepository.cs') diff --git a/src/Data/DevHive.Data/Interfaces/IPostRepository.cs b/src/Data/DevHive.Data/Interfaces/IPostRepository.cs new file mode 100644 index 0000000..c24d596 --- /dev/null +++ b/src/Data/DevHive.Data/Interfaces/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 +{ + public interface IPostRepository : IRepository + { + Task AddNewPostToCreator(Guid userId, Post post); + + Task GetPostByCreatorAndTimeCreatedAsync(Guid issuerId, DateTime timeCreated); + Task> GetFileUrls(Guid postId); + + Task DoesPostExist(Guid postId); + Task DoesPostHaveFiles(Guid postId); + } +} -- cgit v1.2.3 From ebf488fd51a2d1a83c124c380b9a1a98d62f42a2 Mon Sep 17 00:00:00 2001 From: transtrike Date: Mon, 15 Feb 2021 21:50:36 +0200 Subject: Fixed formatting; Adjusted warnings; Adjusted variable names --- src/Data/DevHive.Data.Models/Comment.cs | 2 + .../DevHive.Data/Interfaces/ILanguageRepository.cs | 2 +- .../DevHive.Data/Interfaces/IPostRepository.cs | 2 +- .../Interfaces/ITechnologyRepository.cs | 2 +- .../DevHive.Services/Interfaces/ICommentService.cs | 2 +- .../DevHive.Services/Interfaces/IRoleService.cs | 2 +- .../DevHive.Services/Interfaces/IUserService.cs | 2 +- .../DevHive.Services/Services/CommentService.cs | 1 - .../DevHive.Services/Services/FeedService.cs | 12 +++--- .../DevHive.Services/Services/RateService.cs | 2 +- .../DevHive.Web.Tests/CommentController.Tests.cs | 2 - src/Web/DevHive.Web.Tests/UserController.Tests.cs | 1 - .../Configurations/Extensions/ConfigureJwt.cs | 2 - src/Web/DevHive.Web/Program.cs | 48 +++++++++++----------- 14 files changed, 40 insertions(+), 42 deletions(-) (limited to 'src/Data/DevHive.Data/Interfaces/IPostRepository.cs') diff --git a/src/Data/DevHive.Data.Models/Comment.cs b/src/Data/DevHive.Data.Models/Comment.cs index 10a3aaf..f907e43 100644 --- a/src/Data/DevHive.Data.Models/Comment.cs +++ b/src/Data/DevHive.Data.Models/Comment.cs @@ -8,9 +8,11 @@ namespace DevHive.Data.Models public Guid Id { get; set; } // public Guid PostId { get; set; } + public Post Post { get; set; } // public Guid CreatorId { get; set; } + public User Creator { get; set; } public string Message { get; set; } diff --git a/src/Data/DevHive.Data/Interfaces/ILanguageRepository.cs b/src/Data/DevHive.Data/Interfaces/ILanguageRepository.cs index 4771f91..ea0e8c6 100644 --- a/src/Data/DevHive.Data/Interfaces/ILanguageRepository.cs +++ b/src/Data/DevHive.Data/Interfaces/ILanguageRepository.cs @@ -9,7 +9,7 @@ namespace DevHive.Data.Interfaces public interface ILanguageRepository : IRepository { HashSet GetLanguages(); - Task GetByNameAsync(string name); + Task GetByNameAsync(string languageName); Task DoesLanguageExistAsync(Guid id); Task DoesLanguageNameExistAsync(string languageName); diff --git a/src/Data/DevHive.Data/Interfaces/IPostRepository.cs b/src/Data/DevHive.Data/Interfaces/IPostRepository.cs index c24d596..5a04aed 100644 --- a/src/Data/DevHive.Data/Interfaces/IPostRepository.cs +++ b/src/Data/DevHive.Data/Interfaces/IPostRepository.cs @@ -10,7 +10,7 @@ namespace DevHive.Data.Interfaces { Task AddNewPostToCreator(Guid userId, Post post); - Task GetPostByCreatorAndTimeCreatedAsync(Guid issuerId, DateTime timeCreated); + Task GetPostByCreatorAndTimeCreatedAsync(Guid creatorId, DateTime timeCreated); Task> GetFileUrls(Guid postId); Task DoesPostExist(Guid postId); diff --git a/src/Data/DevHive.Data/Interfaces/ITechnologyRepository.cs b/src/Data/DevHive.Data/Interfaces/ITechnologyRepository.cs index 3e55b2d..f746d9d 100644 --- a/src/Data/DevHive.Data/Interfaces/ITechnologyRepository.cs +++ b/src/Data/DevHive.Data/Interfaces/ITechnologyRepository.cs @@ -8,7 +8,7 @@ namespace DevHive.Data.Interfaces { public interface ITechnologyRepository : IRepository { - Task GetByNameAsync(string name); + Task GetByNameAsync(string technologyName); HashSet GetTechnologies(); Task DoesTechnologyExistAsync(Guid id); diff --git a/src/Services/DevHive.Services/Interfaces/ICommentService.cs b/src/Services/DevHive.Services/Interfaces/ICommentService.cs index e7409a8..6d92a5d 100644 --- a/src/Services/DevHive.Services/Interfaces/ICommentService.cs +++ b/src/Services/DevHive.Services/Interfaces/ICommentService.cs @@ -6,7 +6,7 @@ namespace DevHive.Services.Interfaces { public interface ICommentService { - Task AddComment(CreateCommentServiceModel createPostServiceModel); + Task AddComment(CreateCommentServiceModel createCommentServiceModel); Task GetCommentById(Guid id); diff --git a/src/Services/DevHive.Services/Interfaces/IRoleService.cs b/src/Services/DevHive.Services/Interfaces/IRoleService.cs index 05df917..36e5a01 100644 --- a/src/Services/DevHive.Services/Interfaces/IRoleService.cs +++ b/src/Services/DevHive.Services/Interfaces/IRoleService.cs @@ -10,7 +10,7 @@ namespace DevHive.Services.Interfaces Task GetRoleById(Guid id); - Task UpdateRole(UpdateRoleServiceModel roleServiceModel); + Task UpdateRole(UpdateRoleServiceModel updateRoleServiceModel); Task DeleteRole(Guid id); } diff --git a/src/Services/DevHive.Services/Interfaces/IUserService.cs b/src/Services/DevHive.Services/Interfaces/IUserService.cs index daa5e5e..4a9ffc8 100644 --- a/src/Services/DevHive.Services/Interfaces/IUserService.cs +++ b/src/Services/DevHive.Services/Interfaces/IUserService.cs @@ -13,7 +13,7 @@ namespace DevHive.Services.Interfaces Task GetUserByUsername(string username); Task GetUserById(Guid id); - Task UpdateUser(UpdateUserServiceModel updateModel); + Task UpdateUser(UpdateUserServiceModel updateUserServiceModel); Task UpdateProfilePicture(UpdateProfilePictureServiceModel updateProfilePictureServiceModel); Task DeleteUser(Guid id); diff --git a/src/Services/DevHive.Services/Services/CommentService.cs b/src/Services/DevHive.Services/Services/CommentService.cs index e14f3bb..b48bac8 100644 --- a/src/Services/DevHive.Services/Services/CommentService.cs +++ b/src/Services/DevHive.Services/Services/CommentService.cs @@ -142,7 +142,6 @@ namespace DevHive.Services.Services JwtSecurityToken jwt = new JwtSecurityTokenHandler().ReadJwtToken(rawTokenData.Remove(0, 7)); Guid jwtUserId = Guid.Parse(this.GetClaimTypeValues("ID", jwt.Claims).First()); - //HashSet jwtRoleNames = this.GetClaimTypeValues("role", jwt.Claims); User user = await this._userRepository.GetByIdAsync(jwtUserId) ?? throw new ArgumentException("User does not exist!"); diff --git a/src/Services/DevHive.Services/Services/FeedService.cs b/src/Services/DevHive.Services/Services/FeedService.cs index 17cc43f..c16ffae 100644 --- a/src/Services/DevHive.Services/Services/FeedService.cs +++ b/src/Services/DevHive.Services/Services/FeedService.cs @@ -28,14 +28,14 @@ namespace DevHive.Services.Services /// This method is used in the feed page. /// See the FeedRepository "GetFriendsPosts" menthod for more information on how it works. /// - public async Task GetPage(GetPageServiceModel model) + public async Task GetPage(GetPageServiceModel getPageServiceModel) { User user = null; - if (model.UserId != Guid.Empty) - user = await this._userRepository.GetByIdAsync(model.UserId); - else if (!string.IsNullOrEmpty(model.Username)) - user = await this._userRepository.GetByUsernameAsync(model.Username); + if (getPageServiceModel.UserId != Guid.Empty) + user = await this._userRepository.GetByIdAsync(getPageServiceModel.UserId); + else if (!string.IsNullOrEmpty(getPageServiceModel.Username)) + user = await this._userRepository.GetByUsernameAsync(getPageServiceModel.Username); else throw new ArgumentException("Invalid given data!"); @@ -46,7 +46,7 @@ namespace DevHive.Services.Services throw new ArgumentException("User has no friends to get feed from!"); List posts = await this._feedRepository - .GetFriendsPosts(user.Friends.ToList(), model.FirstRequestIssued, model.PageNumber, model.PageSize); + .GetFriendsPosts(user.Friends.ToList(), getPageServiceModel.FirstRequestIssued, getPageServiceModel.PageNumber, getPageServiceModel.PageSize); ReadPageServiceModel readPageServiceModel = new(); foreach (Post post in posts) diff --git a/src/Services/DevHive.Services/Services/RateService.cs b/src/Services/DevHive.Services/Services/RateService.cs index 5e924ab..caf4b80 100644 --- a/src/Services/DevHive.Services/Services/RateService.cs +++ b/src/Services/DevHive.Services/Services/RateService.cs @@ -28,7 +28,7 @@ namespace DevHive.Services.Services { throw new NotImplementedException(); // if (!await this._postRepository.DoesPostExist(ratePostServiceModel.PostId)) - // throw new ArgumentException("Post does not exist!"); + // throw new ArgumentException("Post does not exist!"); // if (!await this._userRepository.DoesUserExistAsync(ratePostServiceModel.UserId)) // throw new ArgumentException("User does not exist!"); diff --git a/src/Web/DevHive.Web.Tests/CommentController.Tests.cs b/src/Web/DevHive.Web.Tests/CommentController.Tests.cs index 98397e7..7860f3c 100644 --- a/src/Web/DevHive.Web.Tests/CommentController.Tests.cs +++ b/src/Web/DevHive.Web.Tests/CommentController.Tests.cs @@ -66,7 +66,6 @@ namespace DevHive.Web.Tests [Test] public void AddComment_ReturnsBadRequestObjectResult_WhenCommentIsNotCreatedSuccessfully() { - Guid id = Guid.NewGuid(); CreateCommentWebModel createCommentWebModel = new() { Message = MESSAGE @@ -113,7 +112,6 @@ namespace DevHive.Web.Tests public void GetById_ReturnsTheComment_WhenItExists() { Guid id = Guid.NewGuid(); - ReadCommentServiceModel readCommentServiceModel = new() { Message = MESSAGE diff --git a/src/Web/DevHive.Web.Tests/UserController.Tests.cs b/src/Web/DevHive.Web.Tests/UserController.Tests.cs index 13f618e..e12738e 100644 --- a/src/Web/DevHive.Web.Tests/UserController.Tests.cs +++ b/src/Web/DevHive.Web.Tests/UserController.Tests.cs @@ -32,7 +32,6 @@ namespace DevHive.Web.Tests [Test] public void LoginUser_ReturnsOkObjectResult_WhenUserIsSuccessfullyLoggedIn() { - Guid id = Guid.NewGuid(); LoginWebModel loginWebModel = new() { UserName = USERNAME diff --git a/src/Web/DevHive.Web/Configurations/Extensions/ConfigureJwt.cs b/src/Web/DevHive.Web/Configurations/Extensions/ConfigureJwt.cs index 03d4b11..8d387bd 100644 --- a/src/Web/DevHive.Web/Configurations/Extensions/ConfigureJwt.cs +++ b/src/Web/DevHive.Web/Configurations/Extensions/ConfigureJwt.cs @@ -35,7 +35,6 @@ namespace DevHive.Web.Configurations.Extensions { OnTokenValidated = context => { - // TODO: add more authentication return Task.CompletedTask; } }; @@ -43,7 +42,6 @@ namespace DevHive.Web.Configurations.Extensions x.SaveToken = true; x.TokenValidationParameters = new TokenValidationParameters { - //ValidateIssuerSigningKey = false, IssuerSigningKey = new SymmetricSecurityKey(key), ValidateIssuer = false, ValidateAudience = false diff --git a/src/Web/DevHive.Web/Program.cs b/src/Web/DevHive.Web/Program.cs index 6982da9..fdb6889 100644 --- a/src/Web/DevHive.Web/Program.cs +++ b/src/Web/DevHive.Web/Program.cs @@ -1,23 +1,25 @@ -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Hosting; - -namespace DevHive.Web -{ - public class Program - { - private const int HTTP_PORT = 5000; - - public static void Main(string[] args) - { - CreateHostBuilder(args).Build().Run(); - } - - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder.ConfigureKestrel(opt => opt.ListenLocalhost(HTTP_PORT)); - webBuilder.UseStartup(); - }); - } -} +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; + +namespace DevHive.Web +{ + #pragma warning disable IDE0055, S1118 + + public class Program + { + private const int HTTP_PORT = 5000; + + public static void Main(string[] args) + { + CreateHostBuilder(args).Build().Run(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.ConfigureKestrel(opt => opt.ListenLocalhost(HTTP_PORT)); + webBuilder.UseStartup(); + }); + } +} -- cgit v1.2.3 From 99e3bbad3f4d2ab5999d0de508907e5985e721a4 Mon Sep 17 00:00:00 2001 From: transtrike Date: Wed, 17 Mar 2021 17:19:36 +0200 Subject: IRepository namespace fix; Useless folder removed --- src/Data/DevHive.Data/Interfaces/ICommentRepository.cs | 1 - src/Data/DevHive.Data/Interfaces/ILanguageRepository.cs | 1 - src/Data/DevHive.Data/Interfaces/IPostRepository.cs | 1 - src/Data/DevHive.Data/Interfaces/IRatingRepository.cs | 2 -- src/Data/DevHive.Data/Interfaces/IRepository.cs | 2 +- src/Data/DevHive.Data/Interfaces/IRoleRepository.cs | 1 - src/Data/DevHive.Data/Interfaces/ITechnologyRepository.cs | 1 - src/Data/DevHive.Data/Interfaces/IUserRepository.cs | 1 - src/Data/DevHive.Data/Repositories/BaseRepository.cs | 2 +- 9 files changed, 2 insertions(+), 10 deletions(-) (limited to 'src/Data/DevHive.Data/Interfaces/IPostRepository.cs') diff --git a/src/Data/DevHive.Data/Interfaces/ICommentRepository.cs b/src/Data/DevHive.Data/Interfaces/ICommentRepository.cs index f85849f..7b553ec 100644 --- a/src/Data/DevHive.Data/Interfaces/ICommentRepository.cs +++ b/src/Data/DevHive.Data/Interfaces/ICommentRepository.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; using DevHive.Data.Models; -using DevHive.Data.Repositories.Interfaces; namespace DevHive.Data.Interfaces { diff --git a/src/Data/DevHive.Data/Interfaces/ILanguageRepository.cs b/src/Data/DevHive.Data/Interfaces/ILanguageRepository.cs index ea0e8c6..af512c5 100644 --- a/src/Data/DevHive.Data/Interfaces/ILanguageRepository.cs +++ b/src/Data/DevHive.Data/Interfaces/ILanguageRepository.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; using DevHive.Data.Models; -using DevHive.Data.Repositories.Interfaces; namespace DevHive.Data.Interfaces { diff --git a/src/Data/DevHive.Data/Interfaces/IPostRepository.cs b/src/Data/DevHive.Data/Interfaces/IPostRepository.cs index 5a04aed..d40a487 100644 --- a/src/Data/DevHive.Data/Interfaces/IPostRepository.cs +++ b/src/Data/DevHive.Data/Interfaces/IPostRepository.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; using DevHive.Data.Models; -using DevHive.Data.Repositories.Interfaces; namespace DevHive.Data.Interfaces { diff --git a/src/Data/DevHive.Data/Interfaces/IRatingRepository.cs b/src/Data/DevHive.Data/Interfaces/IRatingRepository.cs index db37d00..4840c59 100644 --- a/src/Data/DevHive.Data/Interfaces/IRatingRepository.cs +++ b/src/Data/DevHive.Data/Interfaces/IRatingRepository.cs @@ -2,8 +2,6 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; using DevHive.Data.Models; -using DevHive.Data.Repositories.Interfaces; - namespace DevHive.Data.Interfaces { public interface IRatingRepository : IRepository diff --git a/src/Data/DevHive.Data/Interfaces/IRepository.cs b/src/Data/DevHive.Data/Interfaces/IRepository.cs index 0d11cd3..7db8667 100644 --- a/src/Data/DevHive.Data/Interfaces/IRepository.cs +++ b/src/Data/DevHive.Data/Interfaces/IRepository.cs @@ -1,7 +1,7 @@ using System; using System.Threading.Tasks; -namespace DevHive.Data.Repositories.Interfaces +namespace DevHive.Data.Interfaces { public interface IRepository where TEntity : class diff --git a/src/Data/DevHive.Data/Interfaces/IRoleRepository.cs b/src/Data/DevHive.Data/Interfaces/IRoleRepository.cs index a1080bb..b12772c 100644 --- a/src/Data/DevHive.Data/Interfaces/IRoleRepository.cs +++ b/src/Data/DevHive.Data/Interfaces/IRoleRepository.cs @@ -1,7 +1,6 @@ using System; using System.Threading.Tasks; using DevHive.Data.Models; -using DevHive.Data.Repositories.Interfaces; namespace DevHive.Data.Interfaces { diff --git a/src/Data/DevHive.Data/Interfaces/ITechnologyRepository.cs b/src/Data/DevHive.Data/Interfaces/ITechnologyRepository.cs index f746d9d..91c82ea 100644 --- a/src/Data/DevHive.Data/Interfaces/ITechnologyRepository.cs +++ b/src/Data/DevHive.Data/Interfaces/ITechnologyRepository.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; using DevHive.Data.Models; -using DevHive.Data.Repositories.Interfaces; namespace DevHive.Data.Interfaces { diff --git a/src/Data/DevHive.Data/Interfaces/IUserRepository.cs b/src/Data/DevHive.Data/Interfaces/IUserRepository.cs index aec0eb3..494f540 100644 --- a/src/Data/DevHive.Data/Interfaces/IUserRepository.cs +++ b/src/Data/DevHive.Data/Interfaces/IUserRepository.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; using DevHive.Data.Models; -using DevHive.Data.Repositories.Interfaces; namespace DevHive.Data.Interfaces { diff --git a/src/Data/DevHive.Data/Repositories/BaseRepository.cs b/src/Data/DevHive.Data/Repositories/BaseRepository.cs index ece372e..239a3bc 100644 --- a/src/Data/DevHive.Data/Repositories/BaseRepository.cs +++ b/src/Data/DevHive.Data/Repositories/BaseRepository.cs @@ -1,6 +1,6 @@ using System; using System.Threading.Tasks; -using DevHive.Data.Repositories.Interfaces; +using DevHive.Data.Interfaces; using Microsoft.EntityFrameworkCore; namespace DevHive.Data.Repositories -- cgit v1.2.3