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
@@ -38,7 +38,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
Directory.CreateDirectory(workingDirectory);
logger.LogDebug("Generated audio workflow paths. WorkingDirectory: {WorkingDirectory}, SourceFilePath: {SourceFilePath}",
logger.LogDebug("Generated audio workflow paths. WorkingDirectory={WorkingDirectory}, SourceFilePath={SourceFilePath}",
workingDirectory,
sourceFilePath);
@@ -53,7 +53,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
}
catch (Exception exception)
{
logger.LogError(exception, "Error generating audio workflow paths for key {SourceKeyName}",
logger.LogError(exception, "Error generating audio workflow paths for key={SourceKey}",
executeContext.Arguments.SourceKey);
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
throw;
@@ -48,7 +48,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
if (!result.IsSuccess)
{
var errorMessage = string.Join("; ", result.Errors);
logger.LogError("Transcoding failed for file {SourceFilePath}. Errors: {ErrorMessage}",
logger.LogError("Transcoding failed for file={SourceFilePath}. Errors={ErrorMessage}",
sourceFilePath, errorMessage);
throw new Exception(errorMessage);
}
@@ -60,7 +60,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
}
catch (Exception exception)
{
logger.LogError(exception, "Error during transcoding activity for file {SourceFilePath}",
logger.LogError(exception, "Error during transcoding activity for file={SourceFilePath}",
sourceFilePath);
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
throw;
@@ -74,13 +74,13 @@ namespace Musify.Infrastructure.MassTransit.Activities
if (Directory.Exists(compensateContext.Log.WorkingDirectory))
Directory.Delete(compensateContext.Log.WorkingDirectory, recursive: true);
else
logger.LogWarning("Working directory {WorkingDirectory} does not exist during compensation",
logger.LogWarning("Working directory={WorkingDirectory} does not exist during compensation",
compensateContext.Log.WorkingDirectory);
return Task.FromResult(compensateContext.Compensated());
}
catch (Exception exception)
{
logger.LogError(exception, "Error compensating transcoded audio directory {WorkingDirectory}", compensateContext.Log.WorkingDirectory);
logger.LogError(exception, "Error compensating transcoded audio directory={WorkingDirectory}", compensateContext.Log.WorkingDirectory);
return Task.FromResult(compensateContext.Failed(exception));
}
}
@@ -39,21 +39,21 @@ namespace Musify.Infrastructure.MassTransit.Activities.Audio
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 UpdateTrackAudioLog(
track.Id,
track.AudioFolderKeyName);
track.AudioFolderName);
track.AudioFolderKeyName = Path.GetFileName(executeContext.Arguments.AudioFolderKey);
track.AudioFolderName = Path.GetFileName(executeContext.Arguments.AudioFolderKey);
database.Tracks.Update(track);
await database.SaveChangesAsync(executeContext.CancellationToken);
logger.LogInformation("Updated Track {TrackId} audio",
logger.LogInformation("Updated Track={TrackId} audio",
executeContext.Arguments.TrackId);
await processTrackingStore.CompleteStepAsync(processId, stepId, executeContext.CancellationToken);
@@ -61,7 +61,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Audio
}
catch (Exception exception)
{
logger.LogError(exception, "Error updating Track {TrackId} audio",
logger.LogError(exception, "Error updating Track={TrackId} audio",
executeContext.Arguments.TrackId);
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
throw;
@@ -81,7 +81,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Audio
return compensateContext.Compensated();
}
track.AudioFolderKeyName = compensateContext.Log.PreviousFolderAudioKey;
track.AudioFolderName = compensateContext.Log.PreviousFolderAudioKey;
database.Tracks.Update(track);
await database.SaveChangesAsync(compensateContext.CancellationToken);
@@ -90,7 +90,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Audio
}
catch (Exception exception)
{
logger.LogError(exception, "Error compensating Track {TrackId} audio", compensateContext.Log.TrackId);
logger.LogError(exception, "Error compensating Track={TrackId} audio", compensateContext.Log.TrackId);
return compensateContext.Failed(exception);
}
}
@@ -44,7 +44,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
if (!getFile.IsSuccess)
{
var errorMessage = string.Join("; ", getFile.Errors);
logger.LogWarning("Failed to download file from bucket. Bucket: {BucketName}, Key: {KeyName}, Errors: {Errors}",
logger.LogWarning("Failed to download file from bucket. Bucket={Bucket}, Key={Key}, Errors={Errors}",
executeContext.Arguments.Bucket,
executeContext.Arguments.Key,
errorMessage);
@@ -85,7 +85,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
}
catch (Exception exception)
{
logger.LogError(exception, "Error compensating downloaded file {DestinationFilePath}", compensateContext.Log.DestinationFilePath);
logger.LogError(exception, "Error compensating downloaded file={DestinationFilePath}", compensateContext.Log.DestinationFilePath);
return Task.FromResult(compensateContext.Failed(exception));
}
}
@@ -40,7 +40,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
if (!removeFile.IsSuccess)
{
var errorMessage = string.Join("; ", removeFile.Errors);
logger.LogWarning("Failed to remove file {KeyName} from bucket {BucketName}. Errors: {Errors}",
logger.LogWarning("Failed to remove file={Key} from bucket={Bucket}. Errors={Errors}",
executeContext.Arguments.Key,
executeContext.Arguments.Bucket,
errorMessage);
@@ -51,7 +51,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
}
catch (Exception exception)
{
logger.LogError(exception, "Error removing file {KeyName} from bucket {BucketName}",
logger.LogError(exception, "Error removing file={Key} from bucket={Bucket}",
executeContext.Arguments.Key,
executeContext.Arguments.Bucket);
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
@@ -51,7 +51,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
if (!transferFilesResult.IsSuccess)
{
var errorMessage = string.Join("; ", transferFilesResult.Errors);
logger.LogWarning("Failed to transfer files from {FolderPath} to bucket {DestinationBucketName}, key {DestinationKeyName}. Errors: {Errors}",
logger.LogWarning("Failed to transfer files from={FolderPath} to bucket={DestinationBucket}, key={DestinationKey}. Errors={Errors}",
folderPath,
executeContext.Arguments.DestinationBucket,
destinationKey,
@@ -64,7 +64,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
}
catch (Exception exception)
{
logger.LogError(exception, "Error transferring files from {FolderPath} to bucket {DestinationBucketName}",
logger.LogError(exception, "Error transferring files from={FolderPath} to bucket={DestinationBucket}",
folderPath,
executeContext.Arguments.DestinationBucket);
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
@@ -88,7 +88,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
}
catch (Exception exception)
{
logger.LogError(exception, "Error compensating transferred files to bucket {DestinationBucketName}", compensateContext.Log.DestinationBucket);
logger.LogError(exception, "Error compensating transferred files to bucket={DestinationBucket}", compensateContext.Log.DestinationBucket);
return compensateContext.Failed(exception);
}
}
@@ -46,7 +46,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Files
if (!uploadResult.IsSuccess)
{
var errors = string.Join("; ", uploadResult.Errors);
logger.LogWarning("Failed to upload file to bucket. Bucket: {BucketName}, Key: {KeyName}, Errors: {Errors}",
logger.LogWarning("Failed to upload file to bucket. Bucket={Bucket}, Key={Key}, Errors={Errors}",
executeContext.Arguments.DestinationBucket,
executeContext.Arguments.DestinationRoute,
errors);
@@ -60,7 +60,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Files
}
catch (Exception exception)
{
logger.LogError(exception, "An error occurred while uploading file to bucket for process {ProcessId} at step {StepId}", processId, stepId);
logger.LogError(exception, "An error occurred while uploading file to bucket for process={ProcessId} at step={StepId}", processId, stepId);
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
throw;
}
@@ -78,16 +78,15 @@ namespace Musify.Infrastructure.MassTransit.Activities.Files
if (!uploadResult.IsSuccess)
{
var errors = string.Join("; ", uploadResult.Errors);
var errorMessage = $"Failed to remove file from bucket during compensation. Bucket: {compensateContext.Log.DestinationBucket}, Key: {compensateContext.Log.DestinationKey}, Errors: {errors}";
logger.LogError($"Failed to remove file from bucket during compensation. Bucket={compensateContext.Log.DestinationBucket}, Key={compensateContext.Log.DestinationKey}, Errors={errors}");
logger.LogError(errorMessage);
return compensateContext.Failed(new Exception(errorMessage));
return compensateContext.Failed(new Exception($"Failed to remove file from bucket during compensation. Bucket: {compensateContext.Log.DestinationBucket}, Key: {compensateContext.Log.DestinationKey}, Errors: {errors}"));
}
return compensateContext.Compensated();
}
catch (Exception exception)
{
logger.LogError(exception, "An error occurred while compensating upload file to bucket activity for bucket {BucketName} and key {KeyName}",
logger.LogError(exception, "An error occurred while compensating upload file to bucket activity for bucket={Bucket} and key={Key}",
compensateContext.Log.DestinationBucket,
compensateContext.Log.DestinationKey);
return compensateContext.Failed(exception);
@@ -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);
}
}