#95: Id changes to models (#99)

* #95: Updated Id of the CoverArt model

* Model and migration changes
This commit was merged in pull request #99.
This commit is contained in:
Kun Deng
2024-06-21 20:30:23 -04:00
committed by GitHub
parent 71656aa940
commit 4b3fa78336
32 changed files with 118 additions and 130 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ public class AlbumController : BaseController
[HttpGet("{id}")]
public IActionResult GetAlbum(int id)
{
Album album = new Album{ AlbumID = id };
Album album = new Album{ Id = id };
var albumContext = new AlbumContext(_connectionString);
+1 -4
View File
@@ -48,10 +48,7 @@ public class ArtistController : BaseController
[HttpGet("{id}")]
public IActionResult GetArtist(int id)
{
Artist artist = new Artist
{
ArtistID = id
};
Artist artist = new Artist { Id = id };
var artistContext = new ArtistContext(_connectionString);
+2 -2
View File
@@ -51,7 +51,7 @@ public class CoverArtController : BaseController
[HttpGet("{id}")]
public IActionResult GetCoverArt(int id)
{
var coverArt = new CoverArt { CoverArtID = id };
var coverArt = new CoverArt { Id = id };
var coverArtContext = new CoverArtContext(_connectionString);
@@ -79,7 +79,7 @@ public class CoverArtController : BaseController
var songContext = new SongContext(_connectionString);
var covMgr = new CoverArtManager(this._config);
var songMetaData = songContext.RetrieveRecord(new Song { SongID = id});
var songMetaData = songContext.RetrieveRecord(new Song { Id = id});
var c = covMgr.GetCoverArt(songMetaData);
var filename = DirectoryManager.GenerateDownloadFilename(10, Constants.FileExtensions.JPG_EXTENSION, songMetaData.Title, randomizeFilename);
+1 -1
View File
@@ -52,7 +52,7 @@ public class GenreController : BaseController
[HttpGet("{id}")]
public IActionResult GetGenre(int id)
{
var genre = new Genre{ GenreID = id };
var genre = new Genre { Id = id };
var genreStore = new GenreContext(_connectionString);
@@ -46,7 +46,7 @@ public class SongCompressedDataController : BaseController
Console.WriteLine($"Archive directory root: {_archiveDir}");
Console.WriteLine("Starting process of retrieving comrpessed song");
var sng = context.RetrieveRecord(new Song{ SongID = id });
var sng = context.RetrieveRecord(new Song{ Id = id });
SongData song = await cmp.RetrieveCompressedSong(sng);
var filename = DirectoryManager.GenerateDownloadFilename(10, Constants.FileExtensions.ZIP_EXTENSION, sng.Title, randomizeFilename);
+3 -3
View File
@@ -61,11 +61,11 @@ public class SongController : BaseController
{
var context = new SongContext(_connectionString);
var song = context.RetrieveRecord(new Song{ SongID = id });
var song = context.RetrieveRecord(new Song{ Id = id });
Console.WriteLine("Here");
if (song.SongID != 0)
if (song.Id != 0)
return Ok(song);
else
return NotFound();
@@ -74,7 +74,7 @@ public class SongController : BaseController
[HttpPut("{id}")]
public IActionResult UpdateSong(int id, [FromBody] Song song)
{
song.SongID = id;
song.Id = id;
Console.WriteLine("Retrieving filepath of song");
_logger.LogInformation("Retrieving filepath of song");
+4 -4
View File
@@ -40,7 +40,7 @@ public class SongDataController : BaseController
public IActionResult Download(int id, [FromQuery] bool? randomizeFilename)
{
var songContext = new SongContext(_connectionString);
var songMetaData = songContext.RetrieveRecord(new Song { SongID = id});
var songMetaData = songContext.RetrieveRecord(new Song { Id = id});
var song = _songMgr.RetrieveSong(songMetaData).Result;
var filename = DirectoryManager.GenerateDownloadFilename(10, Constants.FileExtensions.WAV_EXTENSION, songMetaData.Title, randomizeFilename);
@@ -110,7 +110,7 @@ public class SongDataController : BaseController
if (userId != -1)
{
song.UserID = userId;
song.UserId = userId;
}
_logger.LogInformation($"Song title: {song.Title}");
@@ -131,8 +131,8 @@ public class SongDataController : BaseController
{
var songContext = new SongContext(_connectionString);
var songMetaData = new Song{ SongID = id };
Console.WriteLine($"Id {songMetaData.SongID}");
var songMetaData = new Song{ Id = id };
Console.WriteLine($"Id {songMetaData.Id}");
songMetaData = songContext.RetrieveRecord(songMetaData);
+1 -1
View File
@@ -34,7 +34,7 @@ public class SongStreamController : BaseController
{
var context = new SongContext(_config.GetConnectionString("DefaultConnection"));
var song = context.Songs.FirstOrDefault(sng => sng.SongID == id);
var song = context.Songs.FirstOrDefault(sng => sng.Id == id);
var stream = new FileStream(song.SongPath(), FileMode.Open, FileAccess.Read);
stream.Position = 0;