Skip to content

Commit

Permalink
Merge pull request #270 from meysamhadeli/refactor/refactor-access-mo…
Browse files Browse the repository at this point in the history
…difieres-in-feature-slices

refactor: Refactor access modifiers in feature slices
  • Loading branch information
meysamhadeli authored Jul 16, 2023
2 parents 1262566 + 25230ee commit b4fd4d5
Show file tree
Hide file tree
Showing 26 changed files with 41 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Booking.Booking.Features;

using CreatingBook.Commands.V1;
using CreatingBook.V1;

public class BookingMappings : IRegister
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Booking.Booking.Features.CreatingBook.Commands.V1;
namespace Booking.Booking.Features.CreatingBook.V1;

using Ardalis.GuardClauses;
using BuildingBlocks.Core;
Expand All @@ -8,7 +8,6 @@ namespace Booking.Booking.Features.CreatingBook.Commands.V1;
using BuildingBlocks.EventStoreDB.Repository;
using BuildingBlocks.Web;
using Duende.IdentityServer.EntityFramework.Entities;
using Elasticsearch.Net;
using Exceptions;
using Flight;
using FluentValidation;
Expand All @@ -22,8 +21,7 @@ namespace Booking.Booking.Features.CreatingBook.Commands.V1;
using Passenger;
using ValueObjects;

public record CreateBooking(Guid PassengerId, Guid FlightId, string Description) : ICommand<CreateBookingResult>,
IInternalCommand
public record CreateBooking(Guid PassengerId, Guid FlightId, string Description) : ICommand<CreateBookingResult>
{
public Guid Id { get; init; } = NewId.NextGuid();
}
Expand Down Expand Up @@ -66,7 +64,7 @@ public IEndpointRouteBuilder MapEndpoint(IEndpointRouteBuilder builder)
}
}

internal class CreateBookingValidator : AbstractValidator<CreateBooking>
public class CreateBookingValidator : AbstractValidator<CreateBooking>
{
public CreateBookingValidator()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Booking/src/Booking/Booking/Models/Booking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Booking.Booking.Models;

using Features.CreatingBook.Commands.V1;
using Features.CreatingBook.V1;
using ValueObjects;

public record Booking : AggregateEventSourcing<Guid>
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Booking/src/Booking/BookingProjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Booking;

using Booking.Features.CreatingBook.Commands.V1;
using Booking.Features.CreatingBook.V1;
using Booking.Models;
using MassTransit;

Expand Down
2 changes: 1 addition & 1 deletion src/Services/Booking/src/Booking/EventMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Booking;

using Booking.Features.CreatingBook.Commands.V1;
using Booking.Features.CreatingBook.V1;

public sealed class EventMapper : IEventMapper
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Integration.Test.Fakes;

using System;
using global::Booking.Booking.Features.CreatingBook.Commands.V1;
using global::Booking.Booking.Features.CreatingBook.V1;
using MassTransit;

public sealed class FakeCreateBookingCommand : AutoFaker<CreateBooking>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public IEndpointRouteBuilder MapEndpoint(IEndpointRouteBuilder builder)
}
}

internal class CreateAircraftValidator : AbstractValidator<CreateAircraft>
public class CreateAircraftValidator : AbstractValidator<CreateAircraft>
{
public CreateAircraftValidator()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Flight.Aircrafts.Features.CreatingAircraft.V1;

public record CreateAircraftMongo(Guid Id, string Name, string Model, int ManufacturingYear, bool IsDeleted = false) : InternalCommand;

public class CreateAircraftMongoHandler : ICommandHandler<CreateAircraftMongo>
internal class CreateAircraftMongoHandler : ICommandHandler<CreateAircraftMongo>
{
private readonly FlightReadDbContext _flightReadDbContext;
private readonly IMapper _mapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public IEndpointRouteBuilder MapEndpoint(IEndpointRouteBuilder builder)
}
}

