aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Web
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2021-02-02 10:38:58 +0200
committerSyndamia <kamen.d.mladenov@protonmail.com>2021-02-02 10:38:58 +0200
commit8178c3ca862fee815720cca760524b462a01704d (patch)
tree0ca7c4295e191c698c4d5cd83cee6342ea4c22f2 /src/DevHive.Web
parent482f16d7acc82e1f5720a95af18e1d713546bd4b (diff)
downloadDevHive-8178c3ca862fee815720cca760524b462a01704d.tar
DevHive-8178c3ca862fee815720cca760524b462a01704d.tar.gz
DevHive-8178c3ca862fee815720cca760524b462a01704d.zip
Fixed update comment web model and update method
Diffstat (limited to 'src/DevHive.Web')
-rw-r--r--src/DevHive.Web/Controllers/CommentController.cs5
-rw-r--r--src/DevHive.Web/Models/Comment/UpdateCommentWebModel.cs2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/DevHive.Web/Controllers/CommentController.cs b/src/DevHive.Web/Controllers/CommentController.cs
index 9c3eeee..c38e300 100644
--- a/src/DevHive.Web/Controllers/CommentController.cs
+++ b/src/DevHive.Web/Controllers/CommentController.cs
@@ -51,15 +51,14 @@ namespace DevHive.Web.Controllers
}
[HttpPut]
- public async Task<IActionResult> UpdateComment(Guid userId, Guid commentId, [FromBody] UpdateCommentWebModel updateCommentWebModel, [FromHeader] string authorization)
+ public async Task<IActionResult> UpdateComment(Guid userId, [FromBody] UpdateCommentWebModel updateCommentWebModel, [FromHeader] string authorization)
{
- if (!await this._commentService.ValidateJwtForComment(commentId, authorization))
+ if (!await this._commentService.ValidateJwtForComment(updateCommentWebModel.CommentId, authorization))
return new UnauthorizedResult();
UpdateCommentServiceModel updateCommentServiceModel =
this._commentMapper.Map<UpdateCommentServiceModel>(updateCommentWebModel);
updateCommentServiceModel.CreatorId = userId;
- updateCommentServiceModel.CommentId = commentId;
Guid id = await this._commentService.UpdateComment(updateCommentServiceModel);
diff --git a/src/DevHive.Web/Models/Comment/UpdateCommentWebModel.cs b/src/DevHive.Web/Models/Comment/UpdateCommentWebModel.cs
index 1e120fd..b5d7970 100644
--- a/src/DevHive.Web/Models/Comment/UpdateCommentWebModel.cs
+++ b/src/DevHive.Web/Models/Comment/UpdateCommentWebModel.cs
@@ -4,6 +4,8 @@ namespace DevHive.Web.Models.Comment
{
public class UpdateCommentWebModel
{
+ public Guid CommentId { get; set; }
+
public Guid PostId { get; set; }
public string NewMessage { get; set; }