From e2564f5a2ba87f06ef32137fad5c748f494fa42a Mon Sep 17 00:00:00 2001 From: transtrike Date: Sat, 23 Jan 2021 20:27:11 +0200 Subject: Fixed Comment Models&Mappings --- src/DevHive.Web/Configurations/Mapping/CommentMappings.cs | 14 ++++++++++---- .../Models/Post/Comment/CreateCommentWebModel.cs | 13 ++++++++++++- src/DevHive.Web/Models/Post/Comment/ReadCommentWebModel.cs | 2 ++ .../Models/Post/Comment/UpdateCommentWebModel.cs | 3 ++- 4 files changed, 26 insertions(+), 6 deletions(-) (limited to 'src/DevHive.Web') diff --git a/src/DevHive.Web/Configurations/Mapping/CommentMappings.cs b/src/DevHive.Web/Configurations/Mapping/CommentMappings.cs index 5998e7a..296704e 100644 --- a/src/DevHive.Web/Configurations/Mapping/CommentMappings.cs +++ b/src/DevHive.Web/Configurations/Mapping/CommentMappings.cs @@ -8,10 +8,16 @@ namespace DevHive.Web.Configurations.Mapping { public CommentMappings() { - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); + CreateMap(); + CreateMap(); + + CreateMap() + .ForMember(dest => dest.IssuerFirstName, src => src.Ignore()) + .ForMember(dest => dest.IssuerLastName, src => src.Ignore()) + .ForMember(dest => dest.IssuerUsername, src => src.Ignore()); } } } + + + diff --git a/src/DevHive.Web/Models/Post/Comment/CreateCommentWebModel.cs b/src/DevHive.Web/Models/Post/Comment/CreateCommentWebModel.cs index 3680727..85c67bf 100644 --- a/src/DevHive.Web/Models/Post/Comment/CreateCommentWebModel.cs +++ b/src/DevHive.Web/Models/Post/Comment/CreateCommentWebModel.cs @@ -1,6 +1,17 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.Diagnostics.CodeAnalysis; + namespace DevHive.Web.Models.Post.Comment { - public class CreateCommentWebModel : BaseCommentWebModel + public class CreateCommentWebModel { + [NotNull] + [Required] + public Guid PostId { get; set; } + + [NotNull] + [Required] + public string Message { get; set; } } } diff --git a/src/DevHive.Web/Models/Post/Comment/ReadCommentWebModel.cs b/src/DevHive.Web/Models/Post/Comment/ReadCommentWebModel.cs index 2c4a367..5320c3c 100644 --- a/src/DevHive.Web/Models/Post/Comment/ReadCommentWebModel.cs +++ b/src/DevHive.Web/Models/Post/Comment/ReadCommentWebModel.cs @@ -4,6 +4,8 @@ namespace DevHive.Web.Models.Post.Comment { public class ReadCommentWebModel { + public Guid CommentId { get; set; } + public Guid PostId { get; set; } public string IssuerFirstName { get; set; } diff --git a/src/DevHive.Web/Models/Post/Comment/UpdateCommentWebModel.cs b/src/DevHive.Web/Models/Post/Comment/UpdateCommentWebModel.cs index 49f4540..8e78a48 100644 --- a/src/DevHive.Web/Models/Post/Comment/UpdateCommentWebModel.cs +++ b/src/DevHive.Web/Models/Post/Comment/UpdateCommentWebModel.cs @@ -1,6 +1,7 @@ namespace DevHive.Web.Models.Post.Comment { - public class UpdateCommentWebModel : BaseCommentWebModel + public class UpdateCommentWebModel { + public string NewMessage { get; set; } } } -- cgit v1.2.3