internal class CreateAirportValidator : AbstractValidator<CreateAirport>
public class CreateAirportValidator : AbstractValidator<CreateAirport>
{
public CreateAirportValidator()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Flight/src/Flight/EventMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Flight;
using Flights.Features.DeletingFlight.V1;
using Flights.Features.UpdatingFlight.V1;
using Seats.Features.CreatingSeat.V1;
using Seats.Features.ReservingSeat.Commands.V1;
using Seats.Features.ReservingSeat.V1;

// ref: https://www.ledjonbehluli.com/posts/domain_to_integration_event/
public sealed class EventMapper : IEventMapper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public IEndpointRouteBuilder MapEndpoint(IEndpointRouteBuilder builder)
}
}

internal class DeleteFlightValidator : AbstractValidator<DeleteFlight>
public class DeleteFlightValidator : AbstractValidator<DeleteFlight>
{
public DeleteFlightValidator()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public GetFlightByIdValidator()
}
}

public class GetFlightByIdHandler : IQueryHandler<GetFlightById, GetFlightByIdResult>
internal class GetFlightByIdHandler : IQueryHandler<GetFlightById, GetFlightByIdResult>
{
private readonly IMapper _mapper;
private readonly FlightReadDbContext _flightReadDbContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public IEndpointRouteBuilder MapEndpoint(IEndpointRouteBuilder builder)
}
}

internal class UpdateFlightValidator : AbstractValidator<CreateFlight>
public class UpdateFlightValidator : AbstractValidator<CreateFlight>
{
public UpdateFlightValidator()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Flight.GrpcServer.Services;
using System;
using Flights.Features.GettingFlightById.V1;
using Seats.Features.GettingAvailableSeats.V1;
using Seats.Features.ReservingSeat.Commands.V1;
using Seats.Features.ReservingSeat.V1;
using GetAvailableSeatsResult = GetAvailableSeatsResult;
using GetFlightByIdResult = GetFlightByIdResult;
using ReserveSeatResult = ReserveSeatResult;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
namespace Flight.Seats.Features.CreatingSeat.V1;

using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Ardalis.GuardClauses;
using BuildingBlocks.Core.CQRS;
using BuildingBlocks.Core.Event;
using BuildingBlocks.Web;
using Duende.IdentityServer.EntityFramework.Entities;
using Flight.Data;
using Flight.Seats.Exceptions;
using Flight.Seats.Models;
using Data;
using Exceptions;
using Models;
using Flights.ValueObjects;
using FluentValidation;
using Mapster;
Expand Down Expand Up @@ -71,7 +70,7 @@ private async Task<IResult> CreateSeat(CreateSeatRequestDto request, IMediator m
}
}

