Merge branch 'develop'

This commit is contained in:
Pc 2023-04-02 17:53:12 +03:30
commit 6a49a324b1
25 changed files with 57 additions and 66 deletions

View File

@ -78,7 +78,6 @@
<PackageReference Include="Serilog.Sinks.SpectreConsole" Version="0.3.3" />
<PackageReference Include="Serilog.Sinks.XUnit" Version="3.0.3" />
<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.SwaggerUI" Version="6.5.0" />
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="6.0.5" />

View File

@ -25,5 +25,5 @@ public abstract record Aggregate<TId> : Audit, IAggregate<TId>
public long Version { get; set; }
public TId Id { get; set; }
public required TId Id { get; set; }
}

View File

@ -62,7 +62,7 @@ public static class ServiceCollectionExtensions
// options.OperationFilter<TagBySwaggerOperationFilter>();
// Enables Swagger annotations (SwaggerOperationAttribute, SwaggerParameterAttribute etc.)
options.EnableAnnotations();
// options.EnableAnnotations();
});
services.Configure<SwaggerGeneratorOptions>(o => o.InferSecuritySchemes = true);

View File

@ -7,7 +7,6 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.Annotations;
public record CreateBookingRequestDto(Guid PassengerId, Guid FlightId, string Description);
public record CreateBookingResponseDto(ulong Id);

View File

@ -4,9 +4,9 @@ using ValueObjects;
public class BookingReadModel
{
public Guid Id { get; init; }
public Guid BookId { get; init; }
public Trip Trip { get; init; }
public PassengerInfo PassengerInfo { get; init; }
public bool IsDeleted { get; init; }
public required Guid Id { get; init; }
public required Guid BookId { get; init; }
public required Trip Trip { get; init; }
public required PassengerInfo PassengerInfo { get; init; }
public required bool IsDeleted { get; init; }
}

View File

@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.Annotations;
public record CreateAircraftRequestDto(string Name, string Model, int ManufacturingYear);
public record CreateAircraftResponseDto(Guid Id);

View File

@ -7,8 +7,8 @@ using Ardalis.GuardClauses;
using BuildingBlocks.Core.CQRS;
using BuildingBlocks.Core.Event;
using Exceptions;
using Flight.Aircrafts.Models;
using Flight.Data;
using Models;
using Data;
using MapsterMapper;
using MediatR;
using MongoDB.Driver;

View File

@ -4,10 +4,10 @@ using System;
public class AircraftReadModel
{
public Guid Id { get; init; }
public Guid AircraftId { get; init; }
public string Name { get; init; }
public string Model { get; init; }
public int ManufacturingYear { get; init; }
public bool IsDeleted { get; init; }
public required Guid Id { get; init; }
public required Guid AircraftId { get; init; }
public required string Name { get; init; }
public required string Model { get; init; }
public required int ManufacturingYear { get; init; }
public required bool IsDeleted { get; init; }
}

View File

@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.Annotations;
public record CreateAirportRequestDto(string Name, string Address, string Code);
public record CreateAirportResponseDto(Guid Id);

View File

@ -4,10 +4,10 @@ using System;
public class AirportReadModel
{
public Guid Id { get; init; }
public Guid AirportId { get; init; }
public string Name { get; init; }
public required Guid Id { get; init; }
public required Guid AirportId { get; init; }
public required string Name { get; init; }
public string Address { get; init; }
public string Code { get; init; }
public bool IsDeleted { get; init; }
public required string Code { get; init; }
public required bool IsDeleted { get; init; }
}

View File

