From 2ecc1783044113db6f2114f0f1a11094362ea1d0 Mon Sep 17 00:00:00 2001 From: Sonja Galovic Date: Thu, 7 Apr 2022 00:02:11 +0200 Subject: Ispravljena greska kod dobijanja fajla --- backend/api/api/Controllers/FileController.cs | 12 ++++-------- backend/api/api/Services/IFileService.cs | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'backend') 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> 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 -- cgit v1.2.3