From d53d67776f0746cc6eb8973f7c55767fcf82df65 Mon Sep 17 00:00:00 2001 From: Danail Dimitrov Date: Sat, 27 Feb 2021 22:13:47 +0200 Subject: adding delete rating functionality --- src/Web/DevHive.Web/Controllers/CommentController.cs | 1 - src/Web/DevHive.Web/Controllers/RatingController.cs | 11 +++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Web/DevHive.Web/Controllers/CommentController.cs b/src/Web/DevHive.Web/Controllers/CommentController.cs index c38e300..7273dda 100644 --- a/src/Web/DevHive.Web/Controllers/CommentController.cs +++ b/src/Web/DevHive.Web/Controllers/CommentController.cs @@ -77,7 +77,6 @@ namespace DevHive.Web.Controllers new OkResult() : new BadRequestObjectResult("Could not delete Comment"); } - } } diff --git a/src/Web/DevHive.Web/Controllers/RatingController.cs b/src/Web/DevHive.Web/Controllers/RatingController.cs index 33e6992..344acb2 100644 --- a/src/Web/DevHive.Web/Controllers/RatingController.cs +++ b/src/Web/DevHive.Web/Controllers/RatingController.cs @@ -71,5 +71,16 @@ namespace DevHive.Web.Controllers return new OkObjectResult(readRatingWebModel); } } + + [HttpDelete] + public async Task DeleteTating(Guid id, [FromHeader] string authorization) + { + if (!await this._rateService.ValidateJwtForRating(id, authorization)) + return new UnauthorizedResult(); + + return await this._rateService.DeleteRating(id) ? + new OkResult() : + new BadRequestObjectResult("Could not delete Rating"); + } } } -- cgit v1.2.3