feat(backend): restructure API into layers with OpenAPI, versioning and error handling
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.
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
namespace TarninaHub.Infrastructure.Settings;
|
||||
|
||||
public static class SurrealDbEndpoint
|
||||
{
|
||||
/// <summary>
|
||||
/// Builds the SurrealDB endpoint. Remote mode uses the configured URL;
|
||||
/// embedded mode uses the RocksDB provider persisted to the data directory
|
||||
/// (forward slashes, so the same endpoint works on Windows and Linux).
|
||||
/// </summary>
|
||||
public static string Build(SurrealDbSettings settings)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(settings.RemoteUrl))
|
||||
{
|
||||
return settings.RemoteUrl;
|
||||
}
|
||||
|
||||
var dataDirectory = Path.Combine(AppContext.BaseDirectory, settings.DataDirectory);
|
||||
|
||||
return $"rocksdb://{dataDirectory.Replace('\\', '/')}";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user