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:
@@ -36,6 +36,7 @@ namespace Icarus.Controllers.Managers
|
||||
private string _tempDirectoryRoot;
|
||||
private string _archiveDirectoryRoot;
|
||||
private string _compressedSongFilename;
|
||||
private string _message;
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -56,6 +57,11 @@ namespace Icarus.Controllers.Managers
|
||||
get => _compressedSongFilename;
|
||||
set => _compressedSongFilename = value;
|
||||
}
|
||||
public string Message
|
||||
{
|
||||
get => _message;
|
||||
set => _message = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -108,6 +114,20 @@ namespace Icarus.Controllers.Managers
|
||||
|
||||
return successful;
|
||||
}
|
||||
// TODO: Implement method
|
||||
// This method should do the following, with the help of existing methods
|
||||
// or create helper methods to compelete to intended purpose:
|
||||
//
|
||||
// 1. Delete song from the filesystem
|
||||
// 2. Delete the song record from the database
|
||||
// 3. Decrement the SongCount value or delete the album record from the Database
|
||||
// 4. Decrement the SongCount value or delete the artist record from the Database
|
||||
public bool DeleteSongFromFileSystem(Song song, MusicStoreContext songStore,
|
||||
AlbumStoreContext albumStore, ArtistStoreContext artistStore)
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void SaveSongDetails()
|
||||
{
|
||||
@@ -171,6 +191,11 @@ namespace Icarus.Controllers.Managers
|
||||
Console.WriteLine($"An Error Occurred: {exMsg}");
|
||||
}
|
||||
}
|
||||
// TODO: This method should update the Song, Album, and Artist records in the database
|
||||
public void UpdateSong(Song song, MusicStoreContext songStore, AlbumStoreContext albumStore,
|
||||
ArtistStoreContext artistStore)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task SaveSong(SongData songData)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user