diff options
Diffstat (limited to 'backend')
-rw-r--r-- | backend/api/api/Controllers/ModelController.cs | 1 | ||||
-rw-r--r-- | backend/api/api/Models/Dataset.cs | 1 | ||||
-rw-r--r-- | backend/api/api/Services/FileService.cs | 8 |
3 files changed, 9 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/Models/Dataset.cs b/backend/api/api/Models/Dataset.cs index 67ef8cfe..dcfde3b1 100644 --- a/backend/api/api/Models/Dataset.cs +++ b/backend/api/api/Models/Dataset.cs @@ -21,6 +21,7 @@ namespace api.Models public DateTime dateCreated { get; set; } public DateTime lastUpdated { get; set; } public string delimiter { get; set; } + public bool hasHeader { get; set; } } } 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; |