tsk-#76: Adding more code

This commit is contained in:
phoenix
2025-03-11 21:41:44 -04:00
parent bccb0f6491
commit 0677a4ddbc
6 changed files with 67 additions and 13 deletions
+13 -3
View File
@@ -175,11 +175,21 @@ public class SongDataController : BaseController
public IActionResult DeleteSong(int id)
{
var songContext = new SongContext(_connectionString!);
var songMetaData = songContext.RetrieveRecord(new Song { Id = id });
var songMetaData = new Song { Id = id };
Console.WriteLine($"Id {songMetaData.Id}");
var tokenManager = new TokenManager(this._config!);
var accLvlContext = new AccessLevelContext(this._connectionString!);
var accessLevel = accLvlContext.GetAccessLevel(songMetaData.Id);
var token = tokenManager.GetBearerToken(HttpContext);
if (token == null || accessLevel == null)
{
return BadRequest();
}
songMetaData = songContext.RetrieveRecord(songMetaData);
if (!tokenManager.CanAccessSong(token, songMetaData, accessLevel))
{
return BadRequest();
}
if (string.IsNullOrEmpty(songMetaData.Title))
{