From 2b985326e9ebf4f1e421114b09d9f7f456ce78f9 Mon Sep 17 00:00:00 2001 From: Ognjen Cirkovic Date: Fri, 25 Mar 2022 22:17:39 +0100 Subject: Resena greska kod inputNeurona na backu i preuzimanju fajla od public dataseta. --- backend/api/api/Controllers/ModelController.cs | 1 + backend/api/api/Services/FileService.cs | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'backend/api') 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 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 _file; + private readonly IMongoCollection _dataset; public FileService(IUserStoreDatabaseSettings settings, IMongoClient mongoClient) { var database = mongoClient.GetDatabase(settings.DatabaseName); _file = database.GetCollection(settings.FilesCollectionName); + _dataset = database.GetCollection(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; -- cgit v1.2.3