mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-26 23:57:35 +08:00
Merge branch 'develop'
This commit is contained in:
commit
6a49a324b1
@ -78,7 +78,6 @@
|
|||||||
<PackageReference Include="Serilog.Sinks.SpectreConsole" Version="0.3.3" />
|
<PackageReference Include="Serilog.Sinks.SpectreConsole" Version="0.3.3" />
|
||||||
<PackageReference Include="Serilog.Sinks.XUnit" Version="3.0.3" />
|
<PackageReference Include="Serilog.Sinks.XUnit" Version="3.0.3" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" />
|
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.5.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.5.0" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.5.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.5.0" />
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="6.0.5" />
|
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="6.0.5" />
|
||||||
|
|||||||
@ -25,5 +25,5 @@ public abstract record Aggregate<TId> : Audit, IAggregate<TId>
|
|||||||
|
|
||||||
public long Version { get; set; }
|
public long Version { get; set; }
|
||||||
|
|
||||||
public TId Id { get; set; }
|
public required TId Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,7 +62,7 @@ public static class ServiceCollectionExtensions
|
|||||||
// options.OperationFilter<TagBySwaggerOperationFilter>();
|
// options.OperationFilter<TagBySwaggerOperationFilter>();
|
||||||
|
|
||||||
// Enables Swagger annotations (SwaggerOperationAttribute, SwaggerParameterAttribute etc.)
|
// Enables Swagger annotations (SwaggerOperationAttribute, SwaggerParameterAttribute etc.)
|
||||||
options.EnableAnnotations();
|
// options.EnableAnnotations();
|
||||||
});
|
});
|
||||||
|
|
||||||
services.Configure<SwaggerGeneratorOptions>(o => o.InferSecuritySchemes = true);
|
services.Configure<SwaggerGeneratorOptions>(o => o.InferSecuritySchemes = true);
|
||||||
|
|||||||
@ -7,7 +7,6 @@ using Microsoft.AspNetCore.Builder;
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
|
||||||
|
|
||||||
public record CreateBookingRequestDto(Guid PassengerId, Guid FlightId, string Description);
|
public record CreateBookingRequestDto(Guid PassengerId, Guid FlightId, string Description);
|
||||||
public record CreateBookingResponseDto(ulong Id);
|
public record CreateBookingResponseDto(ulong Id);
|
||||||
|
|||||||
@ -4,9 +4,9 @@ using ValueObjects;
|
|||||||
|
|
||||||
public class BookingReadModel
|
public class BookingReadModel
|
||||||
{
|
{
|
||||||
public Guid Id { get; init; }
|
public required Guid Id { get; init; }
|
||||||
public Guid BookId { get; init; }
|
public required Guid BookId { get; init; }
|
||||||
public Trip Trip { get; init; }
|
public required Trip Trip { get; init; }
|
||||||
public PassengerInfo PassengerInfo { get; init; }
|
public required PassengerInfo PassengerInfo { get; init; }
|
||||||
public bool IsDeleted { get; init; }
|
public required bool IsDeleted { get; init; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Builder;
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
|
||||||
|
|
||||||
public record CreateAircraftRequestDto(string Name, string Model, int ManufacturingYear);
|
public record CreateAircraftRequestDto(string Name, string Model, int ManufacturingYear);
|
||||||
public record CreateAircraftResponseDto(Guid Id);
|
public record CreateAircraftResponseDto(Guid Id);
|
||||||
|
|||||||
@ -7,8 +7,8 @@ using Ardalis.GuardClauses;
|
|||||||
using BuildingBlocks.Core.CQRS;
|
using BuildingBlocks.Core.CQRS;
|
||||||
using BuildingBlocks.Core.Event;
|
using BuildingBlocks.Core.Event;
|
||||||
using Exceptions;
|
using Exceptions;
|
||||||
using Flight.Aircrafts.Models;
|
using Models;
|
||||||
using Flight.Data;
|
using Data;
|
||||||
using MapsterMapper;
|
using MapsterMapper;
|
||||||
using MediatR;
|
using MediatR;
|
||||||
using MongoDB.Driver;
|
using MongoDB.Driver;
|
||||||
|
|||||||
@ -4,10 +4,10 @@ using System;
|
|||||||
|
|
||||||
public class AircraftReadModel
|
public class AircraftReadModel
|
||||||
{
|
{
|
||||||
public Guid Id { get; init; }
|
public required Guid Id { get; init; }
|
||||||
public Guid AircraftId { get; init; }
|
public required Guid AircraftId { get; init; }
|
||||||
public string Name { get; init; }
|
public required string Name { get; init; }
|
||||||
public string Model { get; init; }
|
public required string Model { get; init; }
|
||||||
public int ManufacturingYear { get; init; }
|
public required int ManufacturingYear { get; init; }
|
||||||
public bool IsDeleted { get; init; }
|
public required bool IsDeleted { get; init; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Builder;
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
|
||||||
|
|
||||||
public record CreateAirportRequestDto(string Name, string Address, string Code);
|
public record CreateAirportRequestDto(string Name, string Address, string Code);
|
||||||
public record CreateAirportResponseDto(Guid Id);
|
public record CreateAirportResponseDto(Guid Id);
|
||||||
|
|||||||
@ -4,10 +4,10 @@ using System;
|
|||||||
|
|
||||||
public class AirportReadModel
|
public class AirportReadModel
|
||||||
{
|
{
|
||||||
public Guid Id { get; init; }
|
public required Guid Id { get; init; }
|
||||||
public Guid AirportId { get; init; }
|
public required Guid AirportId { get; init; }
|
||||||
public string Name { get; init; }
|
public required string Name { get; init; }
|
||||||
public string Address { get; init; }
|
public string Address { get; init; }
|
||||||
public string Code { get; init; }
|
public required string Code { get; init; }
|
||||||
public bool IsDeleted { get; init; }
|
public required bool IsDeleted { get; init; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Builder;
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
|
||||||
|
|
||||||
public record CreateFlightRequestDto(string FlightNumber, Guid AircraftId, Guid DepartureAirportId,
|
public record CreateFlightRequestDto(string FlightNumber, Guid AircraftId, Guid DepartureAirportId,
|
||||||
DateTime DepartureDate, DateTime ArriveDate, Guid ArriveAirportId,
|
DateTime DepartureDate, DateTime ArriveDate, Guid ArriveAirportId,
|
||||||
|
|||||||
@ -9,7 +9,6 @@ using Microsoft.AspNetCore.Builder;
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
|
||||||
|
|
||||||
public class DeleteFlightEndpoint : IMinimalEndpoint
|
public class DeleteFlightEndpoint : IMinimalEndpoint
|
||||||
{
|
{
|
||||||
|
|||||||
@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Builder;
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
|
||||||
|
|
||||||
public record GetAvailableFlightsResponseDto(IEnumerable<FlightDto> FlightDtos);
|
public record GetAvailableFlightsResponseDto(IEnumerable<FlightDto> FlightDtos);
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Builder;
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
|
||||||
|
|
||||||
public record GetFlightByIdResponseDto(FlightDto FlightDto);
|
public record GetFlightByIdResponseDto(FlightDto FlightDto);
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Builder;
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
|
||||||
|
|
||||||
public record UpdateFlightRequestDto(Guid Id, string FlightNumber, Guid AircraftId, Guid DepartureAirportId, DateTime DepartureDate, DateTime ArriveDate,
|
public record UpdateFlightRequestDto(Guid Id, string FlightNumber, Guid AircraftId, Guid DepartureAirportId, DateTime DepartureDate, DateTime ArriveDate,
|
||||||
Guid ArriveAirportId, decimal DurationMinutes, DateTime FlightDate, Enums.FlightStatus Status, decimal Price, bool IsDeleted);
|
Guid ArriveAirportId, decimal DurationMinutes, DateTime FlightDate, Enums.FlightStatus Status, decimal Price, bool IsDeleted);
|
||||||
|
|||||||
@ -4,17 +4,17 @@ using System;
|
|||||||
|
|
||||||
public class FlightReadModel
|
public class FlightReadModel
|
||||||
{
|
{
|
||||||
public Guid Id { get; init; }
|
public required Guid Id { get; init; }
|
||||||
public Guid FlightId { get; init; }
|
public required Guid FlightId { get; init; }
|
||||||
public string FlightNumber { get; init; }
|
public required string FlightNumber { get; init; }
|
||||||
public Guid AircraftId { get; init; }
|
public required Guid AircraftId { get; init; }
|
||||||
public DateTime DepartureDate { get; init; }
|
public required DateTime DepartureDate { get; init; }
|
||||||
public Guid DepartureAirportId { get; init; }
|
public required Guid DepartureAirportId { get; init; }
|
||||||
public DateTime ArriveDate { get; init; }
|
public required DateTime ArriveDate { get; init; }
|
||||||
public Guid ArriveAirportId { get; init; }
|
public required Guid ArriveAirportId { get; init; }
|
||||||
public decimal DurationMinutes { get; init; }
|
public required decimal DurationMinutes { get; init; }
|
||||||
public DateTime FlightDate { get; init; }
|
public required DateTime FlightDate { get; init; }
|
||||||
public Enums.FlightStatus Status { get; init; }
|
public required Enums.FlightStatus Status { get; init; }
|
||||||
public decimal Price { get; init; }
|
public required decimal Price { get; init; }
|
||||||
public bool IsDeleted { get; init; }
|
public required bool IsDeleted { get; init; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Builder;
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
|
||||||
|
|
||||||
public record CreateSeatRequestDto(string SeatNumber, Enums.SeatType Type, Enums.SeatClass Class, Guid FlightId);
|
public record CreateSeatRequestDto(string SeatNumber, Enums.SeatType Type, Enums.SeatClass Class, Guid FlightId);
|
||||||
public record CreateSeatResponseDto(Guid Id);
|
public record CreateSeatResponseDto(Guid Id);
|
||||||
|
|||||||
@ -11,7 +11,6 @@ using Microsoft.AspNetCore.Builder;
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
|
||||||
|
|
||||||
public record GetAvailableSeatsResponseDto(IEnumerable<SeatDto> SeatDtos);
|
public record GetAvailableSeatsResponseDto(IEnumerable<SeatDto> SeatDtos);
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Builder;
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
|
||||||
|
|
||||||
public record ReserveSeatRequestDto(Guid FlightId, string SeatNumber);
|
public record ReserveSeatRequestDto(Guid FlightId, string SeatNumber);
|
||||||
public record ReserveSeatResponseDto(Guid Id);
|
public record ReserveSeatResponseDto(Guid Id);
|
||||||
|
|||||||
@ -4,11 +4,11 @@ using System;
|
|||||||
|
|
||||||
public class SeatReadModel
|
public class SeatReadModel
|
||||||
{
|
{
|
||||||
public Guid Id { get; init; }
|
public required Guid Id { get; init; }
|
||||||
public Guid SeatId { get; init; }
|
public required Guid SeatId { get; init; }
|
||||||
public string SeatNumber { get; init; }
|
public required string SeatNumber { get; init; }
|
||||||
public Enums.SeatType Type { get; init; }
|
public required Enums.SeatType Type { get; init; }
|
||||||
public Enums.SeatClass Class { get; init; }
|
public required Enums.SeatClass Class { get; init; }
|
||||||
public Guid FlightId { get; init; }
|
public required Guid FlightId { get; init; }
|
||||||
public bool IsDeleted { get; init; }
|
public required bool IsDeleted { get; init; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Builder;
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
|
||||||
|
|
||||||
public record RegisterNewUserRequestDto(string FirstName, string LastName, string Username, string Email,
|
public record RegisterNewUserRequestDto(string FirstName, string LastName, string Username, string Email,
|
||||||
string Password, string ConfirmPassword, string PassportNumber);
|
string Password, string ConfirmPassword, string PassportNumber);
|
||||||
|
|||||||
@ -7,8 +7,8 @@ using BuildingBlocks.Core.Model;
|
|||||||
|
|
||||||
public class User : IdentityUser<Guid>, IVersion
|
public class User : IdentityUser<Guid>, IVersion
|
||||||
{
|
{
|
||||||
public string FirstName { get; init; }
|
public required string FirstName { get; init; }
|
||||||
public string LastName { get; init; }
|
public required string LastName { get; init; }
|
||||||
public string PassPortNumber { get; init; }
|
public required string PassPortNumber { get; init; }
|
||||||
public long Version { get; set; }
|
public long Version { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,9 @@ using Data;
|
|||||||
using Dtos;
|
using Dtos;
|
||||||
using MassTransit;
|
using MassTransit;
|
||||||
|
|
||||||
public record CompleteRegisterPassenger(string PassportNumber, Enums.PassengerType PassengerType, int Age) : ICommand<CompleteRegisterPassengerResult>, IInternalCommand
|
public record CompleteRegisterPassenger
|
||||||
|
(string PassportNumber, Enums.PassengerType PassengerType, int Age) : ICommand<CompleteRegisterPassengerResult>,
|
||||||
|
IInternalCommand
|
||||||
{
|
{
|
||||||
public Guid Id { get; init; } = NewId.NextGuid();
|
public Guid Id { get; init; } = NewId.NextGuid();
|
||||||
}
|
}
|
||||||
@ -33,7 +35,9 @@ internal class CompleteRegisterPassengerValidator : AbstractValidator<CompleteRe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class CompleteRegisterPassengerCommandHandler : ICommandHandler<CompleteRegisterPassenger, CompleteRegisterPassengerResult>
|
internal class
|
||||||
|
CompleteRegisterPassengerCommandHandler : ICommandHandler<CompleteRegisterPassenger,
|
||||||
|
CompleteRegisterPassengerResult>
|
||||||
{
|
{
|
||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
private readonly PassengerDbContext _passengerDbContext;
|
private readonly PassengerDbContext _passengerDbContext;
|
||||||
@ -44,7 +48,8 @@ internal class CompleteRegisterPassengerCommandHandler : ICommandHandler<Complet
|
|||||||
_passengerDbContext = passengerDbContext;
|
_passengerDbContext = passengerDbContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<CompleteRegisterPassengerResult> Handle(CompleteRegisterPassenger request, CancellationToken cancellationToken)
|
public async Task<CompleteRegisterPassengerResult> Handle(CompleteRegisterPassenger request,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Guard.Against.Null(request, nameof(request));
|
Guard.Against.Null(request, nameof(request));
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,6 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Dtos;
|
using Dtos;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
|
||||||
|
|
||||||
public record GetPassengerByIdResponseDto(PassengerDto PassengerDto);
|
public record GetPassengerByIdResponseDto(PassengerDto PassengerDto);
|
||||||
|
|
||||||
|
|||||||
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
public class PassengerReadModel
|
public class PassengerReadModel
|
||||||
{
|
{
|
||||||
public Guid Id { get; init; }
|
public required Guid Id { get; init; }
|
||||||
public Guid PassengerId { get; init; }
|
public required Guid PassengerId { get; init; }
|
||||||
public string PassportNumber { get; init; }
|
public required string PassportNumber { get; init; }
|
||||||
public string Name { get; init; }
|
public required string Name { get; init; }
|
||||||
public Enums.PassengerType PassengerType { get; init; }
|
public required Enums.PassengerType PassengerType { get; init; }
|
||||||
public int Age { get; init; }
|
public int Age { get; init; }
|
||||||
public bool IsDeleted { get; init; }
|
public required bool IsDeleted { get; init; }
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user