diff options
| author | transtrike <transtrike@gmail.com> | 2021-02-15 21:50:36 +0200 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2021-02-15 21:50:36 +0200 |
| commit | ebf488fd51a2d1a83c124c380b9a1a98d62f42a2 (patch) | |
| tree | 6d410c4dd5bba288ed86db0e86ef7d83d5fbb686 /src | |
| parent | 4c03712af14c37718b7be5b23fcadeb86f2a2191 (diff) | |
| download | DevHive-ebf488fd51a2d1a83c124c380b9a1a98d62f42a2.tar DevHive-ebf488fd51a2d1a83c124c380b9a1a98d62f42a2.tar.gz DevHive-ebf488fd51a2d1a83c124c380b9a1a98d62f42a2.zip | |
Fixed formatting; Adjusted warnings; Adjusted variable names
Diffstat (limited to 'src')
14 files changed, 40 insertions, 42 deletions
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<Language> { HashSet<Language> GetLanguages(); - Task<Language> GetByNameAsync(string name); + 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 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<bool> AddNewPostToCreator(Guid userId, Post post); - Task<Post> GetPostByCreatorAndTimeCreatedAsync(Guid issuerId, DateTime timeCreated); + Task<Post> GetPostByCreatorAndTimeCreatedAsync(Guid creatorId, DateTime timeCreated); Task<List<string>> GetFileUrls(Guid postId); Task<bool> 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<Technology> { - Task<Technology> GetByNameAsync(string name); + Task<Technology> GetByNameAsync(string technologyName); HashSet<Technology> GetTechnologies(); Task<bool> 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<Guid> AddComment(CreateCommentServiceModel createPostServiceModel); + Task<Guid> AddComment(CreateCommentServiceModel createCommentServiceModel); Task<ReadCommentServiceModel> 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<RoleServiceModel> GetRoleById(Guid id); - Task<bool> UpdateRole(UpdateRoleServiceModel roleServiceModel); + Task<bool> UpdateRole(UpdateRoleServiceModel updateRoleServiceModel); Task<bool> 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<UserServiceModel> GetUserByUsername(string username); Task<UserServiceModel> GetUserById(Guid id); - Task<UserServiceModel> UpdateUser(UpdateUserServiceModel updateModel); + Task<UserServiceModel> UpdateUser(UpdateUserServiceModel updateUserServiceModel); Task<ProfilePictureServiceModel> UpdateProfilePicture(UpdateProfilePictureServiceModel updateProfilePictureServiceModel); Task<bool> 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<string> 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. /// </summary> - public async Task<ReadPageServiceModel> GetPage(GetPageServiceModel model) + public async Task<ReadPageServiceModel> 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<Post> 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<Startup>();
- });
- }
-}
+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<Startup>(); + }); + } +} |
