Merge pull request #55 from meysamhadeli/develop

add versioning to feature folder structure
This commit is contained in:
Meysam Hadeli 2022-10-20 13:53:04 +03:30 committed by GitHub
commit a552c33604
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
162 changed files with 253 additions and 247 deletions

View File

@ -6,18 +6,17 @@ using Microsoft.AspNetCore.Authentication;
using Serilog; using Serilog;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
var env = builder.Environment;
var appOptions = builder.Services.GetOptions<AppOptions>("AppOptions"); var appOptions = builder.Services.GetOptions<AppOptions>("AppOptions");
Console.WriteLine(FiggleFonts.Standard.Render(appOptions.Name)); Console.WriteLine(FiggleFonts.Standard.Render(appOptions.Name));
builder.AddCustomSerilog(); builder.AddCustomSerilog(env);
builder.Services.AddJwt(); builder.Services.AddJwt();
builder.Services.AddControllers(); builder.Services.AddControllers();
builder.Services.AddHttpContextAccessor(); builder.Services.AddHttpContextAccessor();
builder.Services.AddReverseProxy().LoadFromConfig(builder.Configuration.GetSection("Yarp")); builder.Services.AddReverseProxy().LoadFromConfig(builder.Configuration.GetSection("Yarp"));
var app = builder.Build(); var app = builder.Build();
app.UseSerilogRequestLogging(); app.UseSerilogRequestLogging();

View File

@ -1,6 +1,7 @@
using System.Text; using System.Text;
using BuildingBlocks.Web; using BuildingBlocks.Web;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Serilog; using Serilog;
using Serilog.Events; using Serilog.Events;
@ -12,7 +13,7 @@ namespace BuildingBlocks.Logging
{ {
public static class Extensions 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) => builder.Host.UseSerilog((context, services, loggerConfiguration) =>
{ {
@ -50,14 +51,16 @@ namespace BuildingBlocks.Logging
if (logOptions.File is { Enable: true }) 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; var path = string.IsNullOrWhiteSpace(logOptions.File.Path) ? "logs/.txt" : logOptions.File.Path;
if (!Enum.TryParse<RollingInterval>(logOptions.File.Interval, true, out var interval)) if (!Enum.TryParse<RollingInterval>(logOptions.File.Interval, true, out var interval))
{ {
interval = RollingInterval.Day; interval = RollingInterval.Day;
} }
loggerConfiguration.WriteTo.File(path, rollingInterval: interval, encoding: Encoding.UTF8, loggerConfiguration.WriteTo.File(path, rollingInterval: interval, encoding: Encoding.UTF8, outputTemplate: logOptions.LogTemplate);
outputTemplate: logOptions.LogTemplate);
} }
}); });

View File

@ -1,5 +1,4 @@
using Booking; using Booking;
using Booking.Configuration;
using Booking.Data; using Booking.Data;
using Booking.Extensions; using Booking.Extensions;
using BuildingBlocks.EventStoreDB; using BuildingBlocks.EventStoreDB;
@ -15,11 +14,9 @@ using BuildingBlocks.PersistMessageProcessor;
using BuildingBlocks.Swagger; using BuildingBlocks.Swagger;
using BuildingBlocks.Web; using BuildingBlocks.Web;
using Figgle; using Figgle;
using Flight;
using FluentValidation; using FluentValidation;
using Hellang.Middleware.ProblemDetails; using Hellang.Middleware.ProblemDetails;
using Microsoft.AspNetCore.Mvc.ApiExplorer; using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Passenger;
using Prometheus; using Prometheus;
using Serilog; using Serilog;
@ -34,7 +31,7 @@ Console.WriteLine(FiggleFonts.Standard.Render(appOptions.Name));
builder.Services.AddPersistMessage(configuration); builder.Services.AddPersistMessage(configuration);
builder.Services.AddMongoDbContext<BookingReadDbContext>(configuration); builder.Services.AddMongoDbContext<BookingReadDbContext>(configuration);
builder.AddCustomSerilog(); builder.AddCustomSerilog(env);
builder.Services.AddCore(); builder.Services.AddCore();
builder.Services.AddJwt(); builder.Services.AddJwt();
builder.Services.AddControllers(); builder.Services.AddControllers();
@ -86,6 +83,9 @@ app.MapGet("/", x => x.Response.WriteAsync(appOptions.Name));
app.Run(); app.Run();
public partial class Program namespace Booking.Api
{ {
public partial class Program
{
}
} }

View File

@ -1,10 +0,0 @@
using BuildingBlocks.Exception;
namespace Booking.Booking.Exceptions;
public class PassengerNotFoundException: NotFoundException
{
public PassengerNotFoundException() : base("Flight doesn't exist! ")
{
}
}

View File

@ -1,5 +1,4 @@
using Booking.Booking.Dtos; using Booking.Booking.Dtos;
using Booking.Booking.Events.Domain;
using Booking.Booking.Models.Reads; using Booking.Booking.Models.Reads;
using BuildingBlocks.IdsGenerator; using BuildingBlocks.IdsGenerator;
using Mapster; using Mapster;

View File

