diff options
author | Sonja Galovic <galovicsonja@gmail.com> | 2022-04-26 21:15:24 +0200 |
---|---|---|
committer | Sonja Galovic <galovicsonja@gmail.com> | 2022-04-26 21:15:24 +0200 |
commit | 2c22d31667a4a5be24224651a570b1086d2ded7b (patch) | |
tree | 4e30cc22d12d97816ac17a540a00df89fcb58b57 /backend | |
parent | 31e3b846eda94de86e249956d96c54aaa92eb0c6 (diff) | |
parent | 5857e1c71eda1ee6455d55ef9f8d1c10f75a8457 (diff) |
Merge branch 'redesign' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar into redesign
# Conflicts:
# frontend/src/app/_elements/column-table/column-table.component.css
# frontend/src/app/_elements/column-table/column-table.component.ts
Diffstat (limited to 'backend')
-rw-r--r-- | backend/api/api/Controllers/FileController.cs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/backend/api/api/Controllers/FileController.cs b/backend/api/api/Controllers/FileController.cs index 68d2ebed..0e9f9b97 100644 --- a/backend/api/api/Controllers/FileController.cs +++ b/backend/api/api/Controllers/FileController.cs @@ -115,6 +115,26 @@ namespace api.Controllers return String.Join("\n", System.IO.File.ReadLines(filePath).Take(10)); } + [HttpGet("csvread/{hasHeader}/{fileId}/{skipRows}/{takeRows}")] + [Authorize(Roles = "User,Guest")] + public ActionResult<string> CsvRead(bool hasHeader, string fileId, int skipRows, int takeRows) + { + + string uploaderId = getUserId(); + + if (uploaderId == null) + return BadRequest(); + + //String csvContent = System.IO.File.ReadAllText(fileModel.path); + string filePath = _fileservice.GetFilePath(fileId, uploaderId); + + + + if (hasHeader) + return String.Join("\n", System.IO.File.ReadLines(filePath).Skip(skipRows+1).Take(takeRows)); + else + return String.Join("\n", System.IO.File.ReadLines(filePath).Skip(skipRows).Take(takeRows)); + } [HttpPost("Csv")] |