diff options
author | Ognjen Cirkovic <ciraboxkg@gmail.com> | 2022-03-25 22:17:39 +0100 |
---|---|---|
committer | Ognjen Cirkovic <ciraboxkg@gmail.com> | 2022-03-25 22:17:39 +0100 |
commit | 2b985326e9ebf4f1e421114b09d9f7f456ce78f9 (patch) | |
tree | b4450cf5c77579b3708975b066d4ded528aa606b /backend | |
parent | 42dcd079b3357b11eb43739949420629f8576f96 (diff) |
Resena greska kod inputNeurona na backu i preuzimanju fajla od public dataseta.
Diffstat (limited to 'backend')
-rw-r--r-- | backend/api/api/Controllers/ModelController.cs | 1 | ||||
-rw-r--r-- | backend/api/api/Services/FileService.cs | 8 |
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; |