internal class CreateSeatValidator : AbstractValidator<CreateSeat>
public class CreateSeatValidator : AbstractValidator<CreateSeat>
{
public CreateSeatValidator()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
using Ardalis.GuardClauses;
using BuildingBlocks.Core.CQRS;
using BuildingBlocks.Core.Event;
using Flight.Data;
using Flight.Seats.Exceptions;
using Flight.Seats.Models;
using Data;
using Exceptions;
using Models;
using MapsterMapper;
using MediatR;
using MongoDB.Driver;
Expand All @@ -17,7 +17,7 @@
public record CreateSeatMongo(Guid Id, string SeatNumber, Enums.SeatType Type,
Enums.SeatClass Class, Guid FlightId, bool IsDeleted = false) : InternalCommand;

public class CreateSeatMongoHandler : ICommandHandler<CreateSeatMongo>
internal class CreateSeatMongoHandler : ICommandHandler<CreateSeatMongo>
{
private readonly FlightReadDbContext _flightReadDbContext;
private readonly IMapper _mapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private async Task<IResult> GetAvailableSeats(Guid id, IMediator mediator, Cance
}
}

internal class GetAvailableSeatsValidator : AbstractValidator<GetAvailableSeats>
public class GetAvailableSeatsValidator : AbstractValidator<GetAvailableSeats>
{
public GetAvailableSeatsValidator()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Flight.Seats.Features.ReservingSeat.Commands.V1;
namespace Flight.Seats.Features.ReservingSeat.V1;

using System;
using System.Threading;
Expand All @@ -7,10 +7,9 @@ namespace Flight.Seats.Features.ReservingSeat.Commands.V1;
using BuildingBlocks.Core.CQRS;
using BuildingBlocks.Core.Event;
using BuildingBlocks.Web;
using Data;
using Duende.IdentityServer.EntityFramework.Entities;
using Exceptions;
using Flights.ValueObjects;
using Flight.Data;
using Flight.Seats.Exceptions;
using FluentValidation;
using Mapster;
using MapsterMapper;
Expand All @@ -19,7 +18,6 @@ namespace Flight.Seats.Features.ReservingSeat.Commands.V1;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
using Microsoft.EntityFrameworkCore;
using ValueObjects;

public record ReserveSeat(Guid FlightId, string SeatNumber) : ICommand<ReserveSeatResult>, IInternalCommand;

Expand Down Expand Up @@ -63,7 +61,7 @@ private async Task<IResult> ReserveSeat(ReserveSeatRequestDto request, IMediator
}
}

internal class ReserveSeatValidator : AbstractValidator<ReserveSeat>
public class ReserveSeatValidator : AbstractValidator<ReserveSeat>
{
public ReserveSeatValidator()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Flight.Seats.Features.ReservingSeat.Commands.V1;
namespace Flight.Seats.Features.ReservingSeat.V1;

using System;
using System.Threading;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Flight.Seats.Features;

using CreatingSeat.V1;
using MassTransit;
using ReservingSeat.Commands.V1;
using ReservingSeat.V1;

public class SeatMappings : IRegister
{
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Flight/src/Flight/Seats/Models/Seat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace Flight.Seats.Models;

using Features.CreatingSeat.V1;
using Features.ReservingSeat.Commands.V1;
using Features.ReservingSeat.V1;
using Flight.Flights.ValueObjects;
using ValueObjects;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public IEndpointRouteBuilder MapEndpoint(IEndpointRouteBuilder builder)
}
}

internal class RegisterNewUserValidator : AbstractValidator<RegisterNewUser>
public class RegisterNewUserValidator : AbstractValidator<RegisterNewUser>
{
public RegisterNewUserValidator()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace Passenger.GrpcServer.Services;

using Mapster;
using Passengers.Features.GettingPassengerById.Queries.V1;
using Passengers.Features.GettingPassengerById.V1;
using GetPassengerByIdResult = Passenger.GetPassengerByIdResult;

public class PassengerGrpcServices : PassengerGrpcService.PassengerGrpcServiceBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public IEndpointRouteBuilder MapEndpoint(IEndpointRouteBuilder builder)
}
}

internal class CompleteRegisterPassengerValidator : AbstractValidator<CompleteRegisterPassenger>
public class CompleteRegisterPassengerValidator : AbstractValidator<CompleteRegisterPassenger>
{
public CompleteRegisterPassengerValidator()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
namespace Passenger.Passengers.Features.GettingPassengerById.Queries.V1;
namespace Passenger.Passengers.Features.GettingPassengerById.V1;

using Ardalis.GuardClauses;
using BuildingBlocks.Core.CQRS;
using BuildingBlocks.Web;
using Data;
using Dtos;
using Duende.IdentityServer.EntityFramework.Entities;
using Exceptions;
using FluentValidation;
using Mapster;
using MapsterMapper;
Expand All @@ -16,7 +13,9 @@ namespace Passenger.Passengers.Features.GettingPassengerById.Queries.V1;
using Microsoft.AspNetCore.Routing;
using MongoDB.Driver;
using MongoDB.Driver.Linq;
using ValueObjects;
using Passenger.Data;
using Passenger.Passengers.Dtos;
using Passenger.Passengers.Exceptions;

public record GetPassengerById(Guid Id) : IQuery<GetPassengerByIdResult>;

Expand Down Expand Up @@ -51,7 +50,7 @@ public IEndpointRouteBuilder MapEndpoint(IEndpointRouteBuilder builder)
}
}

internal class GetPassengerByIdValidator : AbstractValidator<GetPassengerById>
public class GetPassengerByIdValidator : AbstractValidator<GetPassengerById>
{
public GetPassengerByIdValidator()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Integration.Test.Passenger.Features;

using global::Passenger.Passengers.Features.GettingPassengerById.Queries.V1;
using global::Passenger.Passengers.Features.GettingPassengerById.V1;
using Humanizer;
using Thrift.Protocol;

Expand Down

0 comments on commit b4fd4d5

Please sign in to comment.