@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.Annotations;
public record CreateFlightRequestDto(string FlightNumber, Guid AircraftId, Guid DepartureAirportId,
DateTime DepartureDate, DateTime ArriveDate, Guid ArriveAirportId,

View File

@ -9,7 +9,6 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.Annotations;
public class DeleteFlightEndpoint : IMinimalEndpoint
{

View File

@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.Annotations;
public record GetAvailableFlightsResponseDto(IEnumerable<FlightDto> FlightDtos);

View File

@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.Annotations;
public record GetFlightByIdResponseDto(FlightDto FlightDto);

View File

@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.Annotations;
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);

View File

@ -4,17 +4,17 @@ using System;
public class FlightReadModel
{
public Guid Id { get; init; }
public Guid FlightId { get; init; }
public string FlightNumber { get; init; }
public Guid AircraftId { get; init; }
public DateTime DepartureDate { get; init; }
public Guid DepartureAirportId { get; init; }
public DateTime ArriveDate { get; init; }
public Guid ArriveAirportId { get; init; }
public decimal DurationMinutes { get; init; }
public DateTime FlightDate { get; init; }
public Enums.FlightStatus Status { get; init; }
public decimal Price { get; init; }
public bool IsDeleted { get; init; }
public required Guid Id { get; init; }
public required Guid FlightId { get; init; }
public required string FlightNumber { get; init; }
public required Guid AircraftId { get; init; }
public required DateTime DepartureDate { get; init; }
public required Guid DepartureAirportId { get; init; }
public required DateTime ArriveDate { get; init; }
public required Guid ArriveAirportId { get; init; }
public required decimal DurationMinutes { get; init; }
public required DateTime FlightDate { get; init; }
public required Enums.FlightStatus Status { get; init; }
public required decimal Price { get; init; }
public required bool IsDeleted { get; init; }
}

View File

@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.Annotations;
public record CreateSeatRequestDto(string SeatNumber, Enums.SeatType Type, Enums.SeatClass Class, Guid FlightId);
public record CreateSeatResponseDto(Guid Id);

View File

@ -11,7 +11,6 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.Annotations;
public record GetAvailableSeatsResponseDto(IEnumerable<SeatDto> SeatDtos);

View File

@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.Annotations;
public record ReserveSeatRequestDto(Guid FlightId, string SeatNumber);
public record ReserveSeatResponseDto(Guid Id);

View File

@ -4,11 +4,11 @@ using System;
public class SeatReadModel
{
public Guid Id { get; init; }
public Guid SeatId { get; init; }
public string SeatNumber { get; init; }
public Enums.SeatType Type { get; init; }
public Enums.SeatClass Class { get; init; }
public Guid FlightId { get; init; }
public bool IsDeleted { get; init; }
public required Guid Id { get; init; }
public required Guid SeatId { get; init; }
public required string SeatNumber { get; init; }
public required Enums.SeatType Type { get; init; }
public required Enums.SeatClass Class { get; init; }
public required Guid FlightId { get; init; }
public required bool IsDeleted { get; init; }
}

View File

@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.Annotations;
public record RegisterNewUserRequestDto(string FirstName, string LastName, string Username, string Email,
string Password, string ConfirmPassword, string PassportNumber);

View File

@ -7,8 +7,8 @@ using BuildingBlocks.Core.Model;
public class User : IdentityUser<Guid>, IVersion
{
public string FirstName { get; init; }
public string LastName { get; init; }
public string PassPortNumber { get; init; }
public required string FirstName { get; init; }
public required string LastName { get; init; }
public required string PassPortNumber { get; init; }
public long Version { get; set; }
}

View File

@ -11,7 +11,9 @@ using Data;
using Dtos;
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();
}
@ -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 PassengerDbContext _passengerDbContext;
@ -44,7 +48,8 @@ internal class CompleteRegisterPassengerCommandHandler : ICommandHandler<Complet
_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));

View File

@ -7,7 +7,6 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
using Dtos;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.Annotations;
public record GetPassengerByIdResponseDto(PassengerDto PassengerDto);

View File

@ -2,11 +2,11 @@
public class PassengerReadModel
{
public Guid Id { get; init; }
public Guid PassengerId { get; init; }
public string PassportNumber { get; init; }
public string Name { get; init; }
public Enums.PassengerType PassengerType { get; init; }
public required Guid Id { get; init; }
public required Guid PassengerId { get; init; }
public required string PassportNumber { get; init; }
public required string Name { get; init; }
public required Enums.PassengerType PassengerType { get; init; }
public int Age { get; init; }
public bool IsDeleted { get; init; }
public required bool IsDeleted { get; init; }
}