A lot of changes
This commit is contained in:
@@ -12,7 +12,7 @@ using Musify.Domain.Entities;
|
||||
namespace Musify.Application.PlayLists.Commands.CreatePlayList
|
||||
{
|
||||
public class CreatePlayListCommandHandler(IPublishEndpoint publishEndpoint, IDatabase database, IStorageHandler storageHandler,
|
||||
ILogger<CreatePlayListCommandHandler> logger, StorageConfiguration storageConfiguration, PlayListConfiguration playListConfiguration)
|
||||
ILogger<CreatePlayListCommandHandler> logger, StorageSettings storageConfiguration, PlayListConfiguration playListConfiguration)
|
||||
: IRequestHandler<CreatePlayListCommand, Task<Result<PlayListResponse>> >
|
||||
{
|
||||
public async Task<Result<PlayListResponse>> Handle(CreatePlayListCommand request, CancellationToken cancellationToken)
|
||||
@@ -57,7 +57,7 @@ namespace Musify.Application.PlayLists.Commands.CreatePlayList
|
||||
return Result.Error($"Failed to upload picture for PlayList with Id {playList.Id} to storage.");
|
||||
}
|
||||
|
||||
logger.LogInformation("PlayList with Id={PlayListId} created successfully for UserId={UserId}.", playList.Id, request.UserId);
|
||||
logger.LogInformation("Playlist image uploaded successfully for PlayList with Id={PlayListId}.", playList.Id);
|
||||
|
||||
await publishEndpoint.Publish(new ResizePictureEvent(
|
||||
storageConfiguration.BucketName,
|
||||
@@ -85,7 +85,7 @@ namespace Musify.Application.PlayLists.Commands.CreatePlayList
|
||||
await database.PlayLists.AddAsync(playList, cancellationToken);
|
||||
await database.SaveChangesAsync(cancellationToken);
|
||||
|
||||
logger.LogInformation("Picture for PlayList with Id={PlayListId} ", playList.Id);
|
||||
logger.LogInformation("PlayList with id={PlayListId} created successfully for user with id={UserId}.", playList.Id, request.UserId);
|
||||
return Result.Created(PlayListResponse.FromEntity(playList));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ using Musify.Application.Events;
|
||||
namespace Musify.Application.PlayLists.Commands.DeletePlayList
|
||||
{
|
||||
public class DeletePlayListCommandHandler(IDatabase database, IPublishEndpoint publishEndpoint,
|
||||
StorageConfiguration storageConfiguration, PlayListConfiguration playListConfiguration, ILogger<DeletePlayListCommandHandler> logger)
|
||||
StorageSettings storageConfiguration, PlayListConfiguration playListConfiguration, ILogger<DeletePlayListCommandHandler> logger)
|
||||
: IRequestHandler<DeletePlayListCommand, Task<Result>>
|
||||
{
|
||||
public async Task<Result> Handle(DeletePlayListCommand request, CancellationToken cancellationToken)
|
||||
|
||||
@@ -11,7 +11,7 @@ using Musify.Application.PlayLists.Contracts;
|
||||
namespace Musify.Application.PlayLists.Commands.UpdatePlayList
|
||||
{
|
||||
public class UpdatePlayListCommandHandler(IPublishEndpoint publishEndpoint, IDatabase database, IStorageHandler storageHandler,
|
||||
ILogger<UpdatePlayListCommandHandler> logger, StorageConfiguration storageConfiguration, PlayListConfiguration playListConfiguration)
|
||||
ILogger<UpdatePlayListCommandHandler> logger, StorageSettings storageConfiguration, PlayListConfiguration playListConfiguration)
|
||||
: IRequestHandler<UpdatePlayListCommand, Task<Result<PlayListResponse>> >
|
||||
{
|
||||
public async Task<Result<PlayListResponse>> Handle(UpdatePlayListCommand request, CancellationToken cancellationToken)
|
||||
@@ -40,7 +40,7 @@ namespace Musify.Application.PlayLists.Commands.UpdatePlayList
|
||||
{
|
||||
database.PlayLists.Update(playList);
|
||||
await database.SaveChangesAsync(cancellationToken);
|
||||
logger.LogInformation("Updated PlayList with id={PlayListId}.", playList.Id);
|
||||
logger.LogInformation("Updated PlayList with id={PlayListId} without picture changes.", playList.Id);
|
||||
return Result.Success(PlayListResponse.FromEntity(playList));
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Musify.Application.PlayLists.Commands.UpdatePlayList
|
||||
return Result.Error($"Failed to upload picture for PlayList with Id {playList.Id} to storage.");
|
||||
}
|
||||
|
||||
playList.OriginalPictureKeyName = newImageId.ToString();
|
||||
playList.OriginalPictureKeyName = imageKeyName;
|
||||
await publishEndpoint.Publish(new ResizePictureEvent(
|
||||
storageConfiguration.BucketName,
|
||||
imageKeyName,
|
||||
@@ -108,7 +108,7 @@ namespace Musify.Application.PlayLists.Commands.UpdatePlayList
|
||||
database.PlayLists.Update(playList);
|
||||
await database.SaveChangesAsync(cancellationToken);
|
||||
|
||||
logger.LogInformation("Updated PlayList with id={PlayListId}.", playList.Id);
|
||||
logger.LogInformation("Updated PlayList with id={PlayListId} and picture key {PictureKeyName}.", playList.Id, imageKeyName);
|
||||
return Result.Success(PlayListResponse.FromEntity(playList));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user