Split the backend into API host, Domain, Application and Infrastructure projects. Add Swagger/OpenAPI per API version, Asp.Versioning (query/header), ProblemDetails with a global exception handler and SurrealQL migrations applied at startup (namespace/database ensured). Infrastructure owns the SurrealDB client, settings and DI.
30 lines
912 B
C#
30 lines
912 B
C#
using Asp.Versioning.ApiExplorer;
|
|
using Microsoft.Extensions.Options;
|
|
using Microsoft.OpenApi;
|
|
using Swashbuckle.AspNetCore.SwaggerGen;
|
|
|
|
namespace TarninaHub.Configuration;
|
|
|
|
public sealed class ConfigureSwaggerOptions : IConfigureOptions<SwaggerGenOptions>
|
|
{
|
|
private readonly IApiVersionDescriptionProvider _provider;
|
|
|
|
public ConfigureSwaggerOptions(IApiVersionDescriptionProvider provider)
|
|
{
|
|
_provider = provider;
|
|
}
|
|
|
|
public void Configure(SwaggerGenOptions options)
|
|
{
|
|
foreach (var description in _provider.ApiVersionDescriptions)
|
|
{
|
|
options.SwaggerDoc(description.GroupName, new OpenApiInfo
|
|
{
|
|
Title = "TarninaHub API",
|
|
Version = description.ApiVersion.ToString(),
|
|
Description = "Backend API (BFF) for TarninaHub — Małopolski Hub Innowacji Społecznych.",
|
|
});
|
|
}
|
|
}
|
|
}
|