aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSonja Galovic <galovicsonja@gmail.com>2022-04-07 00:02:11 +0200
committerSonja Galovic <galovicsonja@gmail.com>2022-04-07 00:02:11 +0200
commit2ecc1783044113db6f2114f0f1a11094362ea1d0 (patch)
tree039957ff63bdbc0a642fcb95cf2e9f2dbc911e6c
parent07eb321090326a13d997b0c6380d5cb02463f5a2 (diff)
Ispravljena greska kod dobijanja fajla
-rw-r--r--backend/api/api/Controllers/FileController.cs12
-rw-r--r--backend/api/api/Services/IFileService.cs2
-rw-r--r--frontend/src/app/_services/datasets.service.ts2
3 files changed, 6 insertions, 10 deletions
diff --git a/backend/api/api/Controllers/FileController.cs b/backend/api/api/Controllers/FileController.cs
index ead9ee9a..27bd75fb 100644
--- a/backend/api/api/Controllers/FileController.cs
+++ b/backend/api/api/Controllers/FileController.cs
@@ -4,10 +4,7 @@ using api.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Net.Http.Headers;
-using CsvHelper;
-using System.IO;
-using System.Globalization;
-using System.Linq;
+
namespace api.Controllers
{
@@ -18,9 +15,8 @@ namespace api.Controllers
private string[] permittedExtensions = { ".csv" };
private string[] permittedExtensionsH5 = { ".h5" };//niz da bi dodali h4 itd
private readonly IConfiguration _configuration;
- private readonly IFileService _fileService;
private IJwtToken _token;
- private IFileService _fileservice;
+ private readonly IFileService _fileservice;
public FileController(IConfiguration configuration,IFileService fileService,IJwtToken token)
{
_configuration = configuration;
@@ -100,7 +96,7 @@ namespace api.Controllers
return Ok(fileModel);
}
- [HttpGet("csvread/{hasheader}/{fileid}")]
+ [HttpGet("csvread/{hasHeader}/{fileId}")]
[Authorize(Roles = "User,Guest")]
public ActionResult<List<string>> CsvRead(bool hasHeader, string fileId)
{
@@ -120,7 +116,7 @@ namespace api.Controllers
return BadRequest();
//String csvContent = System.IO.File.ReadAllText(fileModel.path);
- string filePath = _fileService.GetFilePath(fileId, uploaderId);
+ string filePath = _fileservice.GetFilePath(fileId, uploaderId);
diff --git a/backend/api/api/Services/IFileService.cs b/backend/api/api/Services/IFileService.cs
index d65deb48..01a1c410 100644
--- a/backend/api/api/Services/IFileService.cs
+++ b/backend/api/api/Services/IFileService.cs
@@ -5,7 +5,7 @@ namespace api.Services
public interface IFileService
{
FileModel Create(FileModel file);
- string GetFilePath(string id, string username);
+ string GetFilePath(string id, string uploaderId);
public FileModel getFile(string id);
}
} \ No newline at end of file
diff --git a/frontend/src/app/_services/datasets.service.ts b/frontend/src/app/_services/datasets.service.ts
index cd901481..da0c4dc5 100644
--- a/frontend/src/app/_services/datasets.service.ts
+++ b/frontend/src/app/_services/datasets.service.ts
@@ -25,7 +25,7 @@ export class DatasetsService {
}
getDatasetFile(fileId: any): any {
- return this.http.get(`${API_SETTINGS.apiURL}/file/download?id=${fileId}`, { headers: this.authService.authHeader(), responseType: 'text' });
+ return this.http.get(`${API_SETTINGS.apiURL}/file/csvRead/true/${fileId}`, { headers: this.authService.authHeader(), responseType: 'text' });
}
editDataset(dataset: Dataset): Observable<Dataset> {