diff options
| author | transtrike <transtrike@gmail.com> | 2021-01-23 20:27:11 +0200 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2021-01-23 20:27:11 +0200 |
| commit | e2564f5a2ba87f06ef32137fad5c748f494fa42a (patch) | |
| tree | c03ef6b884dd2e913466f9d2a389fb068997360e /src/DevHive.Web | |
| parent | cc9734b155d1cd71536030dd1b2b387792f70e6f (diff) | |
| download | DevHive-e2564f5a2ba87f06ef32137fad5c748f494fa42a.tar DevHive-e2564f5a2ba87f06ef32137fad5c748f494fa42a.tar.gz DevHive-e2564f5a2ba87f06ef32137fad5c748f494fa42a.zip | |
Fixed Comment Models&Mappings
Diffstat (limited to 'src/DevHive.Web')
4 files changed, 26 insertions, 6 deletions
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<CommentWebModel, CommentServiceModel>(); - CreateMap<CommentWebModel, UpdateCommentServiceModel>(); - CreateMap<CommentServiceModel, CommentWebModel>(); - CreateMap<CommentWebModel, CommentServiceModel>(); + CreateMap<CreateCommentWebModel, CreateCommentServiceModel>(); + CreateMap<UpdateCommentWebModel, UpdateCommentServiceModel>(); + + CreateMap<ReadCommentServiceModel, ReadCommentWebModel>() + .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; } } } |
