aboutsummaryrefslogtreecommitdiff
path: root/src/Web/DevHive.Web
diff options
context:
space:
mode:
authorDanail Dimitrov <danaildimitrov321@gmail.com>2021-02-27 22:13:47 +0200
committerDanail Dimitrov <danaildimitrov321@gmail.com>2021-02-27 22:13:47 +0200
commitd53d67776f0746cc6eb8973f7c55767fcf82df65 (patch)
tree81ea4baa834e777f08afa77cf1b51fbef8950f40 /src/Web/DevHive.Web
parent6089bc2e3b14155c334c9fed057383b9ca6e4df6 (diff)
downloadDevHive-d53d67776f0746cc6eb8973f7c55767fcf82df65.tar
DevHive-d53d67776f0746cc6eb8973f7c55767fcf82df65.tar.gz
DevHive-d53d67776f0746cc6eb8973f7c55767fcf82df65.zip
adding delete rating functionality
Diffstat (limited to 'src/Web/DevHive.Web')
-rw-r--r--src/Web/DevHive.Web/Controllers/CommentController.cs1
-rw-r--r--src/Web/DevHive.Web/Controllers/RatingController.cs11
2 files changed, 11 insertions, 1 deletions
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<IActionResult> 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");
+ }
}
}