Song uploads

Uploading songs is functional and does not use the song metadata for the filename or directory creation
This commit is contained in:
kdeng00
2021-12-25 21:36:42 -05:00
parent 64e6f33d7c
commit b529731c95
9 changed files with 105 additions and 77 deletions
+7 -3
View File
@@ -55,15 +55,15 @@ namespace Icarus.Controllers.V1
var songContext = new SongContext(_connectionString);
var songMetaData = songContext.RetrieveRecord(new Song { SongID = id});
SongData song = await _songMgr.RetrieveSong(songMetaData);
var song = await _songMgr.RetrieveSong(songMetaData);
return File(song.Data, "application/x-msdownload", songMetaData.Filename);
}
[HttpPost]
[HttpPost("upload"), DisableRequestSizeLimit]
[Route("private-scoped")]
[Authorize("upload:songs")]
public async Task Post([FromForm(Name = "file")] List<IFormFile> songData)
public async Task<IActionResult> Post([FromForm(Name = "file")] List<IFormFile> songData)
{
try
{
@@ -81,12 +81,16 @@ namespace Icarus.Controllers.V1
await _songMgr.SaveSongToFileSystem(sng);
}
return Ok();
}
catch (Exception ex)
{
var msg = ex.Message;
_logger.LogError(msg, "An error occurred");
}
return NotFound();
}
[HttpDelete("{id}")]