aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorOgnjen Cirkovic <ciraboxkg@gmail.com>2022-05-18 13:51:46 +0200
committerOgnjen Cirkovic <ciraboxkg@gmail.com>2022-05-18 13:51:46 +0200
commite86c8d3edda8912a891fb97e84b3f91d23a7e297 (patch)
tree82b09d5fba814889f2dc4f9814379b7ed206e661 /backend
parent8b539c658eda714a9886e169f7cd37953efff762 (diff)
Dodat api zahtev na back-u da korisnik moze da preuzme dataset sa id-jem.
Diffstat (limited to 'backend')
-rw-r--r--backend/api/api/Controllers/DatasetController.cs16
1 files changed, 16 insertions, 0 deletions
diff --git a/backend/api/api/Controllers/DatasetController.cs b/backend/api/api/Controllers/DatasetController.cs
index 7602a621..e1e36917 100644
--- a/backend/api/api/Controllers/DatasetController.cs
+++ b/backend/api/api/Controllers/DatasetController.cs
@@ -123,6 +123,22 @@ namespace api.Controllers
return dataset;
}
+ [HttpGet("get/{id}")]
+ [Authorize(Roles = "User,Guest")]
+ public ActionResult<Dataset> GetDatasetById(string id)
+ {
+ string userId = getUserId();
+
+ if (userId == null)
+ return BadRequest();
+
+ var dataset = _datasetService.GetOneDataset(userId, id);
+ if (dataset == null)
+ return NotFound($"Dataset with id = {id} not found or dataset is not public or not preprocessed");
+
+ return Ok(dataset);
+ }
+
// POST api/<DatasetController>/add
[HttpPost("add")]
[Authorize(Roles = "User,Guest")]