aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorTAMARA JERINIC <tamara.jerinic@gmail.com>2022-03-26 12:52:27 +0100
committerTAMARA JERINIC <tamara.jerinic@gmail.com>2022-03-26 12:52:27 +0100
commit3e1319e9b87f97e9f01c1936dca994b1842f688e (patch)
treeda8c9d1a6d89a2022fc854ba4acdaab866e82262 /backend
parent2a8662479dea8c98049448a35ca5480e969238f2 (diff)
parentd9742d0413a9b3cf0b530b275bd97dc0fe39c346 (diff)
Merge branch 'dev' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar into dev
Diffstat (limited to 'backend')
-rw-r--r--backend/api/api/Controllers/ModelController.cs1
-rw-r--r--backend/api/api/Services/FileService.cs8
2 files changed, 8 insertions, 1 deletions
diff --git a/backend/api/api/Controllers/ModelController.cs b/backend/api/api/Controllers/ModelController.cs
index b4a4b4f2..b997efa3 100644
--- a/backend/api/api/Controllers/ModelController.cs
+++ b/backend/api/api/Controllers/ModelController.cs
@@ -126,6 +126,7 @@ namespace api.Controllers
public ActionResult<Model> Post([FromBody] Model model)
{
//username="" ako je GUEST
+ model.inputNeurons = model.inputColumns.Length;
if (_modelService.CheckHyperparameters(model.inputNeurons, model.hiddenLayerNeurons, model.hiddenLayers, model.outputNeurons) == false)
return BadRequest("Bad parameters!");
diff --git a/backend/api/api/Services/FileService.cs b/backend/api/api/Services/FileService.cs
index b02d0da4..c5759953 100644
--- a/backend/api/api/Services/FileService.cs
+++ b/backend/api/api/Services/FileService.cs
@@ -8,11 +8,13 @@ namespace api.Services
{
private readonly IMongoCollection<FileModel> _file;
+ private readonly IMongoCollection<Dataset> _dataset;
public FileService(IUserStoreDatabaseSettings settings, IMongoClient mongoClient)
{
var database = mongoClient.GetDatabase(settings.DatabaseName);
_file = database.GetCollection<FileModel>(settings.FilesCollectionName);
+ _dataset = database.GetCollection<Dataset>(settings.DatasetCollectionName);
}
public FileModel Create(FileModel file)
@@ -25,7 +27,11 @@ namespace api.Services
}
public string GetFilePath(string id, string username)
{
- FileModel file = _file.Find(x => x._id == id && x.username == username).FirstOrDefault();
+ FileModel file;
+ if (_dataset.Find(x=>x.fileId==id && x.isPublic==true).FirstOrDefault()!=null)
+ file = _file.Find(x => x._id == id).FirstOrDefault();
+ else
+ file = _file.Find(x => x._id == id && x.username == username).FirstOrDefault();
if (file == null)
return null;
return file.path;