diff --git a/src/BuildingBlocks/BuildingBlocks.csproj b/src/BuildingBlocks/BuildingBlocks.csproj index 3f4f0244..8595b07a 100644 --- a/src/BuildingBlocks/BuildingBlocks.csproj +++ b/src/BuildingBlocks/BuildingBlocks.csproj @@ -33,10 +33,6 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - diff --git a/src/Services/Flight/src/Flight/Data/Configurations/AirportConfiguration.cs b/src/Services/Flight/src/Flight/Data/Configurations/AirportConfiguration.cs index 2111c3be..6570a2dd 100644 --- a/src/Services/Flight/src/Flight/Data/Configurations/AirportConfiguration.cs +++ b/src/Services/Flight/src/Flight/Data/Configurations/AirportConfiguration.cs @@ -17,7 +17,7 @@ public void Configure(EntityTypeBuilder builder) builder.HasKey(r => r.Id); builder.Property(r => r.Id).ValueGeneratedNever() .HasConversion(airportId => airportId.Value, dbId => AirportId.Of(dbId)); - + // // ref: https://learn.microsoft.com/en-us/ef/core/saving/concurrency?tabs=fluent-api builder.Property(r => r.Version).IsConcurrencyToken(); diff --git a/src/Services/Flight/src/Flight/Flights/Models/Flight.cs b/src/Services/Flight/src/Flight/Flights/Models/Flight.cs index b246d304..fc788157 100644 --- a/src/Services/Flight/src/Flight/Flights/Models/Flight.cs +++ b/src/Services/Flight/src/Flight/Flights/Models/Flight.cs @@ -1,4 +1,3 @@ -using System; using BuildingBlocks.Core.Model; namespace Flight.Flights.Models; @@ -8,7 +7,6 @@ namespace Flight.Flights.Models; using Features.CreatingFlight.V1; using Features.DeletingFlight.V1; using Features.UpdatingFlight.V1; -using global::Flight.Flights.Exceptions; using global::Flight.Flights.ValueObjects; public record Flight : Aggregate @@ -29,8 +27,6 @@ public static Flight Create(FlightId id, FlightNumber flightNumber, AircraftId a AirportId arriveAirportId, DurationMinutes durationMinutes, FlightDate flightDate, Enums.FlightStatus status, Price price, bool isDeleted = false) { - //SimpleFlightValidate(departureDate.Value, arriveDate.Value, flightDate.Value); - var flight = new Flight { Id = id, @@ -103,27 +99,4 @@ public void Delete(FlightId id, FlightNumber flightNumber, AircraftId aircraftId AddDomainEvent(@event); } - - public static void SimpleFlightValidate(DateTime departureDate, DateTime arriveDate, DateTime flightDate) - { - if (departureDate >= arriveDate) - { - throw new FlightExceptions(departureDate, arriveDate); - } - - if (flightDate < departureDate || flightDate > arriveDate) - { - throw new FlightExceptions(flightDate); - } - } - - public static TimeSpan GetFlightDuration(DateTime departureDate, DateTime arriveDate) - { - return arriveDate - departureDate; - } - - public static bool IsOnSameDay(DateTime departureDate, DateTime arriveDate) - { - return departureDate.Date == arriveDate.Date; - } }