refactor: change controllers' names, implemented inheritance in dtos
This commit is contained in:
parent
6f2fc702df
commit
d3ed7abe89
@ -35,6 +35,7 @@ public class MapperInitializer : Profile
|
|||||||
CreateMap<RouteAddress, RouteAddressDto>().ReverseMap();
|
CreateMap<RouteAddress, RouteAddressDto>().ReverseMap();
|
||||||
CreateMap<RouteAddress, CreateRouteAddressDto>().ReverseMap();
|
CreateMap<RouteAddress, CreateRouteAddressDto>().ReverseMap();
|
||||||
CreateMap<RouteAddress, UpdateRouteAddressDto>().ReverseMap();
|
CreateMap<RouteAddress, UpdateRouteAddressDto>().ReverseMap();
|
||||||
|
CreateMap<RouteAddress, InRouteRouteAddressDto>().ReverseMap();
|
||||||
|
|
||||||
CreateMap<Route, RouteDto>().ReverseMap();
|
CreateMap<Route, RouteDto>().ReverseMap();
|
||||||
CreateMap<Route, CreateRouteDto>().ReverseMap();
|
CreateMap<Route, CreateRouteDto>().ReverseMap();
|
||||||
|
@ -8,11 +8,11 @@ namespace Server.Controllers;
|
|||||||
|
|
||||||
[Route("api/addresses")]
|
[Route("api/addresses")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class AddressManagementController : ControllerBase
|
public class AddressController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly IAddressManagementService _addressManagementService;
|
private readonly IAddressManagementService _addressManagementService;
|
||||||
|
|
||||||
public AddressManagementController(IAddressManagementService addressManagementService)
|
public AddressController(IAddressManagementService addressManagementService)
|
||||||
{
|
{
|
||||||
_addressManagementService = addressManagementService;
|
_addressManagementService = addressManagementService;
|
||||||
}
|
}
|
@ -8,11 +8,11 @@ namespace Server.Controllers;
|
|||||||
|
|
||||||
[Route("api/cities")]
|
[Route("api/cities")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class CityManagementController : ControllerBase
|
public class CityController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly ICityManagementService _cityManagementService;
|
private readonly ICityManagementService _cityManagementService;
|
||||||
|
|
||||||
public CityManagementController(ICityManagementService cityManagementService)
|
public CityController(ICityManagementService cityManagementService)
|
||||||
{
|
{
|
||||||
_cityManagementService = cityManagementService;
|
_cityManagementService = cityManagementService;
|
||||||
}
|
}
|
@ -8,11 +8,11 @@ namespace Server.Controllers;
|
|||||||
|
|
||||||
[Route("api/companies")]
|
[Route("api/companies")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class CompanyManagementController : ControllerBase
|
public class CompanyController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly ICompanyManagementService _companyManagementService;
|
private readonly ICompanyManagementService _companyManagementService;
|
||||||
|
|
||||||
public CompanyManagementController(ICompanyManagementService companyManagementService)
|
public CompanyController(ICompanyManagementService companyManagementService)
|
||||||
{
|
{
|
||||||
_companyManagementService = companyManagementService;
|
_companyManagementService = companyManagementService;
|
||||||
}
|
}
|
@ -8,11 +8,11 @@ namespace Server.Controllers;
|
|||||||
|
|
||||||
[Route("api/countries")]
|
[Route("api/countries")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class CountryManagementController : ControllerBase
|
public class CountryController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly ICountryManagementService _countryManagementService;
|
private readonly ICountryManagementService _countryManagementService;
|
||||||
|
|
||||||
public CountryManagementController(ICountryManagementService countryManagementService)
|
public CountryController(ICountryManagementService countryManagementService)
|
||||||
{
|
{
|
||||||
_countryManagementService = countryManagementService;
|
_countryManagementService = countryManagementService;
|
||||||
}
|
}
|
@ -8,11 +8,11 @@ namespace Server.Controllers;
|
|||||||
|
|
||||||
[Route("api/reviews")]
|
[Route("api/reviews")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class ReviewManagementController : ControllerBase
|
public class ReviewController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly IReviewManagementService _reviewManagementService;
|
private readonly IReviewManagementService _reviewManagementService;
|
||||||
|
|
||||||
public ReviewManagementController(IReviewManagementService reviewManagementService)
|
public ReviewController(IReviewManagementService reviewManagementService)
|
||||||
{
|
{
|
||||||
_reviewManagementService = reviewManagementService;
|
_reviewManagementService = reviewManagementService;
|
||||||
}
|
}
|
@ -8,11 +8,11 @@ namespace Server.Controllers;
|
|||||||
|
|
||||||
[Route("api/routeAddresses")]
|
[Route("api/routeAddresses")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class RouteAddressManagementController : ControllerBase
|
public class RouteAddressController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly IRouteAddressManagementService _routeAddressManagementService;
|
private readonly IRouteAddressManagementService _routeAddressManagementService;
|
||||||
|
|
||||||
public RouteAddressManagementController(IRouteAddressManagementService routeAddressManagementService)
|
public RouteAddressController(IRouteAddressManagementService routeAddressManagementService)
|
||||||
{
|
{
|
||||||
_routeAddressManagementService = routeAddressManagementService;
|
_routeAddressManagementService = routeAddressManagementService;
|
||||||
}
|
}
|
@ -8,11 +8,11 @@ namespace Server.Controllers;
|
|||||||
|
|
||||||
[Route("api/routes")]
|
[Route("api/routes")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class RouteManagementController : ControllerBase
|
public class RouteController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly IRouteManagementService _routeManagementService;
|
private readonly IRouteManagementService _routeManagementService;
|
||||||
|
|
||||||
public RouteManagementController(IRouteManagementService routeManagementService)
|
public RouteController(IRouteManagementService routeManagementService)
|
||||||
{
|
{
|
||||||
_routeManagementService = routeManagementService;
|
_routeManagementService = routeManagementService;
|
||||||
}
|
}
|
@ -8,11 +8,11 @@ namespace Server.Controllers;
|
|||||||
|
|
||||||
[Route("api/states")]
|
[Route("api/states")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class StateManagementController : ControllerBase
|
public class StateController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly IStateManagementService _stateManagementService;
|
private readonly IStateManagementService _stateManagementService;
|
||||||
|
|
||||||
public StateManagementController(IStateManagementService stateManagementService)
|
public StateController(IStateManagementService stateManagementService)
|
||||||
{
|
{
|
||||||
_stateManagementService = stateManagementService;
|
_stateManagementService = stateManagementService;
|
||||||
}
|
}
|
@ -8,11 +8,11 @@ namespace Server.Controllers;
|
|||||||
|
|
||||||
[Route("api/tickets")]
|
[Route("api/tickets")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class TicketManagementController : ControllerBase
|
public class TicketController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly ITicketManagementService _ticketManagementService;
|
private readonly ITicketManagementService _ticketManagementService;
|
||||||
|
|
||||||
public TicketManagementController(ITicketManagementService ticketManagementService)
|
public TicketController(ITicketManagementService ticketManagementService)
|
||||||
{
|
{
|
||||||
_ticketManagementService = ticketManagementService;
|
_ticketManagementService = ticketManagementService;
|
||||||
}
|
}
|
@ -8,11 +8,11 @@ namespace Server.Controllers;
|
|||||||
|
|
||||||
[Route("api/vehicles")]
|
[Route("api/vehicles")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class VehicleManagementController : ControllerBase
|
public class VehicleController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly IVehicleManagementService _vehicleManagementService;
|
private readonly IVehicleManagementService _vehicleManagementService;
|
||||||
|
|
||||||
public VehicleManagementController(IVehicleManagementService vehicleManagementService)
|
public VehicleController(IVehicleManagementService vehicleManagementService)
|
||||||
{
|
{
|
||||||
_vehicleManagementService = vehicleManagementService;
|
_vehicleManagementService = vehicleManagementService;
|
||||||
}
|
}
|
@ -9,11 +9,11 @@ namespace Server.Controllers;
|
|||||||
|
|
||||||
[Route("api/vehicleEnrollments")]
|
[Route("api/vehicleEnrollments")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class VehicleEnrollmentManagementController : ControllerBase
|
public class VehicleEnrollmentController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly IVehicleEnrollmentManagementService _vehicleEnrollmentManagementService;
|
private readonly IVehicleEnrollmentManagementService _vehicleEnrollmentManagementService;
|
||||||
|
|
||||||
public VehicleEnrollmentManagementController(IVehicleEnrollmentManagementService vehicleEnrollmentManagementService)
|
public VehicleEnrollmentController(IVehicleEnrollmentManagementService vehicleEnrollmentManagementService)
|
||||||
{
|
{
|
||||||
_vehicleEnrollmentManagementService = vehicleEnrollmentManagementService;
|
_vehicleEnrollmentManagementService = vehicleEnrollmentManagementService;
|
||||||
}
|
}
|
@ -2,12 +2,9 @@ using System.ComponentModel.DataAnnotations;
|
|||||||
|
|
||||||
namespace SharedModels.DataTransferObjects;
|
namespace SharedModels.DataTransferObjects;
|
||||||
|
|
||||||
public class CompanyDto
|
public class CompanyDto : CreateCompanyDto
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
public string Name { get; set; } = null!;
|
|
||||||
public string OwnerId { get; set; } = null!;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CreateCompanyDto
|
public class CreateCompanyDto
|
||||||
@ -19,11 +16,8 @@ public class CreateCompanyDto
|
|||||||
public string OwnerId { get; set; } = null!;
|
public string OwnerId { get; set; } = null!;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UpdateCompanyDto
|
public class UpdateCompanyDto : CreateCompanyDto
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
public string Name { get; set; } = null!;
|
|
||||||
public string OwnerId { get; set; } = null!;
|
|
||||||
}
|
}
|
@ -2,11 +2,9 @@ using System.ComponentModel.DataAnnotations;
|
|||||||
|
|
||||||
namespace SharedModels.DataTransferObjects;
|
namespace SharedModels.DataTransferObjects;
|
||||||
|
|
||||||
public class ReviewDto
|
public class ReviewDto : CreateReviewDto
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int Rating { get; set; }
|
|
||||||
public string Comment { get; set; } = null!;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CreateReviewDto
|
public class CreateReviewDto
|
||||||
@ -24,17 +22,8 @@ public class CreateReviewDto
|
|||||||
public string Comment { get; set; } = null!;
|
public string Comment { get; set; } = null!;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UpdateReviewDto
|
public class UpdateReviewDto : CreateReviewDto
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
public string UserId { get; set; } = null!;
|
|
||||||
public int VehicleEnrollmentId { get; set; }
|
|
||||||
|
|
||||||
[Range(0,100)]
|
|
||||||
public int Rating { get; set; }
|
|
||||||
|
|
||||||
[MaxLength(255)]
|
|
||||||
public string Comment { get; set; } = null!;
|
|
||||||
}
|
}
|
@ -2,18 +2,9 @@ using System.ComponentModel.DataAnnotations;
|
|||||||
|
|
||||||
namespace SharedModels.DataTransferObjects;
|
namespace SharedModels.DataTransferObjects;
|
||||||
|
|
||||||
public class RouteAddressDto
|
public class RouteAddressDto : CreateRouteAddressDto
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int RouteId { get; set; }
|
|
||||||
public int AddressId { get; set; }
|
|
||||||
public int Order { get; set; }
|
|
||||||
[DataType(DataType.Duration)]
|
|
||||||
public TimeSpan TimeSpanToNextCity { get; set; }
|
|
||||||
[DataType(DataType.Duration)]
|
|
||||||
public TimeSpan WaitTimeSpan { get; set; }
|
|
||||||
[DataType(DataType.Currency)]
|
|
||||||
public double CostToNextCity { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CreateRouteAddressDto
|
public class CreateRouteAddressDto
|
||||||
@ -40,17 +31,18 @@ public class CreateRouteAddressDto
|
|||||||
public double CostToNextCity { get; set; }
|
public double CostToNextCity { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UpdateRouteAddressDto
|
public class UpdateRouteAddressDto : CreateRouteAddressDto
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int RouteId { get; set; }
|
}
|
||||||
|
|
||||||
|
public class InRouteRouteAddressDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
public int AddressId { get; set; }
|
public int AddressId { get; set; }
|
||||||
public int Order { get; set; }
|
public int Order { get; set; }
|
||||||
[DataType(DataType.Duration)]
|
|
||||||
public TimeSpan TimeSpanToNextCity { get; set; }
|
public TimeSpan TimeSpanToNextCity { get; set; }
|
||||||
[DataType(DataType.Duration)]
|
|
||||||
public TimeSpan WaitTimeSpan { get; set; }
|
public TimeSpan WaitTimeSpan { get; set; }
|
||||||
[DataType(DataType.Currency)]
|
|
||||||
public double CostToNextCity { get; set; }
|
public double CostToNextCity { get; set; }
|
||||||
}
|
}
|
@ -2,11 +2,11 @@ using System.ComponentModel.DataAnnotations;
|
|||||||
|
|
||||||
namespace SharedModels.DataTransferObjects;
|
namespace SharedModels.DataTransferObjects;
|
||||||
|
|
||||||
public class RouteDto
|
public class RouteDto : CreateRouteDto
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
public string Type { get; set; } = null!;
|
public virtual IList<InRouteRouteAddressDto> RouteAddresses { get; set; } = null!;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CreateRouteDto
|
public class CreateRouteDto
|
||||||
@ -15,10 +15,8 @@ public class CreateRouteDto
|
|||||||
public string Type { get; set; } = null!;
|
public string Type { get; set; } = null!;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UpdateRouteDto
|
public class UpdateRouteDto : CreateRouteDto
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
public string Type { get; set; } = null!;
|
|
||||||
}
|
}
|
@ -20,11 +20,14 @@ public class CreateTicketDto
|
|||||||
public int VehicleEnrollmentId { get; set; }
|
public int VehicleEnrollmentId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UpdateTicketDto : CreateTicketDto
|
public class UpdateTicketDto
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string? UserId { get; set; } = null!;
|
||||||
|
public int? VehicleEnrollmentId { get; set; }
|
||||||
|
|
||||||
[DataType(DataType.DateTime)]
|
[DataType(DataType.DateTime)]
|
||||||
public DateTime PurchaseDateTimeUtc { get; set; }
|
public DateTime PurchaseDateTimeUtc { get; set; }
|
||||||
public bool IsReturned { get; set; } = false;
|
public bool IsReturned { get; set; } = false;
|
||||||
|
@ -2,20 +2,9 @@ using System.ComponentModel.DataAnnotations;
|
|||||||
|
|
||||||
namespace SharedModels.DataTransferObjects;
|
namespace SharedModels.DataTransferObjects;
|
||||||
|
|
||||||
public class VehicleDto
|
public class VehicleDto : CreateVehicleDto
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string? Number { get; set; }
|
|
||||||
public string? Type { get; set; }
|
|
||||||
public int Capacity { get; set; }
|
|
||||||
public bool HasClimateControl { get; set; }
|
|
||||||
public bool HasWiFi { get; set; }
|
|
||||||
public bool HasWC { get; set; }
|
|
||||||
public bool HasStewardess { get; set; }
|
|
||||||
public bool HasTV { get; set; }
|
|
||||||
public bool HasOutlet { get; set; }
|
|
||||||
public bool HasBelts { get; set; }
|
|
||||||
public int CompanyId { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CreateVehicleDto
|
public class CreateVehicleDto
|
||||||
@ -56,23 +45,8 @@ public class CreateVehicleDto
|
|||||||
public int CompanyId { get; set; }
|
public int CompanyId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UpdateVehicleDto
|
public class UpdateVehicleDto : CreateVehicleDto
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
[MaxLength(8)]
|
|
||||||
public string? Number { get; set; }
|
|
||||||
public string? Type { get; set; }
|
|
||||||
|
|
||||||
[Range(10, 100)]
|
|
||||||
public int Capacity { get; set; }
|
|
||||||
public bool HasClimateControl { get; set; } = false;
|
|
||||||
public bool HasWiFi { get; set; } = false;
|
|
||||||
public bool HasWC { get; set; } = false;
|
|
||||||
public bool HasStewardess { get; set; } = false;
|
|
||||||
public bool HasTV { get; set; } = false;
|
|
||||||
public bool HasOutlet { get; set; } = false;
|
|
||||||
public bool HasBelts { get; set; } = false;
|
|
||||||
public int CompanyId { get; set; }
|
|
||||||
}
|
}
|
@ -2,15 +2,9 @@ using System.ComponentModel.DataAnnotations;
|
|||||||
|
|
||||||
namespace SharedModels.DataTransferObjects;
|
namespace SharedModels.DataTransferObjects;
|
||||||
|
|
||||||
public class VehicleEnrollmentDto
|
public class VehicleEnrollmentDto : CreateVehicleEnrollmentDto
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int VehicleId { get; set; }
|
|
||||||
public int RouteId { get; set; }
|
|
||||||
public DateTime DepartureDateTimeUtc { get; set; }
|
|
||||||
public TimeSpan DelayTimeSpan { get; set; }
|
|
||||||
public bool IsCanceled {get; set; }
|
|
||||||
public string CancelationComment { get; set; } = null!;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CreateVehicleEnrollmentDto
|
public class CreateVehicleEnrollmentDto
|
||||||
@ -24,21 +18,15 @@ public class CreateVehicleEnrollmentDto
|
|||||||
[Required]
|
[Required]
|
||||||
[DataType(DataType.DateTime)]
|
[DataType(DataType.DateTime)]
|
||||||
public DateTime DepartureDateTimeUtc { get; set; }
|
public DateTime DepartureDateTimeUtc { get; set; }
|
||||||
|
|
||||||
public TimeSpan DelayTimeSpan { get; set; } = TimeSpan.Zero;
|
|
||||||
|
|
||||||
public bool IsCanceled { get; set; } = false;
|
|
||||||
public string? CancelationComment { get; set; } = null!;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UpdateVehicleEnrollmentDto
|
public class UpdateVehicleEnrollmentDto : CreateVehicleEnrollmentDto
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int VehicleId { get; set; }
|
|
||||||
public int RouteId { get; set; }
|
public TimeSpan DelayTimeSpan { get; set; } = TimeSpan.Zero;
|
||||||
public DateTime DepartureDateTimeUtc { get; set; }
|
|
||||||
public TimeSpan DelayTimeSpan { get; set; }
|
public bool IsCanceled { get; set; } = false;
|
||||||
public bool IsCanceled {get; set; }
|
|
||||||
public string CancelationComment { get; set; } = null!;
|
public string CancelationComment { get; set; } = null!;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user