mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-16 07:26:25 +08:00
refactor
This commit is contained in:
parent
285fb3c129
commit
18f4d417a9
@ -8,13 +8,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"identity": {
|
||||
"destinations": {
|
||||
"destination1": {
|
||||
"address": "http://identity"
|
||||
}
|
||||
}
|
||||
},
|
||||
"passenger": {
|
||||
"destinations": {
|
||||
"destination1": {
|
||||
|
||||
@ -12,46 +12,26 @@
|
||||
"identity": {
|
||||
"clusterId": "identity",
|
||||
"match": {
|
||||
"path": "{**catch-all}"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"pathPattern": "{**catch-all}"
|
||||
}
|
||||
]
|
||||
"path": "/{**catch-all}"
|
||||
}
|
||||
},
|
||||
"flight": {
|
||||
"clusterId": "flight",
|
||||
"match": {
|
||||
"path": "api/{version}/flight/{**catch-all}"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"pathPattern": "api/{version}/flight/{**catch-all}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"passenger": {
|
||||
"clusterId": "passenger",
|
||||
"match": {
|
||||
"path": "api/{version}/passenger/{**catch-all}"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"pathPattern": "api/{version}/passenger/{**catch-all}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"booking": {
|
||||
"clusterId": "booking",
|
||||
"match": {
|
||||
"path": "api/{version}/booking/{**catch-all}"
|
||||
},
|
||||
"transforms": [
|
||||
{
|
||||
"pathPattern": "api/{version}/booking/{**catch-all}"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"clusters": {
|
||||
|
||||
@ -81,22 +81,22 @@
|
||||
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="7.0.0" />
|
||||
<PackageReference Include="AspNetCore.HealthChecks.MongoDb" Version="6.0.2" />
|
||||
<PackageReference Include="System.Interactive.Async" Version="6.0.1" />
|
||||
<PackageReference Include="MassTransit" Version="8.0.8" />
|
||||
<PackageReference Include="MassTransit.RabbitMQ" Version="8.0.8" />
|
||||
<PackageReference Include="MassTransit" Version="8.0.9-develop.658" />
|
||||
<PackageReference Include="MassTransit.RabbitMQ" Version="8.0.9-develop.658" />
|
||||
<PackageReference Include="DotNetCore.CAP" Version="6.2.1" />
|
||||
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="6.2.1" />
|
||||
<PackageReference Include="DotNetCore.CAP.MongoDB" Version="6.2.1" />
|
||||
<PackageReference Include="DotNetCore.CAP.OpenTelemetry" Version="6.2.1" />
|
||||
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="6.2.1" />
|
||||
<PackageReference Include="DotNetCore.CAP.SqlServer" Version="6.2.1" />
|
||||
<PackageReference Include="Duende.IdentityServer" Version="6.1.7" />
|
||||
<PackageReference Include="Duende.IdentityServer.AspNetIdentity" Version="6.1.7" />
|
||||
<PackageReference Include="Duende.IdentityServer.EntityFramework" Version="6.1.7" />
|
||||
<PackageReference Include="Duende.IdentityServer.EntityFramework.Storage" Version="6.1.7" />
|
||||
<PackageReference Include="Duende.IdentityServer" Version="6.2.0-rc.1" />
|
||||
<PackageReference Include="Duende.IdentityServer.AspNetIdentity" Version="6.2.0-rc.1" />
|
||||
<PackageReference Include="Duende.IdentityServer.EntityFramework" Version="6.2.0-rc.1" />
|
||||
<PackageReference Include="Duende.IdentityServer.EntityFramework.Storage" Version="6.2.0-rc.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.0" />
|
||||
<PackageReference Include="Testcontainers" Version="2.2.0" />
|
||||
<PackageReference Include="Yarp.ReverseProxy" Version="1.1.1" />
|
||||
<PackageReference Include="Microsoft.Identity.Web" Version="1.25.5" />
|
||||
<PackageReference Include="Microsoft.Identity.Web" Version="2.0.5-preview" />
|
||||
|
||||
<PackageReference Include="Jaeger" Version="1.0.3" />
|
||||
<PackageReference Include="OpenTracing" Version="0.12.1" />
|
||||
|
||||
@ -34,26 +34,6 @@ public static class ServiceCollectionExtensions
|
||||
var xmlFile = XmlCommentsFilePath(assembly);
|
||||
if (File.Exists(xmlFile)) options.IncludeXmlComments(xmlFile);
|
||||
|
||||
options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
|
||||
{
|
||||
Description = @"JWT Authorization header using the Bearer scheme. \r\n\r\n
|
||||
Enter 'Bearer' [space] and then your token in the text input below.
|
||||
\r\n\r\nExample: 'Bearer 12345abcdef'",
|
||||
Name = "Authorization",
|
||||
In = ParameterLocation.Header,
|
||||
Type = SecuritySchemeType.ApiKey,
|
||||
Scheme = "Bearer"
|
||||
});
|
||||
|
||||
options.AddSecurityDefinition(
|
||||
HeaderName,
|
||||
new OpenApiSecurityScheme
|
||||
{
|
||||
Description = "Api key needed to access the endpoints. X-Api-Key: My_API_Key",
|
||||
In = ParameterLocation.Header,
|
||||
Name = HeaderName,
|
||||
Type = SecuritySchemeType.ApiKey
|
||||
});
|
||||
|
||||
options.AddSecurityRequirement(new OpenApiSecurityRequirement
|
||||
{
|
||||
@ -66,19 +46,6 @@ public static class ServiceCollectionExtensions
|
||||
In = ParameterLocation.Header
|
||||
},
|
||||
new List<string>()
|
||||
},
|
||||
{
|
||||
new OpenApiSecurityScheme
|
||||
{
|
||||
Name = HeaderName,
|
||||
Type = SecuritySchemeType.ApiKey,
|
||||
In = ParameterLocation.Header,
|
||||
Reference = new OpenApiReference
|
||||
{
|
||||
Type = ReferenceType.SecurityScheme, Id = HeaderName
|
||||
}
|
||||
},
|
||||
Array.Empty<string>()
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.2" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
||||
@ -5,7 +5,7 @@ namespace Flight.Aircrafts.Features.CreateAircraft.Exceptions;
|
||||
|
||||
public class AircraftAlreadyExistException : AppException
|
||||
{
|
||||
public AircraftAlreadyExistException() : base("Flight already exist!", HttpStatusCode.Conflict)
|
||||
public AircraftAlreadyExistException() : base("Aircraft already exist!", HttpStatusCode.Conflict)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.2" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
||||
@ -15,7 +15,6 @@ using Identity;
|
||||
using Identity.Data;
|
||||
using Identity.Data.Seed;
|
||||
using Identity.Extensions;
|
||||
using Microsoft.AspNetCore.Mvc.ApiExplorer;
|
||||
using Prometheus;
|
||||
using Serilog;
|
||||
|
||||
|
||||
@ -11,6 +11,10 @@
|
||||
"UserName": "guest",
|
||||
"Password": "guest"
|
||||
},
|
||||
"Jwt": {
|
||||
"Authority": "https://localhost:5005",
|
||||
"Audience": "identity-api"
|
||||
},
|
||||
"LogOptions": {
|
||||
"Level": "information",
|
||||
"LogTemplate": "{Timestamp:HH:mm:ss} [{Level:u4}] {Message:lj}{NewLine}{Exception}",
|
||||
|
||||
@ -24,7 +24,8 @@ public static class Config
|
||||
{
|
||||
new(Constants.StandardScopes.FlightApi),
|
||||
new(Constants.StandardScopes.PassengerApi),
|
||||
new(Constants.StandardScopes.BookingApi)
|
||||
new(Constants.StandardScopes.BookingApi),
|
||||
new(Constants.StandardScopes.IdentityApi)
|
||||
};
|
||||
|
||||
|
||||
@ -33,7 +34,8 @@ public static class Config
|
||||
{
|
||||
new(Constants.StandardScopes.FlightApi),
|
||||
new(Constants.StandardScopes.PassengerApi),
|
||||
new(Constants.StandardScopes.BookingApi)
|
||||
new(Constants.StandardScopes.BookingApi),
|
||||
new(Constants.StandardScopes.IdentityApi)
|
||||
};
|
||||
|
||||
public static IEnumerable<Client> Clients =>
|
||||
@ -56,7 +58,8 @@ public static class Config
|
||||
IdentityServerConstants.StandardScopes.Profile,
|
||||
Constants.StandardScopes.FlightApi,
|
||||
Constants.StandardScopes.PassengerApi,
|
||||
Constants.StandardScopes.BookingApi
|
||||
Constants.StandardScopes.BookingApi,
|
||||
new(Constants.StandardScopes.IdentityApi)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -14,5 +14,6 @@ public static class Constants
|
||||
public const string FlightApi = "flight-api";
|
||||
public const string PassengerApi = "passenger-api";
|
||||
public const string BookingApi = "booking-api";
|
||||
public const string IdentityApi = "identity-api";
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,6 @@ using Identity.Identity.Features.RegisterNewUser.Commands.V1;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
@ -17,7 +16,6 @@ public class RegisterNewUserEndpoint : IMinimalEndpoint
|
||||
public IEndpointRouteBuilder MapEndpoint(IEndpointRouteBuilder endpoints)
|
||||
{
|
||||
endpoints.MapPost($"{EndpointConfig.BaseApiPath}/identity/register-user", RegisterNewUser)
|
||||
.RequireAuthorization()
|
||||
.WithTags("Identity")
|
||||
.WithName("Register User")
|
||||
.WithMetadata(new SwaggerOperationAttribute("Register User", "Register User"))
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.2" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.2" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user