@ -2,7 +2,7 @@ using BuildingBlocks.Core.CQRS;
using BuildingBlocks.Core.Event; using BuildingBlocks.Core.Event;
using BuildingBlocks.IdsGenerator; 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 public record CreateBookingCommand(long PassengerId, long FlightId, string Description) : ICommand<ulong>, IInternalCommand
{ {

View File

@ -1,17 +1,14 @@
using Ardalis.GuardClauses; using Ardalis.GuardClauses;
using Booking.Booking.Exceptions; using Booking.Booking.Features.CreateBooking.Exceptions;
using Booking.Booking.Models.ValueObjects; using Booking.Booking.Models.ValueObjects;
using Booking.Configuration;
using BuildingBlocks.Core; using BuildingBlocks.Core;
using BuildingBlocks.Core.CQRS; using BuildingBlocks.Core.CQRS;
using BuildingBlocks.EventStoreDB.Repository; using BuildingBlocks.EventStoreDB.Repository;
using BuildingBlocks.Utils; using BuildingBlocks.Utils;
using Flight; using Flight;
using Grpc.Net.Client;
using Microsoft.Extensions.Options;
using Passenger; using Passenger;
namespace Booking.Booking.Features.CreateBooking; namespace Booking.Booking.Features.CreateBooking.Commands.V1;
public class CreateBookingCommandHandler : ICommandHandler<CreateBookingCommand, ulong> public class CreateBookingCommandHandler : ICommandHandler<CreateBookingCommand, ulong>
{ {

View File

@ -1,6 +1,6 @@
using FluentValidation; using FluentValidation;
namespace Booking.Booking.Features.CreateBooking; namespace Booking.Booking.Features.CreateBooking.Commands.V1;
public class CreateBookingCommandValidator : AbstractValidator<CreateBookingCommand> public class CreateBookingCommandValidator : AbstractValidator<CreateBookingCommand>
{ {

View File

@ -1,10 +1,11 @@
using Booking.Booking.Features.CreateBooking.Commands.V1;
using BuildingBlocks.Web; using BuildingBlocks.Web;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
namespace Booking.Booking.Features.CreateBooking; namespace Booking.Booking.Features.CreateBooking.Endpoints.V1;
[Route(BaseApiPath + "/booking")] [Route(BaseApiPath + "/booking")]
public class CreateBookingEndpoint : BaseController public class CreateBookingEndpoint : BaseController

View File

@ -2,6 +2,6 @@ using Booking.Booking.Models.ValueObjects;
using BuildingBlocks.Core.Event; using BuildingBlocks.Core.Event;
using BuildingBlocks.Core.Model; 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; public record BookingCreatedDomainEvent(long Id, PassengerInfo PassengerInfo, Trip Trip) : Audit, IDomainEvent;

View File

@ -1,6 +1,6 @@
using BuildingBlocks.Exception; using BuildingBlocks.Exception;
namespace Booking.Booking.Exceptions; namespace Booking.Booking.Features.CreateBooking.Exceptions;
public class BookingAlreadyExistException : ConflictException public class BookingAlreadyExistException : ConflictException
{ {

View File

@ -1,6 +1,6 @@
using BuildingBlocks.Exception; using BuildingBlocks.Exception;
namespace Booking.Booking.Exceptions; namespace Booking.Booking.Features.CreateBooking.Exceptions;
public class FlightNotFoundException : NotFoundException public class FlightNotFoundException : NotFoundException
{ {

View File

@ -1,4 +1,4 @@
using Booking.Booking.Events.Domain; using Booking.Booking.Features.CreateBooking.Events.Domain.V1;
using Booking.Booking.Models.ValueObjects; using Booking.Booking.Models.ValueObjects;
using BuildingBlocks.EventStoreDB.Events; using BuildingBlocks.EventStoreDB.Events;
using BuildingBlocks.Utils; using BuildingBlocks.Utils;

View File

@ -1,4 +1,4 @@
using Booking.Booking.Events.Domain; using Booking.Booking.Features.CreateBooking.Events.Domain.V1;
using Booking.Booking.Models.Reads; using Booking.Booking.Models.Reads;
using Booking.Data; using Booking.Data;
using BuildingBlocks.EventStoreDB.Events; using BuildingBlocks.EventStoreDB.Events;

View File

@ -1,4 +1,4 @@
using Booking.Booking.Events.Domain; using Booking.Booking.Features.CreateBooking.Events.Domain.V1;
using BuildingBlocks.Contracts.EventBus.Messages; using BuildingBlocks.Contracts.EventBus.Messages;
using BuildingBlocks.Core; using BuildingBlocks.Core;
using BuildingBlocks.Core.Event; using BuildingBlocks.Core.Event;

View File

@ -1,6 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Booking.Api;
using Booking.Data; using Booking.Data;
using BuildingBlocks.Contracts.EventBus.Messages; using BuildingBlocks.Contracts.EventBus.Messages;
using BuildingBlocks.PersistMessageProcessor.Data; using BuildingBlocks.PersistMessageProcessor.Data;

View File

@ -1,5 +1,6 @@
using AutoBogus; using AutoBogus;
using Booking.Booking.Features.CreateBooking; using Booking.Booking.Features.CreateBooking;
using Booking.Booking.Features.CreateBooking.Commands.V1;
using BuildingBlocks.IdsGenerator; using BuildingBlocks.IdsGenerator;
namespace Integration.Test.Fakes; namespace Integration.Test.Fakes;

View File

@ -1,7 +1,5 @@
using System.Net;
using System.Reflection; using System.Reflection;
using BuildingBlocks.Caching; using BuildingBlocks.Caching;
using BuildingBlocks.Core;
using BuildingBlocks.EFCore; using BuildingBlocks.EFCore;
using BuildingBlocks.Exception; using BuildingBlocks.Exception;
using BuildingBlocks.HealthCheck; using BuildingBlocks.HealthCheck;
@ -24,11 +22,9 @@ using Flight.GrpcServer.Services;
using FluentValidation; using FluentValidation;
using Hellang.Middleware.ProblemDetails; using Hellang.Middleware.ProblemDetails;
using Microsoft.AspNetCore.Mvc.ApiExplorer; using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Prometheus; using Prometheus;
using Serilog; using Serilog;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
var configuration = builder.Configuration; var configuration = builder.Configuration;
var env = builder.Environment; var env = builder.Environment;
@ -42,7 +38,7 @@ builder.Services.AddScoped<IDataSeeder, FlightDataSeeder>();
builder.Services.AddMongoDbContext<FlightReadDbContext>(configuration); builder.Services.AddMongoDbContext<FlightReadDbContext>(configuration);
builder.Services.AddPersistMessage(configuration); builder.Services.AddPersistMessage(configuration);
builder.AddCustomSerilog(); builder.AddCustomSerilog(env);
builder.Services.AddCore(); builder.Services.AddCore();
builder.Services.AddJwt(); builder.Services.AddJwt();
builder.Services.AddControllers(); builder.Services.AddControllers();
@ -98,6 +94,9 @@ app.UseEndpoints(endpoints =>
app.MapGet("/", x => x.Response.WriteAsync(appOptions.Name)); app.MapGet("/", x => x.Response.WriteAsync(appOptions.Name));
app.Run(); app.Run();
public partial class Program namespace Flight.Api
{ {
public partial class Program
{
}
} }

View File

@ -1,5 +1,5 @@
using BuildingBlocks.IdsGenerator; 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;
using Flight.Aircrafts.Models.Reads; using Flight.Aircrafts.Models.Reads;
using Mapster; using Mapster;

View File

@ -2,9 +2,8 @@ using BuildingBlocks.Core.CQRS;
using BuildingBlocks.Core.Event; using BuildingBlocks.Core.Event;
using BuildingBlocks.IdsGenerator; using BuildingBlocks.IdsGenerator;
using Flight.Aircrafts.Dtos; 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 public record CreateAircraftCommand(string Name, string Model, int ManufacturingYear) : ICommand<AircraftResponseDto>, IInternalCommand
{ {

View File

@ -2,14 +2,14 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Ardalis.GuardClauses; using Ardalis.GuardClauses;
using Flight.Aircrafts.Dtos; using Flight.Aircrafts.Dtos;
using Flight.Aircrafts.Exceptions; using Flight.Aircrafts.Features.CreateAircraft.Exceptions;
using Flight.Aircrafts.Models; using Flight.Aircrafts.Models;
using Flight.Data; using Flight.Data;
using MapsterMapper; using MapsterMapper;
using MediatR; using MediatR;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace Flight.Aircrafts.Features.CreateAircraft; namespace Flight.Aircrafts.Features.CreateAircraft.Commands.V1;
public class CreateAircraftCommandHandler : IRequestHandler<CreateAircraftCommand, AircraftResponseDto> public class CreateAircraftCommandHandler : IRequestHandler<CreateAircraftCommand, AircraftResponseDto>
{ {

View File

@ -1,6 +1,6 @@
using FluentValidation; using FluentValidation;
namespace Flight.Aircrafts.Features.CreateAircraft; namespace Flight.Aircrafts.Features.CreateAircraft.Commands.V1;
public class CreateAircraftCommandValidator : AbstractValidator<CreateAircraftCommand> public class CreateAircraftCommandValidator : AbstractValidator<CreateAircraftCommand>
{ {

View File

@ -1,6 +1,6 @@
using BuildingBlocks.Core.Event; using BuildingBlocks.Core.Event;
namespace Flight.Aircrafts.Features.CreateAircraft.Reads; namespace Flight.Aircrafts.Features.CreateAircraft.Commands.V1.Reads;
public class CreateAircraftMongoCommand : InternalCommand public class CreateAircraftMongoCommand : InternalCommand
{ {

View File

@ -2,7 +2,7 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Ardalis.GuardClauses; using Ardalis.GuardClauses;
using BuildingBlocks.Core.CQRS; using BuildingBlocks.Core.CQRS;
using Flight.Aircrafts.Exceptions; using Flight.Aircrafts.Features.CreateAircraft.Exceptions;
using Flight.Aircrafts.Models.Reads; using Flight.Aircrafts.Models.Reads;
using Flight.Data; using Flight.Data;
using MapsterMapper; using MapsterMapper;
@ -10,7 +10,7 @@ using MediatR;
using MongoDB.Driver; using MongoDB.Driver;
using MongoDB.Driver.Linq; using MongoDB.Driver.Linq;
namespace Flight.Aircrafts.Features.CreateAircraft.Reads; namespace Flight.Aircrafts.Features.CreateAircraft.Commands.V1.Reads;
public class CreateAircraftMongoCommandHandler : ICommandHandler<CreateAircraftMongoCommand> public class CreateAircraftMongoCommandHandler : ICommandHandler<CreateAircraftMongoCommand>
{ {

View File

@ -1,11 +1,12 @@
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using BuildingBlocks.Web; using BuildingBlocks.Web;
using Flight.Aircrafts.Features.CreateAircraft.Commands.V1;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
namespace Flight.Aircrafts.Features.CreateAircraft; namespace Flight.Aircrafts.Features.CreateAircraft.Endpoints.V1;
[Route(BaseApiPath + "/flight/aircraft")] [Route(BaseApiPath + "/flight/aircraft")]
public class CreateAircraftEndpoint : BaseController public class CreateAircraftEndpoint : BaseController

View File

@ -1,5 +1,5 @@
using BuildingBlocks.Core.Event; 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; public record AircraftCreatedDomainEvent(long Id, string Name, string Model, int ManufacturingYear, bool IsDeleted) : IDomainEvent;

View File

@ -1,7 +1,7 @@
using System.Net; using System.Net;
using BuildingBlocks.Exception; using BuildingBlocks.Exception;
namespace Flight.Aircrafts.Exceptions; namespace Flight.Aircrafts.Features.CreateAircraft.Exceptions;
public class AircraftAlreadyExistException : AppException public class AircraftAlreadyExistException : AppException
{ {

View File

@ -1,6 +1,6 @@
using BuildingBlocks.Core.Model; using BuildingBlocks.Core.Model;
using BuildingBlocks.IdsGenerator; using BuildingBlocks.IdsGenerator;
using Flight.Aircrafts.Events; using Flight.Aircrafts.Features.CreateAircraft.Events.Domain.V1;
namespace Flight.Aircrafts.Models; namespace Flight.Aircrafts.Models;

View File

@ -1,5 +1,5 @@
using BuildingBlocks.IdsGenerator; 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;
using Flight.Airports.Models.Reads; using Flight.Airports.Models.Reads;
using Mapster; using Mapster;

View File

@ -2,9 +2,8 @@ using BuildingBlocks.Core.CQRS;
using BuildingBlocks.Core.Event; using BuildingBlocks.Core.Event;
using BuildingBlocks.IdsGenerator; using BuildingBlocks.IdsGenerator;
using Flight.Airports.Dtos; 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 public record CreateAirportCommand(string Name, string Address, string Code) : ICommand<AirportResponseDto>, IInternalCommand
{ {

View File

@ -2,13 +2,13 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Ardalis.GuardClauses; using Ardalis.GuardClauses;
using Flight.Airports.Dtos; using Flight.Airports.Dtos;
using Flight.Airports.Exceptions; using Flight.Airports.Features.CreateAirport.Exceptions;
using Flight.Data; using Flight.Data;
using MapsterMapper; using MapsterMapper;
using MediatR; using MediatR;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace Flight.Airports.Features.CreateAirport; namespace Flight.Airports.Features.CreateAirport.Commands.V1;
public class CreateAirportCommandHandler : IRequestHandler<CreateAirportCommand, AirportResponseDto> public class CreateAirportCommandHandler : IRequestHandler<CreateAirportCommand, AirportResponseDto>
{ {

View File

@ -1,6 +1,6 @@
using FluentValidation; using FluentValidation;
namespace Flight.Airports.Features.CreateAirport; namespace Flight.Airports.Features.CreateAirport.Commands.V1;
public class CreateAirportCommandValidator : AbstractValidator<CreateAirportCommand> public class CreateAirportCommandValidator : AbstractValidator<CreateAirportCommand>
{ {

View File

@ -1,6 +1,6 @@
using BuildingBlocks.Core.Event; using BuildingBlocks.Core.Event;
namespace Flight.Airports.Features.CreateAirport.Reads; namespace Flight.Airports.Features.CreateAirport.Commands.V1.Reads;
public class CreateAirportMongoCommand : InternalCommand public class CreateAirportMongoCommand : InternalCommand
{ {

View File

@ -2,7 +2,7 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Ardalis.GuardClauses; using Ardalis.GuardClauses;
using BuildingBlocks.Core.CQRS; using BuildingBlocks.Core.CQRS;
using Flight.Airports.Exceptions; using Flight.Airports.Features.CreateAirport.Exceptions;
using Flight.Airports.Models.Reads; using Flight.Airports.Models.Reads;
using Flight.Data; using Flight.Data;
using MapsterMapper; using MapsterMapper;
@ -10,7 +10,7 @@ using MediatR;
using MongoDB.Driver; using MongoDB.Driver;
using MongoDB.Driver.Linq; using MongoDB.Driver.Linq;
namespace Flight.Airports.Features.CreateAirport.Reads; namespace Flight.Airports.Features.CreateAirport.Commands.V1.Reads;
public class CreateAirportMongoCommandHandler : ICommandHandler<CreateAirportMongoCommand> public class CreateAirportMongoCommandHandler : ICommandHandler<CreateAirportMongoCommand>
{ {

View File

@ -1,11 +1,12 @@
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using BuildingBlocks.Web; using BuildingBlocks.Web;
using Flight.Airports.Features.CreateAirport.Commands.V1;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
namespace Flight.Airports.Features.CreateAirport; namespace Flight.Airports.Features.CreateAirport.Endpoints.V1;
[Route(BaseApiPath + "/flight/airport")] [Route(BaseApiPath + "/flight/airport")]
public class CreateAirportEndpoint : BaseController public class CreateAirportEndpoint : BaseController

View File

@ -1,5 +1,5 @@
using BuildingBlocks.Core.Event; 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; public record AirportCreatedDomainEvent(long Id, string Name, string Address, string Code, bool IsDeleted) : IDomainEvent;

View File

@ -1,6 +1,6 @@
using BuildingBlocks.Exception; using BuildingBlocks.Exception;
namespace Flight.Airports.Exceptions; namespace Flight.Airports.Features.CreateAirport.Exceptions;
public class AirportAlreadyExistException : ConflictException public class AirportAlreadyExistException : ConflictException
{ {

View File

@ -1,6 +1,6 @@
using BuildingBlocks.Core.Model; using BuildingBlocks.Core.Model;
using BuildingBlocks.IdsGenerator; using BuildingBlocks.IdsGenerator;
using Flight.Airports.Events; using Flight.Airports.Features.CreateAirport.Events.Domain.V1;
namespace Flight.Airports.Models; namespace Flight.Airports.Models;

View File

@ -1,17 +1,20 @@
using BuildingBlocks.Contracts.EventBus.Messages; using BuildingBlocks.Contracts.EventBus.Messages;
using BuildingBlocks.Core; using BuildingBlocks.Core;
using BuildingBlocks.Core.Event; using BuildingBlocks.Core.Event;
using Flight.Aircrafts.Events; using Flight.Aircrafts.Features.CreateAircraft.Commands.V1.Reads;
using Flight.Aircrafts.Features.CreateAircraft.Reads; using Flight.Aircrafts.Features.CreateAircraft.Events.Domain.V1;
using Flight.Airports.Events; using Flight.Airports.Features.CreateAirport.Commands.V1.Reads;
using Flight.Airports.Features.CreateAirport.Reads; using Flight.Airports.Features.CreateAirport.Events.Domain.V1;
using Flight.Flights.Events.Domain; using Flight.Flights.Features.CreateFlight.Commands.V1.Reads;
using Flight.Flights.Features.CreateFlight.Reads; using Flight.Flights.Features.CreateFlight.Events.Domain.V1;
using Flight.Flights.Features.DeleteFlight.Reads; using Flight.Flights.Features.DeleteFlight.Commands.V1.Reads;
using Flight.Flights.Features.UpdateFlight.Reads; using Flight.Flights.Features.DeleteFlight.Events.Domain.V1;
using Flight.Seats.Events; using Flight.Flights.Features.UpdateFlight.Commands.V1.Reads;
using Flight.Seats.Features.CreateSeat.Reads; using Flight.Flights.Features.UpdateFlight.Events.V1;
using Flight.Seats.Features.ReserveSeat.Reads; 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; namespace Flight;

View File

@ -18,9 +18,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Aircrafts\Exceptions" />
<Folder Include="Airports\Exceptions" />
<Folder Include="Data\Migrations" /> <Folder Include="Data\Migrations" />
<Folder Include="Seats\Features\CreateSeat\Events\Domain" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -3,9 +3,8 @@ using BuildingBlocks.Core.CQRS;
using BuildingBlocks.Core.Event; using BuildingBlocks.Core.Event;
using BuildingBlocks.IdsGenerator; using BuildingBlocks.IdsGenerator;
using Flight.Flights.Dtos; 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, public record CreateFlightCommand(string FlightNumber, long AircraftId, long DepartureAirportId,
DateTime DepartureDate, DateTime ArriveDate, long ArriveAirportId, DateTime DepartureDate, DateTime ArriveDate, long ArriveAirportId,

View File

@ -5,10 +5,11 @@ using BuildingBlocks.Core.CQRS;
using Flight.Data; using Flight.Data;
using Flight.Flights.Dtos; using Flight.Flights.Dtos;
using Flight.Flights.Exceptions; using Flight.Flights.Exceptions;
using Flight.Flights.Features.CreateFlight.Exceptions;
using MapsterMapper; using MapsterMapper;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace Flight.Flights.Features.CreateFlight; namespace Flight.Flights.Features.CreateFlight.Commands.V1;
public class CreateFlightCommandHandler : ICommandHandler<CreateFlightCommand, FlightResponseDto> public class CreateFlightCommandHandler : ICommandHandler<CreateFlightCommand, FlightResponseDto>
{ {

View File

@ -1,7 +1,6 @@
using Flight.Flights.Models;
using FluentValidation; using FluentValidation;
namespace Flight.Flights.Features.CreateFlight; namespace Flight.Flights.Features.CreateFlight.Commands.V1;
public class CreateFlightCommandValidator : AbstractValidator<CreateFlightCommand> public class CreateFlightCommandValidator : AbstractValidator<CreateFlightCommand>
{ {

View File

@ -1,8 +1,7 @@
using System; using System;
using BuildingBlocks.Core.Event; 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 public class CreateFlightMongoCommand : InternalCommand
{ {

View File

@ -4,13 +4,14 @@ using Ardalis.GuardClauses;
using BuildingBlocks.Core.CQRS; using BuildingBlocks.Core.CQRS;
using Flight.Data; using Flight.Data;
using Flight.Flights.Exceptions; using Flight.Flights.Exceptions;
using Flight.Flights.Features.CreateFlight.Exceptions;
using Flight.Flights.Models.Reads; using Flight.Flights.Models.Reads;
using MapsterMapper; using MapsterMapper;
using MediatR; using MediatR;
using MongoDB.Driver; using MongoDB.Driver;
using MongoDB.Driver.Linq; using MongoDB.Driver.Linq;
namespace Flight.Flights.Features.CreateFlight.Reads; namespace Flight.Flights.Features.CreateFlight.Commands.V1.Reads;
public class CreateFlightMongoCommandHandler : ICommandHandler<CreateFlightMongoCommand> public class CreateFlightMongoCommandHandler : ICommandHandler<CreateFlightMongoCommand>
{ {

View File

@ -1,12 +1,13 @@
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using BuildingBlocks.Web; using BuildingBlocks.Web;
using Flight.Flights.Features.CreateFlight.Commands.V1;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
namespace Flight.Flights.Features.CreateFlight; namespace Flight.Flights.Features.CreateFlight.Endpoints.V1;
[Route(BaseApiPath + "/flight")] [Route(BaseApiPath + "/flight")]
public class CreateFlightEndpoint : BaseController public class CreateFlightEndpoint : BaseController

View File

@ -1,8 +1,7 @@
using System; using System;
using BuildingBlocks.Core.Event; 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, public record FlightCreatedDomainEvent(long Id, string FlightNumber, long AircraftId, DateTime DepartureDate,
long DepartureAirportId, DateTime ArriveDate, long ArriveAirportId, decimal DurationMinutes, long DepartureAirportId, DateTime ArriveDate, long ArriveAirportId, decimal DurationMinutes,

View File

@ -1,6 +1,6 @@
using BuildingBlocks.Exception; using BuildingBlocks.Exception;
namespace Flight.Flights.Exceptions; namespace Flight.Flights.Features.CreateFlight.Exceptions;
public class FlightAlreadyExistException : ConflictException public class FlightAlreadyExistException : ConflictException
{ {

View File

@ -2,6 +2,6 @@
using BuildingBlocks.Core.Event; using BuildingBlocks.Core.Event;
using Flight.Flights.Dtos; using Flight.Flights.Dtos;
namespace Flight.Flights.Features.DeleteFlight; namespace Flight.Flights.Features.DeleteFlight.Commands.V1;
public record DeleteFlightCommand(long Id) : ICommand<FlightResponseDto>, IInternalCommand; public record DeleteFlightCommand(long Id) : ICommand<FlightResponseDto>, IInternalCommand;

View File

@ -5,12 +5,10 @@ using BuildingBlocks.Core.CQRS;
using Flight.Data; using Flight.Data;
using Flight.Flights.Dtos; using Flight.Flights.Dtos;
using Flight.Flights.Exceptions; using Flight.Flights.Exceptions;
using Flight.Flights.Models;
using MapsterMapper; using MapsterMapper;
using MediatR;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace Flight.Flights.Features.DeleteFlight; namespace Flight.Flights.Features.DeleteFlight.Commands.V1;
public class DeleteFlightCommandHandler : ICommandHandler<DeleteFlightCommand, FlightResponseDto> public class DeleteFlightCommandHandler : ICommandHandler<DeleteFlightCommand, FlightResponseDto>
{ {

View File

@ -1,6 +1,6 @@
using FluentValidation; using FluentValidation;
namespace Flight.Flights.Features.DeleteFlight; namespace Flight.Flights.Features.DeleteFlight.Commands.V1;
public class DeleteFlightCommandValidator : AbstractValidator<DeleteFlightCommand> public class DeleteFlightCommandValidator : AbstractValidator<DeleteFlightCommand>
{ {

View File

@ -1,8 +1,7 @@
using System; using System;
using BuildingBlocks.Core.Event; 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 public class DeleteFlightMongoCommand : InternalCommand
{ {

View File

@ -10,7 +10,7 @@ using MediatR;
using MongoDB.Driver; using MongoDB.Driver;
using MongoDB.Driver.Linq; using MongoDB.Driver.Linq;
namespace Flight.Flights.Features.DeleteFlight.Reads; namespace Flight.Flights.Features.DeleteFlight.Commands.V1.Reads;
public class DeleteFlightMongoCommandHandler : ICommandHandler<DeleteFlightMongoCommand> public class DeleteFlightMongoCommandHandler : ICommandHandler<DeleteFlightMongoCommand>
{ {

View File

@ -1,12 +1,13 @@
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using BuildingBlocks.Web; using BuildingBlocks.Web;
using Flight.Flights.Features.DeleteFlight.Commands.V1;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
namespace Flight.Flights.Features.DeleteFlight; namespace Flight.Flights.Features.DeleteFlight.Endpoints.V1;
[Route(BaseApiPath + "/flight")] [Route(BaseApiPath + "/flight")]
public class DeleteFlightEndpoint : BaseController public class DeleteFlightEndpoint : BaseController

View File

@ -1,8 +1,7 @@
using System; using System;
using BuildingBlocks.Core.Event; 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, public record FlightDeletedDomainEvent(long Id, string FlightNumber, long AircraftId, DateTime DepartureDate,
long DepartureAirportId, DateTime ArriveDate, long ArriveAirportId, decimal DurationMinutes, long DepartureAirportId, DateTime ArriveDate, long ArriveAirportId, decimal DurationMinutes,

View File

@ -1,9 +1,9 @@
using AutoMapper; using AutoMapper;
using BuildingBlocks.IdsGenerator; using BuildingBlocks.IdsGenerator;
using Flight.Flights.Dtos; using Flight.Flights.Dtos;
using Flight.Flights.Features.CreateFlight.Reads; using Flight.Flights.Features.CreateFlight.Commands.V1.Reads;
using Flight.Flights.Features.DeleteFlight.Reads; using Flight.Flights.Features.DeleteFlight.Commands.V1.Reads;
using Flight.Flights.Features.UpdateFlight.Reads; using Flight.Flights.Features.UpdateFlight.Commands.V1.Reads;
using Flight.Flights.Models.Reads; using Flight.Flights.Models.Reads;
using Mapster; using Mapster;

View File

@ -1,12 +1,13 @@
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using BuildingBlocks.Web; using BuildingBlocks.Web;
using Flight.Flights.Features.GetAvailableFlights.Queries.V1;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
namespace Flight.Flights.Features.GetAvailableFlights; namespace Flight.Flights.Features.GetAvailableFlights.Endpoints.V1;
[Route(BaseApiPath + "/flight/get-available-flights")] [Route(BaseApiPath + "/flight/get-available-flights")]
public class GetAvailableFlightsEndpoint : BaseController public class GetAvailableFlightsEndpoint : BaseController

View File

@ -3,9 +3,8 @@ using System.Collections.Generic;
using BuildingBlocks.Caching; using BuildingBlocks.Caching;
using BuildingBlocks.Core.CQRS; using BuildingBlocks.Core.CQRS;
using Flight.Flights.Dtos; 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 public record GetAvailableFlightsQuery : IQuery<IEnumerable<FlightResponseDto>>, ICacheRequest
{ {

View File

@ -10,7 +10,7 @@ using Flight.Flights.Exceptions;
using MapsterMapper; using MapsterMapper;
using MongoDB.Driver; using MongoDB.Driver;
namespace Flight.Flights.Features.GetAvailableFlights; namespace Flight.Flights.Features.GetAvailableFlights.Queries.V1;
public class GetAvailableFlightsQueryHandler : IQueryHandler<GetAvailableFlightsQuery, IEnumerable<FlightResponseDto>> public class GetAvailableFlightsQueryHandler : IQueryHandler<GetAvailableFlightsQuery, IEnumerable<FlightResponseDto>>
{ {

View File

@ -1,6 +1,6 @@
using FluentValidation; using FluentValidation;
namespace Flight.Flights.Features.GetAvailableFlights; namespace Flight.Flights.Features.GetAvailableFlights.Queries.V1;
public class GetAvailableFlightsQueryValidator : AbstractValidator<GetAvailableFlightsQuery> public class GetAvailableFlightsQueryValidator : AbstractValidator<GetAvailableFlightsQuery>
{ {

View File

@ -1,13 +1,13 @@
using System;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using BuildingBlocks.Web; using BuildingBlocks.Web;
using Flight.Flights.Features.GetFlightById.Queries.V1;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
namespace Flight.Flights.Features.GetFlightById; namespace Flight.Flights.Features.GetFlightById.Endpoints.V1;
[Route(BaseApiPath + "/flight")] [Route(BaseApiPath + "/flight")]
public class GetFlightByIdEndpoint : BaseController public class GetFlightByIdEndpoint : BaseController

View File

@ -1,6 +1,6 @@
using BuildingBlocks.Core.CQRS; using BuildingBlocks.Core.CQRS;
using Flight.Flights.Dtos; using Flight.Flights.Dtos;
namespace Flight.Flights.Features.GetFlightById; namespace Flight.Flights.Features.GetFlightById.Queries.V1;
public record GetFlightByIdQuery(long Id) : IQuery<FlightResponseDto>; public record GetFlightByIdQuery(long Id) : IQuery<FlightResponseDto>;

View File

@ -9,7 +9,7 @@ using MapsterMapper;
using MongoDB.Driver; using MongoDB.Driver;
using MongoDB.Driver.Linq; using MongoDB.Driver.Linq;
namespace Flight.Flights.Features.GetFlightById; namespace Flight.Flights.Features.GetFlightById.Queries.V1;
public class GetFlightByIdQueryHandler : IQueryHandler<GetFlightByIdQuery, FlightResponseDto> public class GetFlightByIdQueryHandler : IQueryHandler<GetFlightByIdQuery, FlightResponseDto>
{ {

View File

@ -1,6 +1,6 @@
using FluentValidation; using FluentValidation;
namespace Flight.Flights.Features.GetFlightById; namespace Flight.Flights.Features.GetFlightById.Queries.V1;
public class GetFlightByIdQueryValidator : AbstractValidator<GetFlightByIdQuery> public class GetFlightByIdQueryValidator : AbstractValidator<GetFlightByIdQuery>
{ {

View File

@ -1,8 +1,7 @@
using System; using System;
using BuildingBlocks.Core.Event; 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 public class UpdateFlightMongoCommand : InternalCommand
{ {

View File

@ -10,7 +10,7 @@ using MediatR;
using MongoDB.Driver; using MongoDB.Driver;
using MongoDB.Driver.Linq; using MongoDB.Driver.Linq;
namespace Flight.Flights.Features.UpdateFlight.Reads; namespace Flight.Flights.Features.UpdateFlight.Commands.V1.Reads;
public class UpdateFlightMongoCommandHandler : ICommandHandler<UpdateFlightMongoCommand> public class UpdateFlightMongoCommandHandler : ICommandHandler<UpdateFlightMongoCommand>
{ {

View File

@ -3,10 +3,8 @@ using BuildingBlocks.Caching;
using BuildingBlocks.Core.CQRS; using BuildingBlocks.Core.CQRS;
using BuildingBlocks.Core.Event; using BuildingBlocks.Core.Event;
using Flight.Flights.Dtos; 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 public record UpdateFlightCommand : ICommand<FlightResponseDto>, IInvalidateCacheRequest, IInternalCommand
{ {

View File

@ -2,16 +2,13 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Ardalis.GuardClauses; using Ardalis.GuardClauses;
using BuildingBlocks.Core.CQRS; using BuildingBlocks.Core.CQRS;
using BuildingBlocks.EventStoreDB.Repository;
using Flight.Data; using Flight.Data;
using Flight.Flights.Dtos; using Flight.Flights.Dtos;
using Flight.Flights.Exceptions; using Flight.Flights.Exceptions;
using Flight.Flights.Models;
using MapsterMapper; using MapsterMapper;
using MediatR;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace Flight.Flights.Features.UpdateFlight; namespace Flight.Flights.Features.UpdateFlight.Commands.V1;
public class UpdateFlightCommandHandler : ICommandHandler<UpdateFlightCommand, FlightResponseDto> public class UpdateFlightCommandHandler : ICommandHandler<UpdateFlightCommand, FlightResponseDto>
{ {

View File

@ -1,8 +1,7 @@
using Flight.Flights.Features.CreateFlight; using Flight.Flights.Features.CreateFlight.Commands.V1;
using Flight.Flights.Models;
using FluentValidation; using FluentValidation;
namespace Flight.Flights.Features.UpdateFlight; namespace Flight.Flights.Features.UpdateFlight.Commands.V1;
public class UpdateFlightCommandValidator : AbstractValidator<CreateFlightCommand> public class UpdateFlightCommandValidator : AbstractValidator<CreateFlightCommand>
{ {

View File

@ -1,12 +1,13 @@
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using BuildingBlocks.Web; using BuildingBlocks.Web;
using Flight.Flights.Features.UpdateFlight.Commands.V1;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
namespace Flight.Flights.Features.UpdateFlight; namespace Flight.Flights.Features.UpdateFlight.Endpoints.V1;
[Route(BaseApiPath + "/flight")] [Route(BaseApiPath + "/flight")]
public class UpdateFlightEndpoint : BaseController public class UpdateFlightEndpoint : BaseController

View File

@ -1,8 +1,7 @@
using System; using System;
using BuildingBlocks.Core.Event; 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, public record FlightUpdatedDomainEvent(long Id, string FlightNumber, long AircraftId, DateTime DepartureDate,
long DepartureAirportId, DateTime ArriveDate, long ArriveAirportId, decimal DurationMinutes, long DepartureAirportId, DateTime ArriveDate, long ArriveAirportId, decimal DurationMinutes,
DateTime FlightDate, Enums.FlightStatus Status, decimal Price, bool IsDeleted) : IDomainEvent; DateTime FlightDate, Enums.FlightStatus Status, decimal Price, bool IsDeleted) : IDomainEvent;

View File

@ -1,6 +1,8 @@
using System; using System;
using BuildingBlocks.Core.Model; 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; namespace Flight.Flights.Models;

View File

@ -1,7 +1,10 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Flight.Flights.Features.GetFlightById; using Flight.Flights.Features.GetFlightById;
using Flight.Flights.Features.GetFlightById.Queries.V1;
using Flight.Seats.Features.GetAvailableSeats; using Flight.Seats.Features.GetAvailableSeats;
using Flight.Seats.Features.GetAvailableSeats.Queries.V1;
using Flight.Seats.Features.ReserveSeat; using Flight.Seats.Features.ReserveSeat;
using Flight.Seats.Features.ReserveSeat.Commands.V1;
using Grpc.Core; using Grpc.Core;
using Mapster; using Mapster;
using MediatR; using MediatR;

View File

@ -6,7 +6,7 @@ using MassTransit;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
namespace Flight.Identity.Consumers.RegisterNewUser; namespace Flight.Identity.Consumers.RegisterNewUser.Consumes.V1;
public class RegisterNewUserConsumerHandler : IConsumer<UserCreated> public class RegisterNewUserConsumerHandler : IConsumer<UserCreated>
{ {

View File

@ -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)
{
}
}

View File

@ -2,9 +2,8 @@ using BuildingBlocks.Core.CQRS;
using BuildingBlocks.Core.Event; using BuildingBlocks.Core.Event;
using BuildingBlocks.IdsGenerator; using BuildingBlocks.IdsGenerator;
using Flight.Seats.Dtos; 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 public record CreateSeatCommand(string SeatNumber, Enums.SeatType Type, Enums.SeatClass Class, long FlightId) : ICommand<SeatResponseDto>, IInternalCommand
{ {

View File

@ -1,20 +1,15 @@
using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Ardalis.GuardClauses; 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.Data;
using Flight.Seats.Dtos; using Flight.Seats.Dtos;
using Flight.Seats.Exceptions; using Flight.Seats.Features.CreateSeat.Exceptions;
using Flight.Seats.Models; using Flight.Seats.Models;
using MapsterMapper; using MapsterMapper;
using MediatR; using MediatR;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace Flight.Seats.Features.CreateSeat; namespace Flight.Seats.Features.CreateSeat.Commands.V1;
public class CreateSeatCommandHandler : IRequestHandler<CreateSeatCommand, SeatResponseDto> public class CreateSeatCommandHandler : IRequestHandler<CreateSeatCommand, SeatResponseDto>
{ {

View File

@ -1,8 +1,6 @@
using Flight.Airports.Features.CreateAirport;
using Flight.Seats.Models;
using FluentValidation; using FluentValidation;
namespace Flight.Seats.Features.CreateSeat; namespace Flight.Seats.Features.CreateSeat.Commands.V1;
public class CreateSeatCommandValidator : AbstractValidator<CreateSeatCommand> public class CreateSeatCommandValidator : AbstractValidator<CreateSeatCommand>
{ {

View File

@ -1,7 +1,6 @@
using BuildingBlocks.Core.Event; 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 public class CreateSeatMongoCommand : InternalCommand
{ {

View File

@ -3,14 +3,14 @@ using System.Threading.Tasks;
using Ardalis.GuardClauses; using Ardalis.GuardClauses;
using BuildingBlocks.Core.CQRS; using BuildingBlocks.Core.CQRS;
using Flight.Data; using Flight.Data;
using Flight.Seats.Exceptions; using Flight.Seats.Features.CreateSeat.Exceptions;
using Flight.Seats.Models.Reads; using Flight.Seats.Models.Reads;
using MapsterMapper; using MapsterMapper;
using MediatR; using MediatR;
using MongoDB.Driver; using MongoDB.Driver;
using MongoDB.Driver.Linq; using MongoDB.Driver.Linq;
namespace Flight.Seats.Features.CreateSeat.Reads; namespace Flight.Seats.Features.CreateSeat.Commands.V1.Reads;
public class CreateSeatMongoCommandHandler : ICommandHandler<CreateSeatMongoCommand> public class CreateSeatMongoCommandHandler : ICommandHandler<CreateSeatMongoCommand>
{ {

View File

@ -1,12 +1,12 @@
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using BuildingBlocks.Web; using BuildingBlocks.Web;
using Flight.Airports.Features.CreateAirport; using Flight.Seats.Features.CreateSeat.Commands.V1;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
namespace Flight.Seats.Features.CreateSeat; namespace Flight.Seats.Features.CreateSeat.Endpoints.V1;
[Route(BaseApiPath + "/flight/seat")] [Route(BaseApiPath + "/flight/seat")]
public class CreateSeatEndpoint : BaseController public class CreateSeatEndpoint : BaseController

View File

@ -1,6 +1,5 @@
using BuildingBlocks.Core.Event; 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; public record SeatCreatedDomainEvent(long Id, string SeatNumber, Enums.SeatType Type, Enums.SeatClass Class, long FlightId, bool IsDeleted) : IDomainEvent;

View File

@ -1,6 +1,6 @@
using BuildingBlocks.Exception; using BuildingBlocks.Exception;
namespace Flight.Seats.Exceptions; namespace Flight.Seats.Features.CreateSeat.Exceptions;
public class SeatAlreadyExistException : ConflictException public class SeatAlreadyExistException : ConflictException
{ {

View File

@ -1,12 +1,13 @@
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using BuildingBlocks.Web; using BuildingBlocks.Web;
using Flight.Seats.Features.GetAvailableSeats.Queries.V1;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
namespace Flight.Seats.Features.GetAvailableSeats; namespace Flight.Seats.Features.GetAvailableSeats.Endpoints.V1;
[Route(BaseApiPath + "/flight/get-available-seats")] [Route(BaseApiPath + "/flight/get-available-seats")]
public class GetAvailableSeatsEndpoint : BaseController public class GetAvailableSeatsEndpoint : BaseController

View File

@ -1,6 +1,6 @@
using BuildingBlocks.Exception; using BuildingBlocks.Exception;
namespace Flight.Seats.Exceptions; namespace Flight.Seats.Features.GetAvailableSeats.Exceptions;
public class AllSeatsFullException : BadRequestException public class AllSeatsFullException : BadRequestException
{ {

View File

@ -1,8 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using BuildingBlocks.Core.CQRS; using BuildingBlocks.Core.CQRS;
using Flight.Seats.Dtos; 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>>; public record GetAvailableSeatsQuery(long FlightId) : IQuery<IEnumerable<SeatResponseDto>>;

View File

@ -5,12 +5,12 @@ using System.Threading.Tasks;
using Ardalis.GuardClauses; using Ardalis.GuardClauses;
using Flight.Data; using Flight.Data;
using Flight.Seats.Dtos; using Flight.Seats.Dtos;
using Flight.Seats.Exceptions; using Flight.Seats.Features.GetAvailableSeats.Exceptions;
using MapsterMapper; using MapsterMapper;
using MediatR; using MediatR;
using MongoDB.Driver; using MongoDB.Driver;
namespace Flight.Seats.Features.GetAvailableSeats; namespace Flight.Seats.Features.GetAvailableSeats.Queries.V1;
public class GetAvailableSeatsQueryHandler : IRequestHandler<GetAvailableSeatsQuery, IEnumerable<SeatResponseDto>> public class GetAvailableSeatsQueryHandler : IRequestHandler<GetAvailableSeatsQuery, IEnumerable<SeatResponseDto>>
{ {

View File

@ -1,6 +1,6 @@
using FluentValidation; using FluentValidation;
namespace Flight.Seats.Features.GetAvailableSeats; namespace Flight.Seats.Features.GetAvailableSeats.Queries.V1;
public class GetAvailableSeatsQueryValidator : AbstractValidator<GetAvailableSeatsQuery> public class GetAvailableSeatsQueryValidator : AbstractValidator<GetAvailableSeatsQuery>
{ {

View File

@ -1,7 +1,6 @@
using BuildingBlocks.Core.Event; 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 public class ReserveSeatMongoCommand : InternalCommand
{ {

View File

@ -8,7 +8,7 @@ using MapsterMapper;
using MediatR; using MediatR;
using MongoDB.Driver; using MongoDB.Driver;
namespace Flight.Seats.Features.ReserveSeat.Reads; namespace Flight.Seats.Features.ReserveSeat.Commands.V1.Reads;
public class ReserveSeatMongoCommandHandler : ICommandHandler<ReserveSeatMongoCommand> public class ReserveSeatMongoCommandHandler : ICommandHandler<ReserveSeatMongoCommand>
{ {

View File

@ -2,6 +2,6 @@ using BuildingBlocks.Core.CQRS;
using BuildingBlocks.Core.Event; using BuildingBlocks.Core.Event;
using Flight.Seats.Dtos; 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; public record ReserveSeatCommand(long FlightId, string SeatNumber) : ICommand<SeatResponseDto>, IInternalCommand;

View File

@ -3,12 +3,12 @@ using System.Threading.Tasks;
using Ardalis.GuardClauses; using Ardalis.GuardClauses;
using Flight.Data; using Flight.Data;
using Flight.Seats.Dtos; using Flight.Seats.Dtos;
using Flight.Seats.Exceptions; using Flight.Seats.Features.ReserveSeat.Exceptions;
using MapsterMapper; using MapsterMapper;
using MediatR; using MediatR;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace Flight.Seats.Features.ReserveSeat; namespace Flight.Seats.Features.ReserveSeat.Commands.V1;
public class ReserveSeatCommandHandler : IRequestHandler<ReserveSeatCommand, SeatResponseDto> public class ReserveSeatCommandHandler : IRequestHandler<ReserveSeatCommand, SeatResponseDto>
{ {

View File

@ -1,6 +1,6 @@
using FluentValidation; using FluentValidation;
namespace Flight.Seats.Features.ReserveSeat; namespace Flight.Seats.Features.ReserveSeat.Commands.V1;
public class ReserveSeatCommandValidator : AbstractValidator<ReserveSeatCommand> public class ReserveSeatCommandValidator : AbstractValidator<ReserveSeatCommand>
{ {

View File

@ -1,12 +1,13 @@
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using BuildingBlocks.Web; using BuildingBlocks.Web;
using Flight.Seats.Features.ReserveSeat.Commands.V1;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
namespace Flight.Seats.Features.ReserveSeat; namespace Flight.Seats.Features.ReserveSeat.Endpoints.V1;
[Route(BaseApiPath + "/flight/reserve-seat")] [Route(BaseApiPath + "/flight/reserve-seat")]
public class ReserveSeatEndpoint : BaseController public class ReserveSeatEndpoint : BaseController

View File

@ -1,6 +1,5 @@
using BuildingBlocks.Core.Event; 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; public record SeatReservedDomainEvent(long Id, string SeatNumber, Enums.SeatType Type, Enums.SeatClass Class, long FlightId, bool IsDeleted) : IDomainEvent;

View File

@ -1,6 +1,6 @@
using BuildingBlocks.Exception; using BuildingBlocks.Exception;
namespace Flight.Seats.Exceptions; namespace Flight.Seats.Features.ReserveSeat.Exceptions;
public class SeatNumberIncorrectException : BadRequestException public class SeatNumberIncorrectException : BadRequestException
{ {

View File

@ -1,7 +1,7 @@
using BuildingBlocks.IdsGenerator; using BuildingBlocks.IdsGenerator;
using Flight.Seats.Dtos; using Flight.Seats.Dtos;
using Flight.Seats.Features.CreateSeat.Reads; using Flight.Seats.Features.CreateSeat.Commands.V1.Reads;
using Flight.Seats.Features.ReserveSeat.Reads; using Flight.Seats.Features.ReserveSeat.Commands.V1.Reads;
using Flight.Seats.Models; using Flight.Seats.Models;
using Flight.Seats.Models.Reads; using Flight.Seats.Models.Reads;
using Mapster; using Mapster;

View File

@ -1,7 +1,8 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using BuildingBlocks.Core.Model; 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; namespace Flight.Seats.Models;

View File

@ -1,8 +1,8 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using BuildingBlocks.Contracts.EventBus.Messages; using BuildingBlocks.Contracts.EventBus.Messages;
using BuildingBlocks.TestBase; using BuildingBlocks.TestBase;
using Flight.Aircrafts.Features.CreateAircraft.Reads; using Flight.Aircrafts.Features.CreateAircraft.Commands.V1.Reads;
using Flight.Airports.Features.CreateAirport.Reads; using Flight.Api;
using Flight.Data; using Flight.Data;
using FluentAssertions; using FluentAssertions;
using Grpc.Net.Client; using Grpc.Net.Client;

View File

@ -1,8 +1,8 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using BuildingBlocks.Contracts.EventBus.Messages; using BuildingBlocks.Contracts.EventBus.Messages;
using BuildingBlocks.TestBase; using BuildingBlocks.TestBase;
using Flight.Aircrafts.Features.CreateAircraft.Reads; using Flight.Airports.Features.CreateAirport.Commands.V1.Reads;
using Flight.Airports.Features.CreateAirport.Reads; using Flight.Api;
using Flight.Data; using Flight.Data;
using FluentAssertions; using FluentAssertions;
using Integration.Test.Fakes; using Integration.Test.Fakes;

Some files were not shown because too many files have changed in this diff Show More