diff --git a/Infrastructure/Infrastructure.csproj b/Infrastructure/Infrastructure.csproj
index 4b67f77..3808e4b 100644
--- a/Infrastructure/Infrastructure.csproj
+++ b/Infrastructure/Infrastructure.csproj
@@ -13,6 +13,12 @@
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
diff --git a/Infrastructure/Messaging/MassTransitDependencyInjection.cs b/Infrastructure/Messaging/MassTransitDependencyInjection.cs
index 9e5f183..c7a37f0 100644
--- a/Infrastructure/Messaging/MassTransitDependencyInjection.cs
+++ b/Infrastructure/Messaging/MassTransitDependencyInjection.cs
@@ -7,7 +7,33 @@ namespace Musify.Infrastructure.Messaging
{
public static class MassTransitDependencyInjection
{
- public static void AddMassTransitHandler(this IServiceCollection serviceDescriptors, IConfiguration configuration)
+ public static void AddMassTransitClient(this IServiceCollection serviceDescriptors, IConfiguration configuration)
+ {
+ serviceDescriptors.AddMassTransit(options =>
+ {
+ options.UsingRabbitMq((busRegistrationContext, busFactoryConfigurator) =>
+ {
+ var section = configuration.GetSection("MassTransit");
+
+ var host = section["Host"]
+ ?? throw new InvalidOperationException("MassTransit:Host configuration value not found.");
+
+ var username = section["Username"]
+ ?? throw new InvalidOperationException("MassTransit:Username configuration value not found.");
+
+ var password = section["Password"]
+ ?? throw new InvalidOperationException("MassTransit:Password configuration value not found.");
+
+ busFactoryConfigurator.Host(host, options =>
+ {
+ options.Username(username);
+ options.Password(password);
+ } );
+ } );
+ } );
+ }
+
+ public static void AddMassTransitConsumers(this IServiceCollection serviceDescriptors, IConfiguration configuration)
{
serviceDescriptors.AddMassTransit(options =>
{
diff --git a/Infrastructure/Persistence/DatabaseDesignTimeFactory.cs b/Infrastructure/Persistence/DatabaseDesignTimeFactory.cs
new file mode 100644
index 0000000..d776732
--- /dev/null
+++ b/Infrastructure/Persistence/DatabaseDesignTimeFactory.cs
@@ -0,0 +1,23 @@
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Design;
+using Microsoft.Extensions.Configuration;
+
+namespace Musify.Infrastructure.Persistence
+{
+ public class DatabaseDesignTimeFactory : IDesignTimeDbContextFactory
+ {
+ public Database CreateDbContext(string[] args)
+ {
+ var configuration = new ConfigurationBuilder()
+ .SetBasePath(Directory.GetCurrentDirectory())
+ .AddJsonFile("AppSettings.json")
+ .Build();
+ var connectionString = configuration.GetConnectionString("Default");
+
+ var optionsBuilder = new DbContextOptionsBuilder();
+ optionsBuilder.UseNpgsql(connectionString);
+
+ return new Database(optionsBuilder.Options);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Infrastructure/Storage/StorageHandler.cs b/Infrastructure/Storage/StorageHandler.cs
index b95f616..ff6a7ac 100644
--- a/Infrastructure/Storage/StorageHandler.cs
+++ b/Infrastructure/Storage/StorageHandler.cs
@@ -78,6 +78,7 @@ namespace Musify.Infrastructure.Storage
try
{
await trasnsferUtility.UploadAsync(filePath, bucketName, fileName, cancellationToken);
+ logger.LogInformation("Successfully transferred file {FileName} to S3 with bucket name {BucketName} and route {Route}", fileName, bucketName, route);
}
catch
{
@@ -102,6 +103,7 @@ namespace Musify.Infrastructure.Storage
try
{
var response = await amazonS3.PutObjectAsync(request, cancellationToken);
+ logger.LogInformation("Successfully uploaded file to S3 with bucket name {BucketName} and key name {KeyName}", bucketName, keyName);
}
catch
{