mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-11 02:20:20 +08:00
Merge branch 'develop'
This commit is contained in:
commit
3a0c0edfe1
@ -6,6 +6,7 @@ using MediatR;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
public record CreateBookingRequestDto(Guid PassengerId, Guid FlightId, string Description);
|
||||
@ -18,10 +19,10 @@ public class CreateBookingEndpoint : IMinimalEndpoint
|
||||
builder.MapPost($"{EndpointConfig.BaseApiPath}/booking", CreateBooking)
|
||||
.RequireAuthorization()
|
||||
.WithName("CreateBooking")
|
||||
.WithMetadata(new SwaggerOperationAttribute("Create Booking", "Create Booking"))
|
||||
.WithApiVersionSet(builder.NewApiVersionSet("Booking").Build())
|
||||
.Produces<CreateBookingResponseDto>()
|
||||
.ProducesProblem(StatusCodes.Status400BadRequest)
|
||||
.WithOpenApi(operation => new OpenApiOperation(operation) { Summary = "Create Booking", Description = "Create Booking" })
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
return builder;
|
||||
|
||||
@ -9,6 +9,7 @@ using MediatR;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
public record CreateAircraftRequestDto(string Name, string Model, int ManufacturingYear);
|
||||
@ -21,10 +22,10 @@ public class CreateAircraftEndpoint : IMinimalEndpoint
|
||||
builder.MapPost($"{EndpointConfig.BaseApiPath}/flight/aircraft", CreateAircraft)
|
||||
.RequireAuthorization()
|
||||
.WithName("CreateAircraft")
|
||||
.WithMetadata(new SwaggerOperationAttribute("Create Aircraft", "Create Aircraft"))
|
||||
.WithApiVersionSet(builder.NewApiVersionSet("Flight").Build())
|
||||
.Produces<CreateAircraftResponseDto>()
|
||||
.ProducesProblem(StatusCodes.Status400BadRequest)
|
||||
.WithOpenApi(operation => new OpenApiOperation(operation) { Summary = "Create Aircraft", Description = "Create Aircraft" })
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
return builder;
|
||||
|
||||
@ -9,6 +9,7 @@ using MediatR;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
public record CreateAirportRequestDto(string Name, string Address, string Code);
|
||||
@ -21,10 +22,10 @@ public class CreateAirportEndpoint : IMinimalEndpoint
|
||||
builder.MapPost($"{EndpointConfig.BaseApiPath}/flight/airport", CreateAirport)
|
||||
.RequireAuthorization()
|
||||
.WithName("CreateAirport")
|
||||
.WithMetadata(new SwaggerOperationAttribute("Create Airport", "Create Airport"))
|
||||
.WithApiVersionSet(builder.NewApiVersionSet("Flight").Build())
|
||||
.Produces<CreateAirportResponseDto>()
|
||||
.ProducesProblem(StatusCodes.Status400BadRequest)
|
||||
.WithOpenApi(operation => new OpenApiOperation(operation) { Summary = "Create Airport", Description = "Create Airport" })
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
return builder;
|
||||
|
||||
@ -9,6 +9,7 @@ using MediatR;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
public record CreateFlightRequestDto(string FlightNumber, Guid AircraftId, Guid DepartureAirportId,
|
||||
@ -24,10 +25,10 @@ public class CreateFlightEndpoint : IMinimalEndpoint
|
||||
builder.MapPost($"{EndpointConfig.BaseApiPath}/flight", CreateFlight)
|
||||
.RequireAuthorization()
|
||||
.WithName("CreateFlight")
|
||||
.WithMetadata(new SwaggerOperationAttribute("Create Flight", "Create Flight"))
|
||||
.WithApiVersionSet(builder.NewApiVersionSet("Flight").Build())
|
||||
.Produces<CreateFlightResponseDto>(StatusCodes.Status201Created)
|
||||
.ProducesProblem(StatusCodes.Status400BadRequest)
|
||||
.WithOpenApi(operation => new OpenApiOperation(operation) { Summary = "Create Flight", Description = "Create Flight" })
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
return builder;
|
||||
@ -42,6 +43,6 @@ public class CreateFlightEndpoint : IMinimalEndpoint
|
||||
|
||||
var response = new CreateFlightResponseDto(result.Id);
|
||||
|
||||
return Results.CreatedAtRoute("GetFlightById", new {id = result.Id}, response);
|
||||
return Results.CreatedAtRoute("GetFlightById", new { id = result.Id }, response);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ using MediatR;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
public class DeleteFlightEndpoint : IMinimalEndpoint
|
||||
@ -17,10 +18,10 @@ public class DeleteFlightEndpoint : IMinimalEndpoint
|
||||
builder.MapDelete($"{EndpointConfig.BaseApiPath}/flight/{{id}}", DeleteFlight)
|
||||
.RequireAuthorization()
|
||||
.WithName("DeleteFlight")
|
||||
.WithMetadata(new SwaggerOperationAttribute("Delete Flight", "Delete Flight"))
|
||||
.WithApiVersionSet(builder.NewApiVersionSet("Flight").Build())
|
||||
.Produces(StatusCodes.Status204NoContent)
|
||||
.ProducesProblem(StatusCodes.Status400BadRequest)
|
||||
.WithOpenApi(operation => new OpenApiOperation(operation) { Summary = "Delete Flight", Description = "Delete Flight" })
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
return builder;
|
||||
|
||||
@ -9,6 +9,7 @@ using MediatR;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
public record GetAvailableFlightsResponseDto(IEnumerable<FlightDto> FlightDtos);
|
||||
@ -20,10 +21,10 @@ public class GetAvailableFlightsEndpoint : IMinimalEndpoint
|
||||
builder.MapGet($"{EndpointConfig.BaseApiPath}/flight/get-available-flights", GetAvailableFlights)
|
||||
.RequireAuthorization()
|
||||
.WithName("GetAvailableFlights")
|
||||
.WithMetadata(new SwaggerOperationAttribute("Get Available Flights", "Get Available Flights"))
|
||||
.WithApiVersionSet(builder.NewApiVersionSet("Flight").Build())
|
||||
.Produces<GetAvailableFlightsResponseDto>()
|
||||
.ProducesProblem(StatusCodes.Status400BadRequest)
|
||||
.WithOpenApi(operation => new OpenApiOperation(operation) { Summary = "Get Available Flights", Description = "Get Available Flights" })
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
return builder;
|
||||
|
||||
@ -9,6 +9,7 @@ using MediatR;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
public record GetFlightByIdResponseDto(FlightDto FlightDto);
|
||||
@ -20,10 +21,10 @@ public class GetFlightByIdEndpoint : IMinimalEndpoint
|
||||
builder.MapGet($"{EndpointConfig.BaseApiPath}/flight/{{id}}", GetById)
|
||||
.RequireAuthorization()
|
||||
.WithName("GetFlightById")
|
||||
.WithMetadata(new SwaggerOperationAttribute("Get Flight By Id", "Get Flight By Id"))
|
||||
.WithApiVersionSet(builder.NewApiVersionSet("Flight").Build())
|
||||
.Produces<GetFlightByIdResponseDto>()
|
||||
.ProducesProblem(StatusCodes.Status400BadRequest)
|
||||
.WithOpenApi(operation => new OpenApiOperation(operation) { Summary = "Get Flight By Id", Description = "Get Flight By Id" })
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
return builder;
|
||||
|
||||
@ -9,6 +9,7 @@ using MediatR;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
public record UpdateFlightRequestDto(Guid Id, string FlightNumber, Guid AircraftId, Guid DepartureAirportId, DateTime DepartureDate, DateTime ArriveDate,
|
||||
@ -21,10 +22,10 @@ public class UpdateFlightEndpoint : IMinimalEndpoint
|
||||
builder.MapPut($"{EndpointConfig.BaseApiPath}/flight", UpdateFlight)
|
||||
.RequireAuthorization()
|
||||
.WithName("UpdateFlight")
|
||||
.WithMetadata(new SwaggerOperationAttribute("Update Flight", "Update Flight"))
|
||||
.WithApiVersionSet(builder.NewApiVersionSet("Flight").Build())
|
||||
.Produces(StatusCodes.Status204NoContent)
|
||||
.ProducesProblem(StatusCodes.Status400BadRequest)
|
||||
.WithOpenApi(operation => new OpenApiOperation(operation) { Summary = "Update Flight", Description = "Update Flight" })
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
return builder;
|
||||
|
||||
@ -9,6 +9,7 @@ using MediatR;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
public record CreateSeatRequestDto(string SeatNumber, Enums.SeatType Type, Enums.SeatClass Class, Guid FlightId);
|
||||
@ -21,10 +22,10 @@ public class CreateSeatEndpoint : IMinimalEndpoint
|
||||
builder.MapPost($"{EndpointConfig.BaseApiPath}/flight/seat", CreateSeat)
|
||||
.RequireAuthorization()
|
||||
.WithName("CreateSeat")
|
||||
.WithMetadata(new SwaggerOperationAttribute("Create Seat", "Create Seat"))
|
||||
.WithApiVersionSet(builder.NewApiVersionSet("Flight").Build())
|
||||
.Produces<CreateSeatResponseDto>()
|
||||
.ProducesProblem(StatusCodes.Status400BadRequest)
|
||||
.WithOpenApi(operation => new OpenApiOperation(operation) { Summary = "Create Seat", Description = "Create Seat" })
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
return builder;
|
||||
|
||||
@ -10,6 +10,7 @@ using MediatR;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
public record GetAvailableSeatsResponseDto(IEnumerable<SeatDto> SeatDtos);
|
||||
@ -21,10 +22,10 @@ public class GetAvailableSeatsEndpoint : IMinimalEndpoint
|
||||
builder.MapGet($"{EndpointConfig.BaseApiPath}/flight/get-available-seats/{{id}}", GetAvailableSeats)
|
||||
.RequireAuthorization()
|
||||
.WithName("GetAvailableSeats")
|
||||
.WithMetadata(new SwaggerOperationAttribute("Get Available Seats", "Get Available Seats"))
|
||||
.WithApiVersionSet(builder.NewApiVersionSet("Flight").Build())
|
||||
.Produces<GetAvailableSeatsResponseDto>()
|
||||
.ProducesProblem(StatusCodes.Status400BadRequest)
|
||||
.WithOpenApi(operation => new OpenApiOperation(operation) { Summary = "Get Available Seats", Description = "Get Available Seats" })
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
return builder;
|
||||
|
||||
@ -9,6 +9,7 @@ using MediatR;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
public record ReserveSeatRequestDto(Guid FlightId, string SeatNumber);
|
||||
@ -21,10 +22,10 @@ public class ReserveSeatEndpoint : IMinimalEndpoint
|
||||
builder.MapPost($"{EndpointConfig.BaseApiPath}/flight/reserve-seat", ReserveSeat)
|
||||
.RequireAuthorization()
|
||||
.WithName("ReserveSeat")
|
||||
.WithMetadata(new SwaggerOperationAttribute("Reserve Seat", "Reserve Seat"))
|
||||
.WithApiVersionSet(builder.NewApiVersionSet("Flight").Build())
|
||||
.Produces<ReserveSeatResponseDto>()
|
||||
.ProducesProblem(StatusCodes.Status400BadRequest)
|
||||
.WithOpenApi(operation => new OpenApiOperation(operation) { Summary = "Reserve Seat", Description = "Reserve Seat" })
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
return builder;
|
||||
|
||||
@ -9,6 +9,7 @@ using MediatR;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
public record RegisterNewUserRequestDto(string FirstName, string LastName, string Username, string Email,
|
||||
@ -22,10 +23,10 @@ public class RegisterNewUserEndpoint : IMinimalEndpoint
|
||||
{
|
||||
builder.MapPost($"{EndpointConfig.BaseApiPath}/identity/register-user", RegisterNewUser)
|
||||
.WithName("RegisterUser")
|
||||
.WithMetadata(new SwaggerOperationAttribute("Register User", "Register User"))
|
||||
.WithApiVersionSet(builder.NewApiVersionSet("Identity").Build())
|
||||
.Produces<RegisterNewUserResponseDto>()
|
||||
.ProducesProblem(StatusCodes.Status400BadRequest)
|
||||
.WithOpenApi(operation => new OpenApiOperation(operation) { Summary = "Register User", Description = "Register User" })
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
return builder;
|
||||
|
||||
@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Dtos;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using Microsoft.OpenApi.Models;
|
||||
|
||||
public record CompleteRegisterPassengerRequestDto(string PassportNumber, Enums.PassengerType PassengerType, int Age);
|
||||
public record CompleteRegisterPassengerResponseDto(PassengerDto PassengerDto);
|
||||
@ -19,10 +19,10 @@ public class CompleteRegisterPassengerEndpoint : IMinimalEndpoint
|
||||
builder.MapPost($"{EndpointConfig.BaseApiPath}/passenger/complete-registration", CompleteRegisterPassenger)
|
||||
.RequireAuthorization()
|
||||
.WithName("CompleteRegisterPassenger")
|
||||
.WithMetadata(new SwaggerOperationAttribute("Complete Register Passenger", "Complete Register Passenger"))
|
||||
.WithApiVersionSet(builder.NewApiVersionSet("Passenger").Build())
|
||||
.Produces<CompleteRegisterPassengerResponseDto>()
|
||||
.ProducesProblem(StatusCodes.Status400BadRequest)
|
||||
.WithOpenApi(operation => new OpenApiOperation(operation) { Summary = "Complete Register Passenger", Description = "Complete Register Passenger" })
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
return builder;
|
||||
|
||||
@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Dtos;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
public record GetPassengerByIdResponseDto(PassengerDto PassengerDto);
|
||||
@ -17,10 +18,10 @@ public class GetPassengerByIdEndpoint : IMinimalEndpoint
|
||||
builder.MapGet($"{EndpointConfig.BaseApiPath}/passenger/{{id}}", GetById)
|
||||
.RequireAuthorization()
|
||||
.WithName("GetPassengerById")
|
||||
.WithMetadata(new SwaggerOperationAttribute("Get Passenger By Id", "Get Passenger By Id"))
|
||||
.WithApiVersionSet(builder.NewApiVersionSet("Passenger").Build())
|
||||
.Produces<GetPassengerByIdResponseDto>()
|
||||
.ProducesProblem(StatusCodes.Status400BadRequest)
|
||||
.WithOpenApi(operation => new OpenApiOperation(operation) { Summary = "Get Passenger By Id", Description = "Get Passenger By Id" })
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
return builder;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user