Renames and changes

This commit is contained in:
2026-03-28 15:32:36 +01:00
parent 3132b139f7
commit 7709fe737f
28 changed files with 236 additions and 241 deletions
@@ -47,7 +47,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
Directory.CreateDirectory(workingDirectory);
logger.LogDebug("Generated picture workflow paths. WorkingDirectory: {WorkingDirectory}, SourceFilePath: {SourceFilePath}",
logger.LogDebug("Generated picture workflow paths. WorkingDirectory={WorkingDirectory}, SourceFilePath={SourceFilePath}",
workingDirectory,
sourceFilePath);
@@ -64,7 +64,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
}
catch (Exception exception)
{
logger.LogError(exception, "Error generating picture workflow paths for key {SourceKeyName}",
logger.LogError(exception, "Error generating picture workflow paths for key={SourceKey}",
executeContext.Arguments.SourceKey);
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
throw;
@@ -41,7 +41,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
{
if (!File.Exists(sourceFilePath))
{
logger.LogWarning("Source file not found at {SourceFilePath}", sourceFilePath);
logger.LogWarning("Source file not found at={SourceFilePath}", sourceFilePath);
throw new FileNotFoundException($"Source file not found: {sourceFilePath}");
}
@@ -56,7 +56,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
if (!resizedPicture.IsSuccess)
{
var errorMessage = string.Join("; ", resizedPicture.Errors);
logger.LogError("Failed to resize picture {SourceFilePath} to {Width}x{Height}. Errors: {Errors}",
logger.LogError("Failed to resize picture={SourceFilePath} to={Width}x{Height}. Errors={Errors}",
sourceFilePath,
executeContext.Arguments.Width,
executeContext.Arguments.Height,
@@ -71,18 +71,16 @@ namespace Musify.Infrastructure.MassTransit.Activities
await using var destinationStream = File.Create(destinationFilePath);
await resizedPicture.Value.CopyToAsync(destinationStream, executeContext.CancellationToken);
logger.LogDebug("Picture resized from {SourceFilePath} to {DestinationFilePath} ({Width}x{Height})",
logger.LogDebug("Picture resized from={SourceFilePath} to={DestinationFilePath}",
sourceFilePath,
destinationFilePath,
executeContext.Arguments.Width,
executeContext.Arguments.Height);
destinationFilePath);
await processTrackingStore.CompleteStepAsync(processId, stepId, executeContext.CancellationToken);
return executeContext.Completed(new ResizePictureLog(destinationFilePath));
}
catch (Exception exception)
{
logger.LogError(exception, "Error resizing picture {SourceFilePath}", sourceFilePath);
logger.LogError(exception, "Error resizing picture={SourceFilePath}", sourceFilePath);
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
throw;
}
@@ -97,7 +95,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
}
catch (Exception exception)
{
logger.LogError(exception, "Error compensating resized file {DestinationFilePath}", compensateContext.Log.DestinationFilePath);
logger.LogError(exception, "Error compensating resized file={DestinationFilePath}", compensateContext.Log.DestinationFilePath);
return Task.FromResult(compensateContext.Failed(exception));
}
}
@@ -46,27 +46,27 @@ namespace Musify.Infrastructure.MassTransit.Activities
if (playList is null)
{
logger.LogWarning("PlayList with id {PlayListId} not found",
logger.LogWarning("PlayList with id={PlayListId} not found",
executeContext.Arguments.PlayListId);
throw new InvalidOperationException($"PlayList with id {executeContext.Arguments.PlayListId} not found");
}
var log = new UpdatePlayListPictureLog(
playList.Id,
playList.OriginalPictureKeyName,
playList.SmallPictureKeyName,
playList.MediumPictureKeyName,
playList.LargePictureKeyName);
playList.OriginalPictureName,
playList.SmallPictureName,
playList.MediumPictureName,
playList.LargePictureName);
playList.OriginalPictureKeyName = Path.GetFileName(executeContext.Arguments.OriginalPictureKey);
playList.SmallPictureKeyName = Path.GetFileName(smallResizedVariable);
playList.MediumPictureKeyName = Path.GetFileName(mediumResizedVariable);
playList.LargePictureKeyName = Path.GetFileName(largeResizedVariable);
playList.OriginalPictureName = Path.GetFileName(executeContext.Arguments.OriginalPictureKey);
playList.SmallPictureName = Path.GetFileName(smallResizedVariable);
playList.MediumPictureName = Path.GetFileName(mediumResizedVariable);
playList.LargePictureName = Path.GetFileName(largeResizedVariable);
database.PlayLists.Update(playList);
await database.SaveChangesAsync(executeContext.CancellationToken);
logger.LogInformation("Updated PlayList {PlayListId} pictures",
logger.LogInformation("Updated PlayList={PlayListId} pictures",
executeContext.Arguments.PlayListId);
await processTrackingStore.CompleteStepAsync(processId, stepId, executeContext.CancellationToken);
@@ -74,7 +74,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
}
catch (Exception exception)
{
logger.LogError(exception, "Error updating PlayList {PlayListId} pictures",
logger.LogError(exception, "Error updating PlayList={PlayListId} pictures",
executeContext.Arguments.PlayListId);
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
throw;
@@ -94,10 +94,10 @@ namespace Musify.Infrastructure.MassTransit.Activities
return compensateContext.Compensated();
}
playList.OriginalPictureKeyName = compensateContext.Log.PreviousOriginalPictureKey;
playList.SmallPictureKeyName = compensateContext.Log.PreviousSmallPictureKey;
playList.MediumPictureKeyName = compensateContext.Log.PreviousMediumPictureKey;
playList.LargePictureKeyName = compensateContext.Log.PreviousLargePictureKey;
playList.OriginalPictureName = compensateContext.Log.PreviousOriginalPictureKey;
playList.SmallPictureName = compensateContext.Log.PreviousSmallPictureKey;
playList.MediumPictureName = compensateContext.Log.PreviousMediumPictureKey;
playList.LargePictureName = compensateContext.Log.PreviousLargePictureKey;
database.PlayLists.Update(playList);
await database.SaveChangesAsync(compensateContext.CancellationToken);
@@ -106,7 +106,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
}
catch (Exception exception)
{
logger.LogError(exception, "Error compensating PlayList {PlayListId} pictures", compensateContext.Log.PlayListId);
logger.LogError(exception, "Error compensating PlayList={PlayListId} pictures", compensateContext.Log.PlayListId);
return compensateContext.Failed(exception);
}
}
@@ -46,27 +46,27 @@ namespace Musify.Infrastructure.MassTransit.Activities
if (track is null)
{
logger.LogWarning("Track with id {TrackId} not found",
logger.LogWarning("Track with id={TrackId} not found",
executeContext.Arguments.TrackId);
throw new InvalidOperationException($"Track with id {executeContext.Arguments.TrackId} not found");
}
var log = new UpdateTrackPictureLog(
track.Id,
track.OriginalPictureKeyName,
track.SmallPictureKeyName,
track.MediumPictureKeyName,
track.LargePictureKeyName);
track.OriginalPictureName,
track.SmallPictureName,
track.MediumPictureName,
track.LargePictureName);
track.OriginalPictureKeyName = Path.GetFileName(executeContext.Arguments.OriginalPictureKey);
track.SmallPictureKeyName = Path.GetFileName(smallResizedVariable);
track.MediumPictureKeyName = Path.GetFileName(mediumResizedVariable);
track.LargePictureKeyName = Path.GetFileName(largeResizedVariable);
track.OriginalPictureName = Path.GetFileName(executeContext.Arguments.OriginalPictureKey);
track.SmallPictureName = Path.GetFileName(smallResizedVariable);
track.MediumPictureName = Path.GetFileName(mediumResizedVariable);
track.LargePictureName = Path.GetFileName(largeResizedVariable);
database.Tracks.Update(track);
await database.SaveChangesAsync(executeContext.CancellationToken);
logger.LogInformation("Updated Track {TrackId} pictures",
logger.LogInformation("Updated Track={TrackId} pictures",
executeContext.Arguments.TrackId);
await processTrackingStore.CompleteStepAsync(processId, stepId, executeContext.CancellationToken);
@@ -74,7 +74,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
}
catch (Exception exception)
{
logger.LogError(exception, "Error updating Track {TrackId} pictures",
logger.LogError(exception, "Error updating Track={TrackId} pictures",
executeContext.Arguments.TrackId);
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
throw;
@@ -94,10 +94,10 @@ namespace Musify.Infrastructure.MassTransit.Activities
return compensateContext.Compensated();
}
track.OriginalPictureKeyName = compensateContext.Log.PreviousOriginalPictureKey;
track.SmallPictureKeyName = compensateContext.Log.PreviousSmallPictureKey;
track.MediumPictureKeyName = compensateContext.Log.PreviousMediumPictureKey;
track.LargePictureKeyName = compensateContext.Log.PreviousLargePictureKey;
track.OriginalPictureName = compensateContext.Log.PreviousOriginalPictureKey;
track.SmallPictureName = compensateContext.Log.PreviousSmallPictureKey;
track.MediumPictureName = compensateContext.Log.PreviousMediumPictureKey;
track.LargePictureName = compensateContext.Log.PreviousLargePictureKey;
database.Tracks.Update(track);
await database.SaveChangesAsync(compensateContext.CancellationToken);
@@ -106,7 +106,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
}
catch (Exception exception)
{
logger.LogError(exception, "Error compensating Track {TrackId} pictures", compensateContext.Log.TrackId);
logger.LogError(exception, "Error compensating Track={TrackId} pictures", compensateContext.Log.TrackId);
return compensateContext.Failed(exception);
}
}