diff --git a/src/BuildingBlocks/BuildingBlocks.csproj b/src/BuildingBlocks/BuildingBlocks.csproj
index 6c782d4..fd6de72 100644
--- a/src/BuildingBlocks/BuildingBlocks.csproj
+++ b/src/BuildingBlocks/BuildingBlocks.csproj
@@ -24,6 +24,7 @@
+
all
@@ -95,11 +96,11 @@
-
-
-
-
-
+
+
+
+
+
all
diff --git a/src/BuildingBlocks/HealthCheck/Extensions.cs b/src/BuildingBlocks/HealthCheck/Extensions.cs
index 0703d2c..d2c9f8f 100644
--- a/src/BuildingBlocks/HealthCheck/Extensions.cs
+++ b/src/BuildingBlocks/HealthCheck/Extensions.cs
@@ -24,13 +24,14 @@ public static class Extensions
var logOptions = services.GetOptions("LogOptions");
var healthChecksBuilder = services.AddHealthChecks()
- .AddSqlServer(sqlOptions.DefaultConnection)
.AddRabbitMQ(rabbitConnectionString: $"amqp://{rabbitMqOptions.UserName}:{rabbitMqOptions.Password}@{rabbitMqOptions.HostName}")
.AddElasticsearch(logOptions.Elastic.ElasticServiceUrl);
if (mongoOptions.ConnectionString is not null)
healthChecksBuilder.AddMongoDb(mongoOptions.ConnectionString);
+ if (sqlOptions.DefaultConnection is not null)
+ healthChecksBuilder.AddSqlServer(sqlOptions.DefaultConnection);
services.AddHealthChecksUI(setup =>
{
diff --git a/src/BuildingBlocks/OpenTelemetry/Extensions.cs b/src/BuildingBlocks/OpenTelemetry/Extensions.cs
index 098f06b..d842616 100644
--- a/src/BuildingBlocks/OpenTelemetry/Extensions.cs
+++ b/src/BuildingBlocks/OpenTelemetry/Extensions.cs
@@ -11,6 +11,7 @@ public static class Extensions
public static IServiceCollection AddCustomOpenTelemetry(this IServiceCollection services)
{
services.AddOpenTelemetryTracing(builder => builder
+ .AddGrpcClientInstrumentation()
.AddMassTransitInstrumentation()
.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
diff --git a/src/Services/Flight/src/Flight/Data/Seed/FlightDataSeeder.cs b/src/Services/Flight/src/Flight/Data/Seed/FlightDataSeeder.cs
index 3ae6fec..acc6b8b 100644
--- a/src/Services/Flight/src/Flight/Data/Seed/FlightDataSeeder.cs
+++ b/src/Services/Flight/src/Flight/Data/Seed/FlightDataSeeder.cs
@@ -13,6 +13,8 @@ using Flight.Seats.Models;
using Flight.Seats.Models.Reads;
using MapsterMapper;
using Microsoft.EntityFrameworkCore;
+using MongoDB.Driver;
+using MongoDB.Driver.Linq;
namespace Flight.Data.Seed;
@@ -51,7 +53,9 @@ public class FlightDataSeeder : IDataSeeder
await _flightDbContext.Airports.AddRangeAsync(airports);
await _flightDbContext.SaveChangesAsync();
- await _flightReadDbContext.Airport.InsertManyAsync(_mapper.Map>(airports));
+
+ if (!await _flightReadDbContext.Airport.AsQueryable().AnyAsync())
+ await _flightReadDbContext.Airport.InsertManyAsync(_mapper.Map>(airports));
}
}
@@ -68,7 +72,9 @@ public class FlightDataSeeder : IDataSeeder
await _flightDbContext.Aircraft.AddRangeAsync(aircrafts);
await _flightDbContext.SaveChangesAsync();
- await _flightReadDbContext.Aircraft.InsertManyAsync(_mapper.Map>(aircrafts));
+
+ if (!await _flightReadDbContext.Aircraft.AsQueryable().AnyAsync())
+ await _flightReadDbContext.Aircraft.InsertManyAsync(_mapper.Map>(aircrafts));
}
}
@@ -79,7 +85,7 @@ public class FlightDataSeeder : IDataSeeder
{
var seats = new List
{
- Seat.Create(1 ,"12A", Seats.Enums.SeatType.Window, Seats.Enums.SeatClass.Economy, 1),
+ Seat.Create(1, "12A", Seats.Enums.SeatType.Window, Seats.Enums.SeatClass.Economy, 1),
Seat.Create(2, "12B", Seats.Enums.SeatType.Window, Seats.Enums.SeatClass.Economy, 1),
Seat.Create(3, "12C", Seats.Enums.SeatType.Middle, Seats.Enums.SeatClass.Economy, 1),
Seat.Create(4, "12D", Seats.Enums.SeatType.Middle, Seats.Enums.SeatClass.Economy, 1),
@@ -89,7 +95,9 @@ public class FlightDataSeeder : IDataSeeder
await _flightDbContext.Seats.AddRangeAsync(seats);
await _flightDbContext.SaveChangesAsync();
- await _flightReadDbContext.Seat.InsertManyAsync(_mapper.Map>(seats));
+
+ if (!await _flightReadDbContext.Seat.AsQueryable().AnyAsync())
+ await _flightReadDbContext.Seat.InsertManyAsync(_mapper.Map>(seats));
}
}
@@ -107,7 +115,9 @@ public class FlightDataSeeder : IDataSeeder
};
await _flightDbContext.Flights.AddRangeAsync(flights);
await _flightDbContext.SaveChangesAsync();
- await _flightReadDbContext.Flight.InsertManyAsync(_mapper.Map>(flights));
+
+ if (!await _flightReadDbContext.Flight.AsQueryable().AnyAsync())
+ await _flightReadDbContext.Flight.InsertManyAsync(_mapper.Map>(flights));
}
}
}
diff --git a/src/Services/Identity/src/Identity.Api/Program.cs b/src/Services/Identity/src/Identity.Api/Program.cs
index 2e98509..e954fd2 100644
--- a/src/Services/Identity/src/Identity.Api/Program.cs
+++ b/src/Services/Identity/src/Identity.Api/Program.cs
@@ -15,6 +15,7 @@ using FluentValidation;
using Hellang.Middleware.ProblemDetails;
using Identity;
using Identity.Data;
+using Identity.Data.Seed;
using Identity.Extensions;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.EntityFrameworkCore;
diff --git a/src/Services/Identity/src/Identity/Data/IdentityDataSeeder.cs b/src/Services/Identity/src/Identity/Data/Seed/IdentityDataSeeder.cs
similarity index 98%
rename from src/Services/Identity/src/Identity/Data/IdentityDataSeeder.cs
rename to src/Services/Identity/src/Identity/Data/Seed/IdentityDataSeeder.cs
index 85c1e35..293641c 100644
--- a/src/Services/Identity/src/Identity/Data/IdentityDataSeeder.cs
+++ b/src/Services/Identity/src/Identity/Data/Seed/IdentityDataSeeder.cs
@@ -7,7 +7,7 @@ using Identity.Identity.Constants;
using Identity.Identity.Models;
using Microsoft.AspNetCore.Identity;
-namespace Identity.Data;
+namespace Identity.Data.Seed;
public class IdentityDataSeeder : IDataSeeder
{
diff --git a/src/Services/Identity/src/Identity/Identity.csproj b/src/Services/Identity/src/Identity/Identity.csproj
index 843ad48..42086cb 100644
--- a/src/Services/Identity/src/Identity/Identity.csproj
+++ b/src/Services/Identity/src/Identity/Identity.csproj
@@ -16,7 +16,6 @@
-