diff options
author | Ivan Ljubisavljevic <ivan996sk@gmail.com> | 2022-03-14 23:48:37 +0100 |
---|---|---|
committer | Ivan Ljubisavljevic <ivan996sk@gmail.com> | 2022-03-14 23:48:37 +0100 |
commit | 4791e1ba6d4c3c737e675f54a947251c3d42163d (patch) | |
tree | 224acbd52401661627f4cc402bbf3aee9f3d9a61 /backend | |
parent | 7ff5981a464b17f84b7e0268077c5ba6ec131e21 (diff) |
Ispravljeni ispisi u dataset kontroleru i ispravljena konekcija za lokalnu bazu.
Diffstat (limited to 'backend')
-rw-r--r-- | backend/api/api/Controllers/DatasetController.cs | 10 | ||||
-rw-r--r-- | backend/api/api/appsettings.json | 5 |
2 files changed, 8 insertions, 7 deletions
diff --git a/backend/api/api/Controllers/DatasetController.cs b/backend/api/api/Controllers/DatasetController.cs index d022d6d2..fcebc4b0 100644 --- a/backend/api/api/Controllers/DatasetController.cs +++ b/backend/api/api/Controllers/DatasetController.cs @@ -32,12 +32,12 @@ namespace api.Controllers var dataset = _datasetService.GetOneDataset(id, name); if (dataset == null) - return NotFound($"Dataset with name = {name} not found"); + return NotFound($"Dataset with name = {name} or user with id = {id} not found"); return dataset; } - // POST api/<DatasetController> + // POST api/<DatasetController>/post [HttpPost("post")] public ActionResult<Dataset> Post([FromBody] Dataset dataset) { @@ -53,7 +53,7 @@ namespace api.Controllers } } - // PUT api/<DatasetController>/5 + // PUT api/<DatasetController>/{id}/{name} [HttpPut("{id}/{name}")] public ActionResult Put(string id, string name, [FromBody] Dataset dataset) { @@ -61,7 +61,7 @@ namespace api.Controllers //ne mora da se proverava if (existingDataset == null) - return NotFound($"Dataset with name = {name} not found"); + return NotFound($"Dataset with name = {name} or user with id = {id} not found"); _datasetService.Update(id, name, dataset); return NoContent(); @@ -74,7 +74,7 @@ namespace api.Controllers var dataset = _datasetService.GetOneDataset(id, name); if (dataset == null) - return NotFound($"Dataset with name = {name} not found"); + return NotFound($"Dataset with name = {name} or user with id = {id} not found"); _datasetService.Delete(dataset.uploaderId,dataset.name); diff --git a/backend/api/api/appsettings.json b/backend/api/api/appsettings.json index 3661f171..9b4f00a3 100644 --- a/backend/api/api/appsettings.json +++ b/backend/api/api/appsettings.json @@ -13,11 +13,12 @@ /* LocalHost "ConnectionString": "mongodb://127.0.0.1:27017/", "DatabaseName": "si_project", - "CollectionName": "User" + "CollectionName": "User", + "DatasetCollectionName" : "Dataset" */ "ConnectionString": "mongodb+srv://si_user:si_user@sidatabase.twtfm.mongodb.net/myFirstDatabase?retryWrites=true&w=majority", "DatabaseName": "si_db", "CollectionName": "users", - "DatasetCollectionName" : "Dataset" + "DatasetCollectionName": "Dataset" } } |