Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Web / DevHive.Web / Controllers / RatingController.cs
diff options
context:
space:
mode:
Commitd53d67776f0746cc6eb8973f7c55767fcf82df65 (patch)
Author
 Danail Dimitrov <danaildimitrov321@gmail.com>
2021-02-27 22:13:47 +0200
Committer
 Danail Dimitrov <danaildimitrov321@gmail.com>
2021-02-27 22:13:47 +0200
Files81ea4baa834e777f08afa77cf1b51fbef8950f40 /src/Web/DevHive.Web/Controllers/RatingController.cs
DevHive-d53d67776f0746cc6eb8973f7c55767fcf82df65.tar
DevHive-d53d67776f0746cc6eb8973f7c55767fcf82df65.tar.gz
DevHive-d53d67776f0746cc6eb8973f7c55767fcf82df65.zip
Parent6089bc2e3b14155c334c9fed057383b9ca6e4df6 (diff)
adding delete rating functionality
1 files changed, 11 insertions, 0 deletions
-rw-r--r--src/Web/DevHive.Web/Controllers/RatingController.cs11
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");
+ }
}
}