mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-14 04:28:38 +08:00
Merge pull request #55 from meysamhadeli/develop
add versioning to feature folder structure
This commit is contained in:
commit
a552c33604
@ -6,18 +6,17 @@ using Microsoft.AspNetCore.Authentication;
|
||||
using Serilog;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
var env = builder.Environment;
|
||||
var appOptions = builder.Services.GetOptions<AppOptions>("AppOptions");
|
||||
Console.WriteLine(FiggleFonts.Standard.Render(appOptions.Name));
|
||||
|
||||
builder.AddCustomSerilog();
|
||||
builder.AddCustomSerilog(env);
|
||||
builder.Services.AddJwt();
|
||||
builder.Services.AddControllers();
|
||||
builder.Services.AddHttpContextAccessor();
|
||||
|
||||
builder.Services.AddReverseProxy().LoadFromConfig(builder.Configuration.GetSection("Yarp"));
|
||||
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.UseSerilogRequestLogging();
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using System.Text;
|
||||
using BuildingBlocks.Web;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
@ -12,7 +13,7 @@ namespace BuildingBlocks.Logging
|
||||
{
|
||||
public static class Extensions
|
||||
{
|
||||
public static WebApplicationBuilder AddCustomSerilog(this WebApplicationBuilder builder)
|
||||
public static WebApplicationBuilder AddCustomSerilog(this WebApplicationBuilder builder, IWebHostEnvironment env)
|
||||
{
|
||||
builder.Host.UseSerilog((context, services, loggerConfiguration) =>
|
||||
{
|
||||
@ -50,14 +51,16 @@ namespace BuildingBlocks.Logging
|
||||
|
||||
if (logOptions.File is { Enable: true })
|
||||
{
|
||||
var root = env.ContentRootPath;
|
||||
Directory.CreateDirectory(Path.Combine(root, "logs"));
|
||||
|
||||
var path = string.IsNullOrWhiteSpace(logOptions.File.Path) ? "logs/.txt" : logOptions.File.Path;
|
||||
if (!Enum.TryParse<RollingInterval>(logOptions.File.Interval, true, out var interval))
|
||||
{
|
||||
interval = RollingInterval.Day;
|
||||
}
|
||||
|
||||
loggerConfiguration.WriteTo.File(path, rollingInterval: interval, encoding: Encoding.UTF8,
|
||||
outputTemplate: logOptions.LogTemplate);
|
||||
loggerConfiguration.WriteTo.File(path, rollingInterval: interval, encoding: Encoding.UTF8, outputTemplate: logOptions.LogTemplate);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using Booking;
|
||||
using Booking.Configuration;
|
||||
using Booking.Data;
|
||||
using Booking.Extensions;
|
||||
using BuildingBlocks.EventStoreDB;
|
||||
@ -15,11 +14,9 @@ using BuildingBlocks.PersistMessageProcessor;
|
||||
using BuildingBlocks.Swagger;
|
||||
using BuildingBlocks.Web;
|
||||
using Figgle;
|
||||
using Flight;
|
||||
using FluentValidation;
|
||||
using Hellang.Middleware.ProblemDetails;
|
||||
using Microsoft.AspNetCore.Mvc.ApiExplorer;
|
||||
using Passenger;
|
||||
using Prometheus;
|
||||
using Serilog;
|
||||
|
||||
@ -34,7 +31,7 @@ Console.WriteLine(FiggleFonts.Standard.Render(appOptions.Name));
|
||||
builder.Services.AddPersistMessage(configuration);
|
||||
builder.Services.AddMongoDbContext<BookingReadDbContext>(configuration);
|
||||
|
||||
builder.AddCustomSerilog();
|
||||
builder.AddCustomSerilog(env);
|
||||
builder.Services.AddCore();
|
||||
builder.Services.AddJwt();
|
||||
builder.Services.AddControllers();
|
||||
@ -86,6 +83,9 @@ app.MapGet("/", x => x.Response.WriteAsync(appOptions.Name));
|
||||
|
||||
app.Run();
|
||||
|
||||
public partial class Program
|
||||
namespace Booking.Api
|
||||
{
|
||||
public partial class Program
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
using BuildingBlocks.Exception;
|
||||
|
||||
namespace Booking.Booking.Exceptions;
|
||||
|
||||
public class PassengerNotFoundException: NotFoundException
|
||||
{
|
||||
public PassengerNotFoundException() : base("Flight doesn't exist! ")
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,4 @@
|
||||
using Booking.Booking.Dtos;
|
||||
using Booking.Booking.Events.Domain;
|
||||
using Booking.Booking.Models.Reads;
|
||||
using BuildingBlocks.IdsGenerator;
|
||||
using Mapster;
|
||||
|
||||
@ -2,7 +2,7 @@ using BuildingBlocks.Core.CQRS;
|
||||
using BuildingBlocks.Core.Event;
|
||||
using BuildingBlocks.IdsGenerator;
|
||||
|
||||
namespace Booking.Booking.Features.CreateBooking;
|
||||
namespace Booking.Booking.Features.CreateBooking.Commands.V1;
|
||||
|
||||
public record CreateBookingCommand(long PassengerId, long FlightId, string Description) : ICommand<ulong>, IInternalCommand
|
||||
{
|
||||
@ -1,17 +1,14 @@
|
||||
using Ardalis.GuardClauses;
|
||||
using Booking.Booking.Exceptions;
|
||||
using Booking.Booking.Features.CreateBooking.Exceptions;
|
||||
using Booking.Booking.Models.ValueObjects;
|
||||
using Booking.Configuration;
|
||||
using BuildingBlocks.Core;
|
||||
using BuildingBlocks.Core.CQRS;
|
||||
using BuildingBlocks.EventStoreDB.Repository;
|
||||
using BuildingBlocks.Utils;
|
||||
using Flight;
|
||||
using Grpc.Net.Client;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Passenger;
|
||||
|
||||
namespace Booking.Booking.Features.CreateBooking;
|
||||
namespace Booking.Booking.Features.CreateBooking.Commands.V1;
|
||||
|
||||
public class CreateBookingCommandHandler : ICommandHandler<CreateBookingCommand, ulong>
|
||||
{
|
||||
@ -1,6 +1,6 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace Booking.Booking.Features.CreateBooking;
|
||||
namespace Booking.Booking.Features.CreateBooking.Commands.V1;
|
||||
|
||||
public class CreateBookingCommandValidator : AbstractValidator<CreateBookingCommand>
|
||||
{
|
||||
@ -1,10 +1,11 @@
|
||||
using Booking.Booking.Features.CreateBooking.Commands.V1;
|
||||
using BuildingBlocks.Web;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace Booking.Booking.Features.CreateBooking;
|
||||
namespace Booking.Booking.Features.CreateBooking.Endpoints.V1;
|
||||
|
||||
[Route(BaseApiPath + "/booking")]
|
||||
public class CreateBookingEndpoint : BaseController
|
||||
@ -2,6 +2,6 @@ using Booking.Booking.Models.ValueObjects;
|
||||
using BuildingBlocks.Core.Event;
|
||||
using BuildingBlocks.Core.Model;
|
||||
|
||||
namespace Booking.Booking.Events.Domain;
|
||||
namespace Booking.Booking.Features.CreateBooking.Events.Domain.V1;
|
||||
|
||||
public record BookingCreatedDomainEvent(long Id, PassengerInfo PassengerInfo, Trip Trip) : Audit, IDomainEvent;
|
||||
@ -1,6 +1,6 @@
|
||||
using BuildingBlocks.Exception;
|
||||
|
||||
namespace Booking.Booking.Exceptions;
|
||||
namespace Booking.Booking.Features.CreateBooking.Exceptions;
|
||||
|
||||
public class BookingAlreadyExistException : ConflictException
|
||||
{
|
||||
@ -1,6 +1,6 @@
|
||||
using BuildingBlocks.Exception;
|
||||
|
||||
namespace Booking.Booking.Exceptions;
|
||||
namespace Booking.Booking.Features.CreateBooking.Exceptions;
|
||||
|
||||
public class FlightNotFoundException : NotFoundException
|
||||
{
|
||||
@ -1,4 +1,4 @@
|
||||
using Booking.Booking.Events.Domain;
|
||||
using Booking.Booking.Features.CreateBooking.Events.Domain.V1;
|
||||
using Booking.Booking.Models.ValueObjects;
|
||||
using BuildingBlocks.EventStoreDB.Events;
|
||||
using BuildingBlocks.Utils;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using Booking.Booking.Events.Domain;
|
||||
using Booking.Booking.Features.CreateBooking.Events.Domain.V1;
|
||||
using Booking.Booking.Models.Reads;
|
||||
using Booking.Data;
|
||||
using BuildingBlocks.EventStoreDB.Events;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using Booking.Booking.Events.Domain;
|
||||
using Booking.Booking.Features.CreateBooking.Events.Domain.V1;
|
||||
using BuildingBlocks.Contracts.EventBus.Messages;
|
||||
using BuildingBlocks.Core;
|
||||
using BuildingBlocks.Core.Event;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Booking.Api;
|
||||
using Booking.Data;
|
||||
using BuildingBlocks.Contracts.EventBus.Messages;
|
||||
using BuildingBlocks.PersistMessageProcessor.Data;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using AutoBogus;
|
||||
using Booking.Booking.Features.CreateBooking;
|
||||
using Booking.Booking.Features.CreateBooking.Commands.V1;
|
||||
using BuildingBlocks.IdsGenerator;
|
||||
|
||||
namespace Integration.Test.Fakes;
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using BuildingBlocks.Caching;
|
||||
using BuildingBlocks.Core;
|
||||
using BuildingBlocks.EFCore;
|
||||
using BuildingBlocks.Exception;
|
||||
using BuildingBlocks.HealthCheck;
|
||||
@ -24,11 +22,9 @@ using Flight.GrpcServer.Services;
|
||||
using FluentValidation;
|
||||
using Hellang.Middleware.ProblemDetails;
|
||||
using Microsoft.AspNetCore.Mvc.ApiExplorer;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
using Prometheus;
|
||||
using Serilog;
|
||||
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
var configuration = builder.Configuration;
|
||||
var env = builder.Environment;
|
||||
@ -42,7 +38,7 @@ builder.Services.AddScoped<IDataSeeder, FlightDataSeeder>();
|
||||
builder.Services.AddMongoDbContext<FlightReadDbContext>(configuration);
|
||||
builder.Services.AddPersistMessage(configuration);
|
||||
|
||||
builder.AddCustomSerilog();
|
||||
builder.AddCustomSerilog(env);
|
||||
builder.Services.AddCore();
|
||||
builder.Services.AddJwt();
|
||||
builder.Services.AddControllers();
|
||||
@ -98,6 +94,9 @@ app.UseEndpoints(endpoints =>
|
||||
app.MapGet("/", x => x.Response.WriteAsync(appOptions.Name));
|
||||
app.Run();
|
||||
|
||||
public partial class Program
|
||||
namespace Flight.Api
|
||||
{
|
||||
public partial class Program
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
using BuildingBlocks.IdsGenerator;
|
||||
using Flight.Aircrafts.Features.CreateAircraft.Reads;
|
||||
using Flight.Aircrafts.Features.CreateAircraft.Commands.V1.Reads;
|
||||
using Flight.Aircrafts.Models;
|
||||
using Flight.Aircrafts.Models.Reads;
|
||||
using Mapster;
|
||||
|
||||
@ -2,9 +2,8 @@ using BuildingBlocks.Core.CQRS;
|
||||
using BuildingBlocks.Core.Event;
|
||||
using BuildingBlocks.IdsGenerator;
|
||||
using Flight.Aircrafts.Dtos;
|
||||
using MediatR;
|
||||
|
||||
namespace Flight.Aircrafts.Features.CreateAircraft;
|
||||
namespace Flight.Aircrafts.Features.CreateAircraft.Commands.V1;
|
||||
|
||||
public record CreateAircraftCommand(string Name, string Model, int ManufacturingYear) : ICommand<AircraftResponseDto>, IInternalCommand
|
||||
{
|
||||
@ -2,14 +2,14 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Ardalis.GuardClauses;
|
||||
using Flight.Aircrafts.Dtos;
|
||||
using Flight.Aircrafts.Exceptions;
|
||||
using Flight.Aircrafts.Features.CreateAircraft.Exceptions;
|
||||
using Flight.Aircrafts.Models;
|
||||
using Flight.Data;
|
||||
using MapsterMapper;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Flight.Aircrafts.Features.CreateAircraft;
|
||||
namespace Flight.Aircrafts.Features.CreateAircraft.Commands.V1;
|
||||
|
||||
public class CreateAircraftCommandHandler : IRequestHandler<CreateAircraftCommand, AircraftResponseDto>
|
||||
{
|
||||
@ -1,6 +1,6 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace Flight.Aircrafts.Features.CreateAircraft;
|
||||
namespace Flight.Aircrafts.Features.CreateAircraft.Commands.V1;
|
||||
|
||||
public class CreateAircraftCommandValidator : AbstractValidator<CreateAircraftCommand>
|
||||
{
|
||||
@ -1,6 +1,6 @@
|
||||
using BuildingBlocks.Core.Event;
|
||||
|
||||
namespace Flight.Aircrafts.Features.CreateAircraft.Reads;
|
||||
namespace Flight.Aircrafts.Features.CreateAircraft.Commands.V1.Reads;
|
||||
|
||||
public class CreateAircraftMongoCommand : InternalCommand
|
||||
{
|
||||
@ -2,7 +2,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using Ardalis.GuardClauses;
|
||||
using BuildingBlocks.Core.CQRS;
|
||||
using Flight.Aircrafts.Exceptions;
|
||||
using Flight.Aircrafts.Features.CreateAircraft.Exceptions;
|
||||
using Flight.Aircrafts.Models.Reads;
|
||||
using Flight.Data;
|
||||
using MapsterMapper;
|
||||
@ -10,7 +10,7 @@ using MediatR;
|
||||
using MongoDB.Driver;
|
||||
using MongoDB.Driver.Linq;
|
||||
|
||||
namespace Flight.Aircrafts.Features.CreateAircraft.Reads;
|
||||
namespace Flight.Aircrafts.Features.CreateAircraft.Commands.V1.Reads;
|
||||
|
||||
public class CreateAircraftMongoCommandHandler : ICommandHandler<CreateAircraftMongoCommand>
|
||||
{
|
||||
@ -1,11 +1,12 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BuildingBlocks.Web;
|
||||
using Flight.Aircrafts.Features.CreateAircraft.Commands.V1;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace Flight.Aircrafts.Features.CreateAircraft;
|
||||
namespace Flight.Aircrafts.Features.CreateAircraft.Endpoints.V1;
|
||||
|
||||
[Route(BaseApiPath + "/flight/aircraft")]
|
||||
public class CreateAircraftEndpoint : BaseController
|
||||
@ -1,5 +1,5 @@
|
||||
using BuildingBlocks.Core.Event;
|
||||
|
||||
namespace Flight.Aircrafts.Events;
|
||||
namespace Flight.Aircrafts.Features.CreateAircraft.Events.Domain.V1;
|
||||
|
||||
public record AircraftCreatedDomainEvent(long Id, string Name, string Model, int ManufacturingYear, bool IsDeleted) : IDomainEvent;
|
||||
@ -1,7 +1,7 @@
|
||||
using System.Net;
|
||||
using BuildingBlocks.Exception;
|
||||
|
||||
namespace Flight.Aircrafts.Exceptions;
|
||||
namespace Flight.Aircrafts.Features.CreateAircraft.Exceptions;
|
||||
|
||||
public class AircraftAlreadyExistException : AppException
|
||||
{
|
||||
@ -1,6 +1,6 @@
|
||||
using BuildingBlocks.Core.Model;
|
||||
using BuildingBlocks.IdsGenerator;
|
||||
using Flight.Aircrafts.Events;
|
||||
using Flight.Aircrafts.Features.CreateAircraft.Events.Domain.V1;
|
||||
|
||||
namespace Flight.Aircrafts.Models;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
using BuildingBlocks.IdsGenerator;
|
||||
using Flight.Airports.Features.CreateAirport.Reads;
|
||||
using Flight.Airports.Features.CreateAirport.Commands.V1.Reads;
|
||||
using Flight.Airports.Models;
|
||||
using Flight.Airports.Models.Reads;
|
||||
using Mapster;
|
||||
|
||||
@ -2,9 +2,8 @@ using BuildingBlocks.Core.CQRS;
|
||||
using BuildingBlocks.Core.Event;
|
||||
using BuildingBlocks.IdsGenerator;
|
||||
using Flight.Airports.Dtos;
|
||||
using MediatR;
|
||||
|
||||
namespace Flight.Airports.Features.CreateAirport;
|
||||
namespace Flight.Airports.Features.CreateAirport.Commands.V1;
|
||||
|
||||
public record CreateAirportCommand(string Name, string Address, string Code) : ICommand<AirportResponseDto>, IInternalCommand
|
||||
{
|
||||
@ -2,13 +2,13 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Ardalis.GuardClauses;
|
||||
using Flight.Airports.Dtos;
|
||||
using Flight.Airports.Exceptions;
|
||||
using Flight.Airports.Features.CreateAirport.Exceptions;
|
||||
using Flight.Data;
|
||||
using MapsterMapper;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Flight.Airports.Features.CreateAirport;
|
||||
namespace Flight.Airports.Features.CreateAirport.Commands.V1;
|
||||
|
||||
public class CreateAirportCommandHandler : IRequestHandler<CreateAirportCommand, AirportResponseDto>
|
||||
{
|
||||
@ -1,6 +1,6 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace Flight.Airports.Features.CreateAirport;
|
||||
namespace Flight.Airports.Features.CreateAirport.Commands.V1;
|
||||
|
||||
public class CreateAirportCommandValidator : AbstractValidator<CreateAirportCommand>
|
||||
{
|
||||
@ -1,6 +1,6 @@
|
||||
using BuildingBlocks.Core.Event;
|
||||
|
||||
namespace Flight.Airports.Features.CreateAirport.Reads;
|
||||
namespace Flight.Airports.Features.CreateAirport.Commands.V1.Reads;
|
||||
|
||||
public class CreateAirportMongoCommand : InternalCommand
|
||||
{
|
||||
@ -2,7 +2,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using Ardalis.GuardClauses;
|
||||
using BuildingBlocks.Core.CQRS;
|
||||
using Flight.Airports.Exceptions;
|
||||
using Flight.Airports.Features.CreateAirport.Exceptions;
|
||||
using Flight.Airports.Models.Reads;
|
||||
using Flight.Data;
|
||||
using MapsterMapper;
|
||||
@ -10,7 +10,7 @@ using MediatR;
|
||||
using MongoDB.Driver;
|
||||
using MongoDB.Driver.Linq;
|
||||
|
||||
namespace Flight.Airports.Features.CreateAirport.Reads;
|
||||
namespace Flight.Airports.Features.CreateAirport.Commands.V1.Reads;
|
||||
|
||||
public class CreateAirportMongoCommandHandler : ICommandHandler<CreateAirportMongoCommand>
|
||||
{
|
||||
@ -1,11 +1,12 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BuildingBlocks.Web;
|
||||
using Flight.Airports.Features.CreateAirport.Commands.V1;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace Flight.Airports.Features.CreateAirport;
|
||||
namespace Flight.Airports.Features.CreateAirport.Endpoints.V1;
|
||||
|
||||
[Route(BaseApiPath + "/flight/airport")]
|
||||
public class CreateAirportEndpoint : BaseController
|
||||
@ -1,5 +1,5 @@
|
||||
using BuildingBlocks.Core.Event;
|
||||
|
||||
namespace Flight.Airports.Events;
|
||||
namespace Flight.Airports.Features.CreateAirport.Events.Domain.V1;
|
||||
|
||||
public record AirportCreatedDomainEvent(long Id, string Name, string Address, string Code, bool IsDeleted) : IDomainEvent;
|
||||
@ -1,6 +1,6 @@
|
||||
using BuildingBlocks.Exception;
|
||||
|
||||
namespace Flight.Airports.Exceptions;
|
||||
namespace Flight.Airports.Features.CreateAirport.Exceptions;
|
||||
|
||||
public class AirportAlreadyExistException : ConflictException
|
||||
{
|
||||
@ -1,6 +1,6 @@
|
||||
using BuildingBlocks.Core.Model;
|
||||
using BuildingBlocks.IdsGenerator;
|
||||
using Flight.Airports.Events;
|
||||
using Flight.Airports.Features.CreateAirport.Events.Domain.V1;
|
||||
|
||||
namespace Flight.Airports.Models;
|
||||
|
||||
|
||||
@ -1,17 +1,20 @@
|
||||
using BuildingBlocks.Contracts.EventBus.Messages;
|
||||
using BuildingBlocks.Core;
|
||||
using BuildingBlocks.Core.Event;
|
||||
using Flight.Aircrafts.Events;
|
||||
using Flight.Aircrafts.Features.CreateAircraft.Reads;
|
||||
using Flight.Airports.Events;
|
||||
using Flight.Airports.Features.CreateAirport.Reads;
|
||||
using Flight.Flights.Events.Domain;
|
||||
using Flight.Flights.Features.CreateFlight.Reads;
|
||||
using Flight.Flights.Features.DeleteFlight.Reads;
|
||||
using Flight.Flights.Features.UpdateFlight.Reads;
|
||||
using Flight.Seats.Events;
|
||||
using Flight.Seats.Features.CreateSeat.Reads;
|
||||
using Flight.Seats.Features.ReserveSeat.Reads;
|
||||
using Flight.Aircrafts.Features.CreateAircraft.Commands.V1.Reads;
|
||||
using Flight.Aircrafts.Features.CreateAircraft.Events.Domain.V1;
|
||||
using Flight.Airports.Features.CreateAirport.Commands.V1.Reads;
|
||||
using Flight.Airports.Features.CreateAirport.Events.Domain.V1;
|
||||
using Flight.Flights.Features.CreateFlight.Commands.V1.Reads;
|
||||
using Flight.Flights.Features.CreateFlight.Events.Domain.V1;
|
||||
using Flight.Flights.Features.DeleteFlight.Commands.V1.Reads;
|
||||
using Flight.Flights.Features.DeleteFlight.Events.Domain.V1;
|
||||
using Flight.Flights.Features.UpdateFlight.Commands.V1.Reads;
|
||||
using Flight.Flights.Features.UpdateFlight.Events.V1;
|
||||
using Flight.Seats.Features.CreateSeat.Commands.V1.Reads;
|
||||
using Flight.Seats.Features.CreateSeat.Events.Domain.V1;
|
||||
using Flight.Seats.Features.ReserveSeat.Commands.V1.Reads;
|
||||
using Flight.Seats.Features.ReserveSeat.Events.Domain.V1;
|
||||
|
||||
namespace Flight;
|
||||
|
||||
|
||||
@ -18,9 +18,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Aircrafts\Exceptions" />
|
||||
<Folder Include="Airports\Exceptions" />
|
||||
<Folder Include="Data\Migrations" />
|
||||
<Folder Include="Seats\Features\CreateSeat\Events\Domain" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@ -3,9 +3,8 @@ using BuildingBlocks.Core.CQRS;
|
||||
using BuildingBlocks.Core.Event;
|
||||
using BuildingBlocks.IdsGenerator;
|
||||
using Flight.Flights.Dtos;
|
||||
using Flight.Flights.Models;
|
||||
|
||||
namespace Flight.Flights.Features.CreateFlight;
|
||||
namespace Flight.Flights.Features.CreateFlight.Commands.V1;
|
||||
|
||||
public record CreateFlightCommand(string FlightNumber, long AircraftId, long DepartureAirportId,
|
||||
DateTime DepartureDate, DateTime ArriveDate, long ArriveAirportId,
|
||||
@ -5,10 +5,11 @@ using BuildingBlocks.Core.CQRS;
|
||||
using Flight.Data;
|
||||
using Flight.Flights.Dtos;
|
||||
using Flight.Flights.Exceptions;
|
||||
using Flight.Flights.Features.CreateFlight.Exceptions;
|
||||
using MapsterMapper;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Flight.Flights.Features.CreateFlight;
|
||||
namespace Flight.Flights.Features.CreateFlight.Commands.V1;
|
||||
|
||||
public class CreateFlightCommandHandler : ICommandHandler<CreateFlightCommand, FlightResponseDto>
|
||||
{
|
||||
@ -1,7 +1,6 @@
|
||||
using Flight.Flights.Models;
|
||||
using FluentValidation;
|
||||
|
||||
namespace Flight.Flights.Features.CreateFlight;
|
||||
namespace Flight.Flights.Features.CreateFlight.Commands.V1;
|
||||
|
||||
public class CreateFlightCommandValidator : AbstractValidator<CreateFlightCommand>
|
||||
{
|
||||
@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using BuildingBlocks.Core.Event;
|
||||
using Flight.Flights.Models;
|
||||
|
||||
namespace Flight.Flights.Features.CreateFlight.Reads;
|
||||
namespace Flight.Flights.Features.CreateFlight.Commands.V1.Reads;
|
||||
|
||||
public class CreateFlightMongoCommand : InternalCommand
|
||||
{
|
||||
@ -4,13 +4,14 @@ using Ardalis.GuardClauses;
|
||||
using BuildingBlocks.Core.CQRS;
|
||||
using Flight.Data;
|
||||
using Flight.Flights.Exceptions;
|
||||
using Flight.Flights.Features.CreateFlight.Exceptions;
|
||||
using Flight.Flights.Models.Reads;
|
||||
using MapsterMapper;
|
||||
using MediatR;
|
||||
using MongoDB.Driver;
|
||||
using MongoDB.Driver.Linq;
|
||||
|
||||
namespace Flight.Flights.Features.CreateFlight.Reads;
|
||||
namespace Flight.Flights.Features.CreateFlight.Commands.V1.Reads;
|
||||
|
||||
public class CreateFlightMongoCommandHandler : ICommandHandler<CreateFlightMongoCommand>
|
||||
{
|
||||
@ -1,12 +1,13 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BuildingBlocks.Web;
|
||||
using Flight.Flights.Features.CreateFlight.Commands.V1;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace Flight.Flights.Features.CreateFlight;
|
||||
namespace Flight.Flights.Features.CreateFlight.Endpoints.V1;
|
||||
|
||||
[Route(BaseApiPath + "/flight")]
|
||||
public class CreateFlightEndpoint : BaseController
|
||||
@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using BuildingBlocks.Core.Event;
|
||||
using Flight.Flights.Models;
|
||||
|
||||
namespace Flight.Flights.Events.Domain;
|
||||
namespace Flight.Flights.Features.CreateFlight.Events.Domain.V1;
|
||||
|
||||
public record FlightCreatedDomainEvent(long Id, string FlightNumber, long AircraftId, DateTime DepartureDate,
|
||||
long DepartureAirportId, DateTime ArriveDate, long ArriveAirportId, decimal DurationMinutes,
|
||||
@ -1,6 +1,6 @@
|
||||
using BuildingBlocks.Exception;
|
||||
|
||||
namespace Flight.Flights.Exceptions;
|
||||
namespace Flight.Flights.Features.CreateFlight.Exceptions;
|
||||
|
||||
public class FlightAlreadyExistException : ConflictException
|
||||
{
|
||||
@ -2,6 +2,6 @@
|
||||
using BuildingBlocks.Core.Event;
|
||||
using Flight.Flights.Dtos;
|
||||
|
||||
namespace Flight.Flights.Features.DeleteFlight;
|
||||
namespace Flight.Flights.Features.DeleteFlight.Commands.V1;
|
||||
|
||||
public record DeleteFlightCommand(long Id) : ICommand<FlightResponseDto>, IInternalCommand;
|
||||
@ -5,12 +5,10 @@ using BuildingBlocks.Core.CQRS;
|
||||
using Flight.Data;
|
||||
using Flight.Flights.Dtos;
|
||||
using Flight.Flights.Exceptions;
|
||||
using Flight.Flights.Models;
|
||||
using MapsterMapper;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Flight.Flights.Features.DeleteFlight;
|
||||
namespace Flight.Flights.Features.DeleteFlight.Commands.V1;
|
||||
|
||||
public class DeleteFlightCommandHandler : ICommandHandler<DeleteFlightCommand, FlightResponseDto>
|
||||
{
|
||||
@ -1,6 +1,6 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace Flight.Flights.Features.DeleteFlight;
|
||||
namespace Flight.Flights.Features.DeleteFlight.Commands.V1;
|
||||
|
||||
public class DeleteFlightCommandValidator : AbstractValidator<DeleteFlightCommand>
|
||||
{
|
||||
@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using BuildingBlocks.Core.Event;
|
||||
using Flight.Flights.Models;
|
||||
|
||||
namespace Flight.Flights.Features.DeleteFlight.Reads;
|
||||
namespace Flight.Flights.Features.DeleteFlight.Commands.V1.Reads;
|
||||
|
||||
public class DeleteFlightMongoCommand : InternalCommand
|
||||
{
|
||||
@ -10,7 +10,7 @@ using MediatR;
|
||||
using MongoDB.Driver;
|
||||
using MongoDB.Driver.Linq;
|
||||
|
||||
namespace Flight.Flights.Features.DeleteFlight.Reads;
|
||||
namespace Flight.Flights.Features.DeleteFlight.Commands.V1.Reads;
|
||||
|
||||
public class DeleteFlightMongoCommandHandler : ICommandHandler<DeleteFlightMongoCommand>
|
||||
{
|
||||
@ -1,12 +1,13 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BuildingBlocks.Web;
|
||||
using Flight.Flights.Features.DeleteFlight.Commands.V1;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace Flight.Flights.Features.DeleteFlight;
|
||||
namespace Flight.Flights.Features.DeleteFlight.Endpoints.V1;
|
||||
|
||||
[Route(BaseApiPath + "/flight")]
|
||||
public class DeleteFlightEndpoint : BaseController
|
||||
@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using BuildingBlocks.Core.Event;
|
||||
using Flight.Flights.Models;
|
||||
|
||||
namespace Flight.Flights.Events.Domain;
|
||||
namespace Flight.Flights.Features.DeleteFlight.Events.Domain.V1;
|
||||
|
||||
public record FlightDeletedDomainEvent(long Id, string FlightNumber, long AircraftId, DateTime DepartureDate,
|
||||
long DepartureAirportId, DateTime ArriveDate, long ArriveAirportId, decimal DurationMinutes,
|
||||
@ -1,9 +1,9 @@
|
||||
using AutoMapper;
|
||||
using BuildingBlocks.IdsGenerator;
|
||||
using Flight.Flights.Dtos;
|
||||
using Flight.Flights.Features.CreateFlight.Reads;
|
||||
using Flight.Flights.Features.DeleteFlight.Reads;
|
||||
using Flight.Flights.Features.UpdateFlight.Reads;
|
||||
using Flight.Flights.Features.CreateFlight.Commands.V1.Reads;
|
||||
using Flight.Flights.Features.DeleteFlight.Commands.V1.Reads;
|
||||
using Flight.Flights.Features.UpdateFlight.Commands.V1.Reads;
|
||||
using Flight.Flights.Models.Reads;
|
||||
using Mapster;
|
||||
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BuildingBlocks.Web;
|
||||
using Flight.Flights.Features.GetAvailableFlights.Queries.V1;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace Flight.Flights.Features.GetAvailableFlights;
|
||||
namespace Flight.Flights.Features.GetAvailableFlights.Endpoints.V1;
|
||||
|
||||
[Route(BaseApiPath + "/flight/get-available-flights")]
|
||||
public class GetAvailableFlightsEndpoint : BaseController
|
||||
@ -3,9 +3,8 @@ using System.Collections.Generic;
|
||||
using BuildingBlocks.Caching;
|
||||
using BuildingBlocks.Core.CQRS;
|
||||
using Flight.Flights.Dtos;
|
||||
using MediatR;
|
||||
|
||||
namespace Flight.Flights.Features.GetAvailableFlights;
|
||||
namespace Flight.Flights.Features.GetAvailableFlights.Queries.V1;
|
||||
|
||||
public record GetAvailableFlightsQuery : IQuery<IEnumerable<FlightResponseDto>>, ICacheRequest
|
||||
{
|
||||
@ -10,7 +10,7 @@ using Flight.Flights.Exceptions;
|
||||
using MapsterMapper;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace Flight.Flights.Features.GetAvailableFlights;
|
||||
namespace Flight.Flights.Features.GetAvailableFlights.Queries.V1;
|
||||
|
||||
public class GetAvailableFlightsQueryHandler : IQueryHandler<GetAvailableFlightsQuery, IEnumerable<FlightResponseDto>>
|
||||
{
|
||||
@ -1,6 +1,6 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace Flight.Flights.Features.GetAvailableFlights;
|
||||
namespace Flight.Flights.Features.GetAvailableFlights.Queries.V1;
|
||||
|
||||
public class GetAvailableFlightsQueryValidator : AbstractValidator<GetAvailableFlightsQuery>
|
||||
{
|
||||
@ -1,13 +1,13 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BuildingBlocks.Web;
|
||||
using Flight.Flights.Features.GetFlightById.Queries.V1;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace Flight.Flights.Features.GetFlightById;
|
||||
namespace Flight.Flights.Features.GetFlightById.Endpoints.V1;
|
||||
|
||||
[Route(BaseApiPath + "/flight")]
|
||||
public class GetFlightByIdEndpoint : BaseController
|
||||
@ -1,6 +1,6 @@
|
||||
using BuildingBlocks.Core.CQRS;
|
||||
using Flight.Flights.Dtos;
|
||||
|
||||
namespace Flight.Flights.Features.GetFlightById;
|
||||
namespace Flight.Flights.Features.GetFlightById.Queries.V1;
|
||||
|
||||
public record GetFlightByIdQuery(long Id) : IQuery<FlightResponseDto>;
|
||||
@ -9,7 +9,7 @@ using MapsterMapper;
|
||||
using MongoDB.Driver;
|
||||
using MongoDB.Driver.Linq;
|
||||
|
||||
namespace Flight.Flights.Features.GetFlightById;
|
||||
namespace Flight.Flights.Features.GetFlightById.Queries.V1;
|
||||
|
||||
public class GetFlightByIdQueryHandler : IQueryHandler<GetFlightByIdQuery, FlightResponseDto>
|
||||
{
|
||||
@ -1,6 +1,6 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace Flight.Flights.Features.GetFlightById;
|
||||
namespace Flight.Flights.Features.GetFlightById.Queries.V1;
|
||||
|
||||
public class GetFlightByIdQueryValidator : AbstractValidator<GetFlightByIdQuery>
|
||||
{
|
||||
@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using BuildingBlocks.Core.Event;
|
||||
using Flight.Flights.Models;
|
||||
|
||||
namespace Flight.Flights.Features.UpdateFlight.Reads;
|
||||
namespace Flight.Flights.Features.UpdateFlight.Commands.V1.Reads;
|
||||
|
||||
public class UpdateFlightMongoCommand : InternalCommand
|
||||
{
|
||||
@ -10,7 +10,7 @@ using MediatR;
|
||||
using MongoDB.Driver;
|
||||
using MongoDB.Driver.Linq;
|
||||
|
||||
namespace Flight.Flights.Features.UpdateFlight.Reads;
|
||||
namespace Flight.Flights.Features.UpdateFlight.Commands.V1.Reads;
|
||||
|
||||
public class UpdateFlightMongoCommandHandler : ICommandHandler<UpdateFlightMongoCommand>
|
||||
{
|
||||
@ -3,10 +3,8 @@ using BuildingBlocks.Caching;
|
||||
using BuildingBlocks.Core.CQRS;
|
||||
using BuildingBlocks.Core.Event;
|
||||
using Flight.Flights.Dtos;
|
||||
using Flight.Flights.Models;
|
||||
using MediatR;
|
||||
|
||||
namespace Flight.Flights.Features.UpdateFlight;
|
||||
namespace Flight.Flights.Features.UpdateFlight.Commands.V1;
|
||||
|
||||
public record UpdateFlightCommand : ICommand<FlightResponseDto>, IInvalidateCacheRequest, IInternalCommand
|
||||
{
|
||||
@ -2,16 +2,13 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Ardalis.GuardClauses;
|
||||
using BuildingBlocks.Core.CQRS;
|
||||
using BuildingBlocks.EventStoreDB.Repository;
|
||||
using Flight.Data;
|
||||
using Flight.Flights.Dtos;
|
||||
using Flight.Flights.Exceptions;
|
||||
using Flight.Flights.Models;
|
||||
using MapsterMapper;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Flight.Flights.Features.UpdateFlight;
|
||||
namespace Flight.Flights.Features.UpdateFlight.Commands.V1;
|
||||
|
||||
public class UpdateFlightCommandHandler : ICommandHandler<UpdateFlightCommand, FlightResponseDto>
|
||||
{
|
||||
@ -1,8 +1,7 @@
|
||||
using Flight.Flights.Features.CreateFlight;
|
||||
using Flight.Flights.Models;
|
||||
using Flight.Flights.Features.CreateFlight.Commands.V1;
|
||||
using FluentValidation;
|
||||
|
||||
namespace Flight.Flights.Features.UpdateFlight;
|
||||
namespace Flight.Flights.Features.UpdateFlight.Commands.V1;
|
||||
|
||||
public class UpdateFlightCommandValidator : AbstractValidator<CreateFlightCommand>
|
||||
{
|
||||
@ -1,12 +1,13 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BuildingBlocks.Web;
|
||||
using Flight.Flights.Features.UpdateFlight.Commands.V1;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace Flight.Flights.Features.UpdateFlight;
|
||||
namespace Flight.Flights.Features.UpdateFlight.Endpoints.V1;
|
||||
|
||||
[Route(BaseApiPath + "/flight")]
|
||||
public class UpdateFlightEndpoint : BaseController
|
||||
@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using BuildingBlocks.Core.Event;
|
||||
using Flight.Flights.Models;
|
||||
|
||||
namespace Flight.Flights.Events.Domain;
|
||||
namespace Flight.Flights.Features.UpdateFlight.Events.V1;
|
||||
public record FlightUpdatedDomainEvent(long Id, string FlightNumber, long AircraftId, DateTime DepartureDate,
|
||||
long DepartureAirportId, DateTime ArriveDate, long ArriveAirportId, decimal DurationMinutes,
|
||||
DateTime FlightDate, Enums.FlightStatus Status, decimal Price, bool IsDeleted) : IDomainEvent;
|
||||
@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using BuildingBlocks.Core.Model;
|
||||
using Flight.Flights.Events.Domain;
|
||||
using Flight.Flights.Features.CreateFlight.Events.Domain.V1;
|
||||
using Flight.Flights.Features.DeleteFlight.Events.Domain.V1;
|
||||
using Flight.Flights.Features.UpdateFlight.Events.V1;
|
||||
|
||||
namespace Flight.Flights.Models;
|
||||
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
using System.Threading.Tasks;
|
||||
using Flight.Flights.Features.GetFlightById;
|
||||
using Flight.Flights.Features.GetFlightById.Queries.V1;
|
||||
using Flight.Seats.Features.GetAvailableSeats;
|
||||
using Flight.Seats.Features.GetAvailableSeats.Queries.V1;
|
||||
using Flight.Seats.Features.ReserveSeat;
|
||||
using Flight.Seats.Features.ReserveSeat.Commands.V1;
|
||||
using Grpc.Core;
|
||||
using Mapster;
|
||||
using MediatR;
|
||||
|
||||
@ -6,7 +6,7 @@ using MassTransit;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Flight.Identity.Consumers.RegisterNewUser;
|
||||
namespace Flight.Identity.Consumers.RegisterNewUser.Consumes.V1;
|
||||
|
||||
public class RegisterNewUserConsumerHandler : IConsumer<UserCreated>
|
||||
{
|
||||
@ -1,10 +0,0 @@
|
||||
using BuildingBlocks.Exception;
|
||||
|
||||
namespace Flight.Seats.Exceptions;
|
||||
|
||||
public class SeatAlreadyChosenException : ConflictException
|
||||
{
|
||||
public SeatAlreadyChosenException(int? code = default) : base("Seat already chosen!", code)
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -2,9 +2,8 @@ using BuildingBlocks.Core.CQRS;
|
||||
using BuildingBlocks.Core.Event;
|
||||
using BuildingBlocks.IdsGenerator;
|
||||
using Flight.Seats.Dtos;
|
||||
using Flight.Seats.Models;
|
||||
|
||||
namespace Flight.Seats.Features.CreateSeat;
|
||||
namespace Flight.Seats.Features.CreateSeat.Commands.V1;
|
||||
|
||||
public record CreateSeatCommand(string SeatNumber, Enums.SeatType Type, Enums.SeatClass Class, long FlightId) : ICommand<SeatResponseDto>, IInternalCommand
|
||||
{
|
||||
@ -1,20 +1,15 @@
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Ardalis.GuardClauses;
|
||||
using BuildingBlocks.EventStoreDB.Repository;
|
||||
using Flight.Airports.Exceptions;
|
||||
using Flight.Airports.Features.CreateAirport;
|
||||
using Flight.Airports.Models;
|
||||
using Flight.Data;
|
||||
using Flight.Seats.Dtos;
|
||||
using Flight.Seats.Exceptions;
|
||||
using Flight.Seats.Features.CreateSeat.Exceptions;
|
||||
using Flight.Seats.Models;
|
||||
using MapsterMapper;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Flight.Seats.Features.CreateSeat;
|
||||
namespace Flight.Seats.Features.CreateSeat.Commands.V1;
|
||||
|
||||
public class CreateSeatCommandHandler : IRequestHandler<CreateSeatCommand, SeatResponseDto>
|
||||
{
|
||||
@ -1,8 +1,6 @@
|
||||
using Flight.Airports.Features.CreateAirport;
|
||||
using Flight.Seats.Models;
|
||||
using FluentValidation;
|
||||
|
||||
namespace Flight.Seats.Features.CreateSeat;
|
||||
namespace Flight.Seats.Features.CreateSeat.Commands.V1;
|
||||
|
||||
public class CreateSeatCommandValidator : AbstractValidator<CreateSeatCommand>
|
||||
{
|
||||
@ -1,7 +1,6 @@
|
||||
using BuildingBlocks.Core.Event;
|
||||
using Flight.Seats.Models;
|
||||
|
||||
namespace Flight.Seats.Features.CreateSeat.Reads;
|
||||
namespace Flight.Seats.Features.CreateSeat.Commands.V1.Reads;
|
||||
|
||||
public class CreateSeatMongoCommand : InternalCommand
|
||||
{
|
||||
@ -3,14 +3,14 @@ using System.Threading.Tasks;
|
||||
using Ardalis.GuardClauses;
|
||||
using BuildingBlocks.Core.CQRS;
|
||||
using Flight.Data;
|
||||
using Flight.Seats.Exceptions;
|
||||
using Flight.Seats.Features.CreateSeat.Exceptions;
|
||||
using Flight.Seats.Models.Reads;
|
||||
using MapsterMapper;
|
||||
using MediatR;
|
||||
using MongoDB.Driver;
|
||||
using MongoDB.Driver.Linq;
|
||||
|
||||
namespace Flight.Seats.Features.CreateSeat.Reads;
|
||||
namespace Flight.Seats.Features.CreateSeat.Commands.V1.Reads;
|
||||
|
||||
public class CreateSeatMongoCommandHandler : ICommandHandler<CreateSeatMongoCommand>
|
||||
{
|
||||
@ -1,12 +1,12 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BuildingBlocks.Web;
|
||||
using Flight.Airports.Features.CreateAirport;
|
||||
using Flight.Seats.Features.CreateSeat.Commands.V1;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace Flight.Seats.Features.CreateSeat;
|
||||
namespace Flight.Seats.Features.CreateSeat.Endpoints.V1;
|
||||
|
||||
[Route(BaseApiPath + "/flight/seat")]
|
||||
public class CreateSeatEndpoint : BaseController
|
||||
@ -1,6 +1,5 @@
|
||||
using BuildingBlocks.Core.Event;
|
||||
using Flight.Seats.Models;
|
||||
|
||||
namespace Flight.Seats.Events;
|
||||
namespace Flight.Seats.Features.CreateSeat.Events.Domain.V1;
|
||||
|
||||
public record SeatCreatedDomainEvent(long Id, string SeatNumber, Enums.SeatType Type, Enums.SeatClass Class, long FlightId, bool IsDeleted) : IDomainEvent;
|
||||
@ -1,6 +1,6 @@
|
||||
using BuildingBlocks.Exception;
|
||||
|
||||
namespace Flight.Seats.Exceptions;
|
||||
namespace Flight.Seats.Features.CreateSeat.Exceptions;
|
||||
|
||||
public class SeatAlreadyExistException : ConflictException
|
||||
{
|
||||
@ -1,12 +1,13 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BuildingBlocks.Web;
|
||||
using Flight.Seats.Features.GetAvailableSeats.Queries.V1;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace Flight.Seats.Features.GetAvailableSeats;
|
||||
namespace Flight.Seats.Features.GetAvailableSeats.Endpoints.V1;
|
||||
|
||||
[Route(BaseApiPath + "/flight/get-available-seats")]
|
||||
public class GetAvailableSeatsEndpoint : BaseController
|
||||
@ -1,6 +1,6 @@
|
||||
using BuildingBlocks.Exception;
|
||||
|
||||
namespace Flight.Seats.Exceptions;
|
||||
namespace Flight.Seats.Features.GetAvailableSeats.Exceptions;
|
||||
|
||||
public class AllSeatsFullException : BadRequestException
|
||||
{
|
||||
@ -1,8 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using BuildingBlocks.Core.CQRS;
|
||||
using Flight.Seats.Dtos;
|
||||
using MediatR;
|
||||
|
||||
namespace Flight.Seats.Features.GetAvailableSeats;
|
||||
namespace Flight.Seats.Features.GetAvailableSeats.Queries.V1;
|
||||
|
||||
public record GetAvailableSeatsQuery(long FlightId) : IQuery<IEnumerable<SeatResponseDto>>;
|
||||
@ -5,12 +5,12 @@ using System.Threading.Tasks;
|
||||
using Ardalis.GuardClauses;
|
||||
using Flight.Data;
|
||||
using Flight.Seats.Dtos;
|
||||
using Flight.Seats.Exceptions;
|
||||
using Flight.Seats.Features.GetAvailableSeats.Exceptions;
|
||||
using MapsterMapper;
|
||||
using MediatR;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace Flight.Seats.Features.GetAvailableSeats;
|
||||
namespace Flight.Seats.Features.GetAvailableSeats.Queries.V1;
|
||||
|
||||
public class GetAvailableSeatsQueryHandler : IRequestHandler<GetAvailableSeatsQuery, IEnumerable<SeatResponseDto>>
|
||||
{
|
||||
@ -1,6 +1,6 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace Flight.Seats.Features.GetAvailableSeats;
|
||||
namespace Flight.Seats.Features.GetAvailableSeats.Queries.V1;
|
||||
|
||||
public class GetAvailableSeatsQueryValidator : AbstractValidator<GetAvailableSeatsQuery>
|
||||
{
|
||||
@ -1,7 +1,6 @@
|
||||
using BuildingBlocks.Core.Event;
|
||||
using Flight.Seats.Models;
|
||||
|
||||
namespace Flight.Seats.Features.ReserveSeat.Reads;
|
||||
namespace Flight.Seats.Features.ReserveSeat.Commands.V1.Reads;
|
||||
|
||||
public class ReserveSeatMongoCommand : InternalCommand
|
||||
{
|
||||
@ -8,7 +8,7 @@ using MapsterMapper;
|
||||
using MediatR;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace Flight.Seats.Features.ReserveSeat.Reads;
|
||||
namespace Flight.Seats.Features.ReserveSeat.Commands.V1.Reads;
|
||||
|
||||
public class ReserveSeatMongoCommandHandler : ICommandHandler<ReserveSeatMongoCommand>
|
||||
{
|
||||
@ -2,6 +2,6 @@ using BuildingBlocks.Core.CQRS;
|
||||
using BuildingBlocks.Core.Event;
|
||||
using Flight.Seats.Dtos;
|
||||
|
||||
namespace Flight.Seats.Features.ReserveSeat;
|
||||
namespace Flight.Seats.Features.ReserveSeat.Commands.V1;
|
||||
|
||||
public record ReserveSeatCommand(long FlightId, string SeatNumber) : ICommand<SeatResponseDto>, IInternalCommand;
|
||||
@ -3,12 +3,12 @@ using System.Threading.Tasks;
|
||||
using Ardalis.GuardClauses;
|
||||
using Flight.Data;
|
||||
using Flight.Seats.Dtos;
|
||||
using Flight.Seats.Exceptions;
|
||||
using Flight.Seats.Features.ReserveSeat.Exceptions;
|
||||
using MapsterMapper;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Flight.Seats.Features.ReserveSeat;
|
||||
namespace Flight.Seats.Features.ReserveSeat.Commands.V1;
|
||||
|
||||
public class ReserveSeatCommandHandler : IRequestHandler<ReserveSeatCommand, SeatResponseDto>
|
||||
{
|
||||
@ -1,6 +1,6 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace Flight.Seats.Features.ReserveSeat;
|
||||
namespace Flight.Seats.Features.ReserveSeat.Commands.V1;
|
||||
|
||||
public class ReserveSeatCommandValidator : AbstractValidator<ReserveSeatCommand>
|
||||
{
|
||||
@ -1,12 +1,13 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BuildingBlocks.Web;
|
||||
using Flight.Seats.Features.ReserveSeat.Commands.V1;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace Flight.Seats.Features.ReserveSeat;
|
||||
namespace Flight.Seats.Features.ReserveSeat.Endpoints.V1;
|
||||
|
||||
[Route(BaseApiPath + "/flight/reserve-seat")]
|
||||
public class ReserveSeatEndpoint : BaseController
|
||||
@ -1,6 +1,5 @@
|
||||
using BuildingBlocks.Core.Event;
|
||||
using Flight.Seats.Models;
|
||||
|
||||
namespace Flight.Seats.Events;
|
||||
namespace Flight.Seats.Features.ReserveSeat.Events.Domain.V1;
|
||||
|
||||
public record SeatReservedDomainEvent(long Id, string SeatNumber, Enums.SeatType Type, Enums.SeatClass Class, long FlightId, bool IsDeleted) : IDomainEvent;
|
||||
@ -1,6 +1,6 @@
|
||||
using BuildingBlocks.Exception;
|
||||
|
||||
namespace Flight.Seats.Exceptions;
|
||||
namespace Flight.Seats.Features.ReserveSeat.Exceptions;
|
||||
|
||||
public class SeatNumberIncorrectException : BadRequestException
|
||||
{
|
||||
@ -1,7 +1,7 @@
|
||||
using BuildingBlocks.IdsGenerator;
|
||||
using Flight.Seats.Dtos;
|
||||
using Flight.Seats.Features.CreateSeat.Reads;
|
||||
using Flight.Seats.Features.ReserveSeat.Reads;
|
||||
using Flight.Seats.Features.CreateSeat.Commands.V1.Reads;
|
||||
using Flight.Seats.Features.ReserveSeat.Commands.V1.Reads;
|
||||
using Flight.Seats.Models;
|
||||
using Flight.Seats.Models.Reads;
|
||||
using Mapster;
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using BuildingBlocks.Core.Model;
|
||||
using Flight.Seats.Events;
|
||||
using Flight.Seats.Features.CreateSeat.Events.Domain.V1;
|
||||
using Flight.Seats.Features.ReserveSeat.Events.Domain.V1;
|
||||
|
||||
namespace Flight.Seats.Models;
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
using System.Threading.Tasks;
|
||||
using BuildingBlocks.Contracts.EventBus.Messages;
|
||||
using BuildingBlocks.TestBase;
|
||||
using Flight.Aircrafts.Features.CreateAircraft.Reads;
|
||||
using Flight.Airports.Features.CreateAirport.Reads;
|
||||
using Flight.Aircrafts.Features.CreateAircraft.Commands.V1.Reads;
|
||||
using Flight.Api;
|
||||
using Flight.Data;
|
||||
using FluentAssertions;
|
||||
using Grpc.Net.Client;
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
using System.Threading.Tasks;
|
||||
using BuildingBlocks.Contracts.EventBus.Messages;
|
||||
using BuildingBlocks.TestBase;
|
||||
using Flight.Aircrafts.Features.CreateAircraft.Reads;
|
||||
using Flight.Airports.Features.CreateAirport.Reads;
|
||||
using Flight.Airports.Features.CreateAirport.Commands.V1.Reads;
|
||||
using Flight.Api;
|
||||
using Flight.Data;
|
||||
using FluentAssertions;
|
||||
using Integration.Test.Fakes;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user