Changes on packages

This commit is contained in:
2026-09-20 16:23:49 +02:00
parent 3f5e01f910
commit 4251d292e1
54 changed files with 68 additions and 66 deletions
@@ -19,7 +19,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Albums
var album = await database.Albums
.SingleOrDefaultAsync(a => a.Id == executeContext.Arguments.AlbumId, executeContext.CancellationToken);
if (album is not null)
if (album != null)
{
album.LifeCycleStatus = LifeCycleStatus.Failed;
await database.SaveChangesAsync(executeContext.CancellationToken);
@@ -93,7 +93,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Audio
try
{
var track = await database.Tracks.SingleOrDefaultAsync(t => t.Id == compensateContext.Log.TrackId, compensateContext.CancellationToken);
if (track is null)
if (track == null)
throw new InvalidOperationException($"Track with id {compensateContext.Log.TrackId} not found");
track.Audio.FolderName = compensateContext.Log.PreviousAudioFolderName;
@@ -31,14 +31,14 @@ namespace Musify.Infrastructure.MassTransit.Activities.Pictures
[executeContext.Arguments.AlbumId],
cancellationToken: executeContext.CancellationToken);
if (album is null)
if (album == null)
{
logger.LogWarning("Album {AlbumId} not found",
executeContext.Arguments.AlbumId);
throw new InvalidOperationException($"Album with id {executeContext.Arguments.AlbumId} not found");
}
if (album.Pictures is null)
if (album.Pictures == null)
{
logger.LogWarning("Album {AlbumId} has no pending picture upload",
executeContext.Arguments.AlbumId);
@@ -85,7 +85,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Pictures
[compensateContext.Log.AlbumId],
cancellationToken: compensateContext.CancellationToken);
if (album is null)
if (album == null)
{
return compensateContext.Compensated();
}
@@ -31,14 +31,14 @@ namespace Musify.Infrastructure.MassTransit.Activities.Pictures
[executeContext.Arguments.PlayListId],
cancellationToken: executeContext.CancellationToken);
if (playList is null)
if (playList == null)
{
logger.LogWarning("Playlist {PlayListId} not found",
executeContext.Arguments.PlayListId);
throw new InvalidOperationException($"PlayList with id {executeContext.Arguments.PlayListId} not found");
}
if (playList.Pictures is null)
if (playList.Pictures == null)
{
logger.LogWarning("Playlist {PlayListId} has no pending picture upload",
executeContext.Arguments.PlayListId);
@@ -85,7 +85,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Pictures
[compensateContext.Log.PlayListId],
cancellationToken: compensateContext.CancellationToken);
if (playList is null)
if (playList == null)
{
return compensateContext.Compensated();
}
@@ -31,7 +31,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Pictures
[executeContext.Arguments.TrackId],
cancellationToken: executeContext.CancellationToken);
if (track is null)
if (track == null)
{
logger.LogWarning("Track {TrackId} not found",
executeContext.Arguments.TrackId);
@@ -79,7 +79,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Pictures
[compensateContext.Log.TrackId],
cancellationToken: compensateContext.CancellationToken);
if (track is null)
if (track == null)
return compensateContext.Compensated();
track.Pictures.OriginalName = compensateContext.Log.PreviousOriginalPictureKey;
@@ -18,7 +18,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.PlayLists
var playList = await database.PlayLists
.SingleOrDefaultAsync(p => p.Id == executeContext.Arguments.PlayListId, executeContext.CancellationToken);
if (playList is null)
if (playList == null)
{
logger.LogInformation(
"PlayList {PlayListId} not found while deleting from DB, skipping",
@@ -19,7 +19,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.PlayLists
var playList = await database.PlayLists
.SingleOrDefaultAsync(p => p.Id == executeContext.Arguments.PlayListId, executeContext.CancellationToken);
if (playList is not null)
if (playList != null)
{
playList.LifeCycleStatus = LifeCycleStatus.Failed;
await database.SaveChangesAsync(executeContext.CancellationToken);
@@ -19,7 +19,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.PlayLists
var playList = await database.PlayLists
.SingleOrDefaultAsync(p => p.Id == executeContext.Arguments.PlayListId, executeContext.CancellationToken);
if (playList is null)
if (playList == null)
{
logger.LogInformation(
"PlayList {PlayListId} not found while marking as removing, skipping",
@@ -18,7 +18,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Tracks
var track = await database.Tracks
.SingleOrDefaultAsync(t => t.Id == executeContext.Arguments.TrackId, executeContext.CancellationToken);
if (track is null)
if (track == null)
{
logger.LogInformation(
"Track {TrackId} not found while deleting from DB, skipping",
@@ -19,7 +19,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Tracks
var track = await database.Tracks
.SingleOrDefaultAsync(t => t.Id == executeContext.Arguments.TrackId, executeContext.CancellationToken);
if (track is not null)
if (track != null)
{
track.LifeCycleStatus = LifeCycleStatus.Failed;
await database.SaveChangesAsync(executeContext.CancellationToken);
@@ -19,7 +19,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Tracks
var track = await database.Tracks
.SingleOrDefaultAsync(t => t.Id == executeContext.Arguments.TrackId, executeContext.CancellationToken);
if (track is null)
if (track == null)
{
logger.LogInformation(
"Track {TrackId} not found while marking as removing, skipping",
@@ -37,7 +37,7 @@ namespace Musify.Infrastructure.MassTransit.RoutingSlip.Builders
EndpointHelper.BuildExecuteActivityUri(MarkPlayListAsRemovingActivity.ExecuteEndpointName),
new MarkPlayListAsRemovingArguments(playListId));
if (playList?.Pictures is not null)
if (playList?.Pictures != null)
{
var bucket = storageConfiguration.Bucket;
var routes = playListConfiguration.Routes;
@@ -37,7 +37,7 @@ namespace Musify.Infrastructure.MassTransit.RoutingSlip.Builders
EndpointHelper.BuildExecuteActivityUri(MarkTrackAsRemovingActivity.ExecuteEndpointName),
new MarkTrackAsRemovingArguments(trackId));
if (track is not null)
if (track != null)
{
var bucket = storageConfiguration.Bucket;
@@ -21,7 +21,7 @@ namespace Musify.Infrastructure.Persistence
private static void ApplyTimestamps(DbContext? context)
{
if (context is null)
if (context == null)
return;
// SavingChanges(Async) fires before EF's own automatic change detection for this
@@ -16,7 +16,7 @@ namespace Musify.Infrastructure.Services
if (duration <= TimeSpan.Zero)
return await factory();
if (cache.TryGetValue(key, out TValue? cached) && cached is not null)
if (cache.TryGetValue(key, out TValue? cached) && cached != null)
return cached;
var pending = (Lazy<Task<ErrorOr<TValue>>>)inFlight.GetOrAdd(
@@ -276,7 +276,7 @@ namespace Musify.Infrastructure.Services
{
listResponse = await amazonS3.ListObjectsV2Async(listRequest, cancellationToken);
if (listResponse.S3Objects is null or { Count: 0 } )
if (listResponse.S3Objects == null|| listResponse.S3Objects.Count == 0)
break;
var deleteRequest = new DeleteObjectsRequest
@@ -289,9 +289,6 @@ namespace Musify.Infrastructure.Services
var deleteResponse = await amazonS3.DeleteObjectsAsync(deleteRequest, cancellationToken);
// Some S3-compatible backends (SeaweedFS included) omit the <Error> list from the
// XML response entirely when nothing failed, which the SDK deserializes as null
// rather than an empty list — real AWS S3 always returns a (possibly empty) list.
var deleteErrors = deleteResponse.DeleteErrors ?? [];
if (deleteErrors.Count > 0)
{
@@ -29,9 +29,9 @@ namespace Musify.Infrastructure.Services
var now = DateTimeOffset.UtcNow;
var claims = new Dictionary<string, object> { ["prefix"] = keyPrefix };
if (userId is not null)
if (userId != null)
claims["sub"] = userId.Value.ToString();
if (maxBytes is not null)
if (maxBytes != null)
claims["maxBytes"] = maxBytes.Value.ToString();
var descriptor = new SecurityTokenDescriptor