Working on some code cleanup, I thought I was nearing the end. Eventually leading to working on how to stream songs from the server but more work has to be done. I know I have integrated Auth0 but if this project is to be useful to others without having to configure Auth0 then I would like for it to be usable with a couple commands after cloning the repository. More work has to be done but I am close to the releasing the first version. Will update to the project on Github soon. #37

This commit is contained in:
amazing-username
2019-05-12 21:42:25 -04:00
parent dcc6ce6c83
commit d75d2924a7
7 changed files with 114 additions and 48 deletions
+21 -1
View File
@@ -87,16 +87,36 @@ namespace Icarus.Controllers
[HttpPut("{id}")]
[Authorize("read:song_details")]
[Authorize("update:songs")]
public IActionResult Put(int id, [FromBody] Song song)
{
MusicStoreContext context = HttpContext
.RequestServices
.GetService(typeof(MusicStoreContext)) as MusicStoreContext;
ArtistStoreContext artistStore = HttpContext
.RequestServices
.GetService(typeof(ArtistStoreContext)) as ArtistStoreContext;
AlbumStoreContext albumStore = HttpContext
.RequestServices
.GetService(typeof(AlbumStoreContext)) as AlbumStoreContext;
song.Id = id;
Console.WriteLine("Retrieving filepath of song");
_logger.LogInformation("Retrieving filepath of song");
if (!context.DoesSongExist(song))
{
return NotFound(new SongResult
{
Message = "Song does not exist"
});
}
// TODO: Provide functionality for the UpdateSong(...) method
// before removing the below return statement
return Ok("song exists");
var oldSongRecord = context.GetSong(id);
song.SongPath = oldSongRecord.SongPath;