Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21ad138c96 | ||
|
|
1bdc909fa8 |
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"appHostPath": "../src/FiscalOS.AppHost/FiscalOS.AppHost.csproj"
|
||||||
|
}
|
||||||
@@ -21,6 +21,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FiscalOS.Infra.Tests", "tes
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FiscalOS.Core.Tests", "tests\FiscalOS.Core.Tests\FiscalOS.Core.Tests.csproj", "{2D9C02A9-C704-4275-88E9-1BBD3AC12700}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FiscalOS.Core.Tests", "tests\FiscalOS.Core.Tests\FiscalOS.Core.Tests.csproj", "{2D9C02A9-C704-4275-88E9-1BBD3AC12700}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FiscalOS.AppHost", "src\FiscalOS.AppHost\FiscalOS.AppHost.csproj", "{B7E4D089-C0EA-4DF2-B828-D5B0E5332098}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FiscalOS.ServiceDefaults", "src\FiscalOS.ServiceDefaults\FiscalOS.ServiceDefaults.csproj", "{40804CFE-50CA-4C5B-864A-672C67C6A667}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -115,6 +119,30 @@ Global
|
|||||||
{2D9C02A9-C704-4275-88E9-1BBD3AC12700}.Release|x64.Build.0 = Release|Any CPU
|
{2D9C02A9-C704-4275-88E9-1BBD3AC12700}.Release|x64.Build.0 = Release|Any CPU
|
||||||
{2D9C02A9-C704-4275-88E9-1BBD3AC12700}.Release|x86.ActiveCfg = Release|Any CPU
|
{2D9C02A9-C704-4275-88E9-1BBD3AC12700}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{2D9C02A9-C704-4275-88E9-1BBD3AC12700}.Release|x86.Build.0 = Release|Any CPU
|
{2D9C02A9-C704-4275-88E9-1BBD3AC12700}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{B7E4D089-C0EA-4DF2-B828-D5B0E5332098}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{B7E4D089-C0EA-4DF2-B828-D5B0E5332098}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{B7E4D089-C0EA-4DF2-B828-D5B0E5332098}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{B7E4D089-C0EA-4DF2-B828-D5B0E5332098}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{B7E4D089-C0EA-4DF2-B828-D5B0E5332098}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{B7E4D089-C0EA-4DF2-B828-D5B0E5332098}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{B7E4D089-C0EA-4DF2-B828-D5B0E5332098}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{B7E4D089-C0EA-4DF2-B828-D5B0E5332098}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{B7E4D089-C0EA-4DF2-B828-D5B0E5332098}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{B7E4D089-C0EA-4DF2-B828-D5B0E5332098}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{B7E4D089-C0EA-4DF2-B828-D5B0E5332098}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{B7E4D089-C0EA-4DF2-B828-D5B0E5332098}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{40804CFE-50CA-4C5B-864A-672C67C6A667}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{40804CFE-50CA-4C5B-864A-672C67C6A667}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{40804CFE-50CA-4C5B-864A-672C67C6A667}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{40804CFE-50CA-4C5B-864A-672C67C6A667}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{40804CFE-50CA-4C5B-864A-672C67C6A667}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{40804CFE-50CA-4C5B-864A-672C67C6A667}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{40804CFE-50CA-4C5B-864A-672C67C6A667}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{40804CFE-50CA-4C5B-864A-672C67C6A667}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{40804CFE-50CA-4C5B-864A-672C67C6A667}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{40804CFE-50CA-4C5B-864A-672C67C6A667}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{40804CFE-50CA-4C5B-864A-672C67C6A667}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{40804CFE-50CA-4C5B-864A-672C67C6A667}.Release|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -13,5 +13,12 @@
|
|||||||
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.2" />
|
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.2" />
|
||||||
<PackageVersion Include="Spectre.Console" Version="0.54.0" />
|
<PackageVersion Include="Spectre.Console" Version="0.54.0" />
|
||||||
<PackageVersion Include="TestableIO.System.IO.Abstractions.Wrappers" Version="22.1.0" />
|
<PackageVersion Include="TestableIO.System.IO.Abstractions.Wrappers" Version="22.1.0" />
|
||||||
|
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="10.1.0" />
|
||||||
|
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery" Version="10.1.0" />
|
||||||
|
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.14.0" />
|
||||||
|
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.14.0" />
|
||||||
|
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.14.0" />
|
||||||
|
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.14.0" />
|
||||||
|
<PackageVersion Include="OpenTelemetry.Instrumentation.Runtime" Version="1.14.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\FiscalOS.Core\FiscalOS.Core.csproj" />
|
<ProjectReference Include="..\FiscalOS.Core\FiscalOS.Core.csproj" />
|
||||||
<ProjectReference Include="..\FiscalOS.Infra\FiscalOS.Infra.csproj" />
|
<ProjectReference Include="..\FiscalOS.Infra\FiscalOS.Infra.csproj" />
|
||||||
|
<ProjectReference Include="..\FiscalOS.ServiceDefaults\FiscalOS.ServiceDefaults.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
|
using FiscalOS.ServiceDefaults;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
builder.AddServiceDefaults();
|
||||||
|
|
||||||
builder.Services.AddValidation();
|
builder.Services.AddValidation();
|
||||||
builder.Services.AddProblemDetails();
|
builder.Services.AddProblemDetails();
|
||||||
|
|
||||||
@@ -32,6 +36,8 @@ app.UseAuthentication();
|
|||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
app.UseStatusCodePages();
|
app.UseStatusCodePages();
|
||||||
|
|
||||||
|
app.MapDefaultEndpoints();
|
||||||
|
|
||||||
app.MapAuthEndpoints();
|
app.MapAuthEndpoints();
|
||||||
app.MapAccountsEndpoints();
|
app.MapAccountsEndpoints();
|
||||||
app.MapInstitutionsEndpoints();
|
app.MapInstitutionsEndpoints();
|
||||||
|
|||||||
@@ -18,6 +18,6 @@
|
|||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
var builder = DistributedApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
var api = builder.AddProject<Projects.FiscalOS_API>("API")
|
||||||
|
.WithHttpHealthCheck("/health");
|
||||||
|
|
||||||
|
builder.Build().Run();
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<Project Sdk="Aspire.AppHost.Sdk/13.1.1">
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\FiscalOS.API\FiscalOS.API.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UserSecretsId>80a27726-36cc-4a4d-a55d-11af527158bc</UserSecretsId>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||||
|
"profiles": {
|
||||||
|
"https": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": true,
|
||||||
|
"applicationUrl": "https://localhost:17104;http://localhost:15068",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
|
"DOTNET_ENVIRONMENT": "Development",
|
||||||
|
"ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21226",
|
||||||
|
"ASPIRE_DASHBOARD_MCP_ENDPOINT_URL": "https://localhost:23228",
|
||||||
|
"ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22081"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"http": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": true,
|
||||||
|
"applicationUrl": "http://localhost:15068",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
|
"DOTNET_ENVIRONMENT": "Development",
|
||||||
|
"ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19221",
|
||||||
|
"ASPIRE_DASHBOARD_MCP_ENDPOINT_URL": "http://localhost:18206",
|
||||||
|
"ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20097"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@ public static class ServiceCollectionExtensions
|
|||||||
public static IServiceCollection AddInfrastructure(this IServiceCollection services)
|
public static IServiceCollection AddInfrastructure(this IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddSingleton<IAuthorizationMiddlewareResultHandler, ProblemDetailsAuthResultHandler>();
|
services.AddSingleton<IAuthorizationMiddlewareResultHandler, ProblemDetailsAuthResultHandler>();
|
||||||
|
|
||||||
services.AddHttpClient();
|
services.AddHttpClient();
|
||||||
services.AddSingleton(TimeProvider.System);
|
services.AddSingleton(TimeProvider.System);
|
||||||
services.AddSingleton<IFileSystem, FileSystem>();
|
services.AddSingleton<IFileSystem, FileSystem>();
|
||||||
|
|||||||
@@ -1,81 +1,82 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace FiscalOS.Infra.Migrations
|
namespace FiscalOS.Infra.Migrations
|
||||||
{
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class InstitutionAndMetadata : Migration
|
||||||
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class InstitutionAndMetadata : Migration
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
migrationBuilder.CreateTable(
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
name: "Institution",
|
||||||
{
|
columns: table => new
|
||||||
migrationBuilder.CreateTable(
|
{
|
||||||
name: "Institution",
|
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||||
columns: table => new
|
UserId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||||
{
|
Name = table.Column<string>(type: "TEXT", nullable: false),
|
||||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
CreatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false),
|
||||||
UserId = table.Column<Guid>(type: "TEXT", nullable: false),
|
UpdatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false)
|
||||||
Name = table.Column<string>(type: "TEXT", nullable: false),
|
},
|
||||||
CreatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false),
|
constraints: table =>
|
||||||
UpdatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false)
|
{
|
||||||
},
|
table.PrimaryKey("PK_Institution", x => x.Id);
|
||||||
constraints: table =>
|
table.ForeignKey(
|
||||||
{
|
name: "FK_Institution_Users_UserId",
|
||||||
table.PrimaryKey("PK_Institution", x => x.Id);
|
column: x => x.UserId,
|
||||||
table.ForeignKey(
|
principalTable: "Users",
|
||||||
name: "FK_Institution_Users_UserId",
|
principalColumn: "Id",
|
||||||
column: x => x.UserId,
|
onDelete: ReferentialAction.Cascade);
|
||||||
principalTable: "Users",
|
});
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "InstitutionMetadata",
|
name: "InstitutionMetadata",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||||
Type = table.Column<string>(type: "TEXT", maxLength: 21, nullable: false),
|
Type = table.Column<string>(type: "TEXT", maxLength: 21, nullable: false),
|
||||||
InstitutionId = table.Column<Guid>(type: "TEXT", nullable: false),
|
InstitutionId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||||
PlaidId = table.Column<string>(type: "TEXT", nullable: true),
|
PlaidId = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
PlaidName = table.Column<string>(type: "TEXT", nullable: true),
|
PlaidName = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
EncryptedAccessToken = table.Column<string>(type: "TEXT", nullable: true),
|
EncryptedAccessToken = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
CreatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false),
|
CreatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false),
|
||||||
UpdatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false)
|
UpdatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_InstitutionMetadata", x => x.Id);
|
table.PrimaryKey("PK_InstitutionMetadata", x => x.Id);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_InstitutionMetadata_Institution_InstitutionId",
|
name: "FK_InstitutionMetadata_Institution_InstitutionId",
|
||||||
column: x => x.InstitutionId,
|
column: x => x.InstitutionId,
|
||||||
principalTable: "Institution",
|
principalTable: "Institution",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Institution_UserId",
|
name: "IX_Institution_UserId",
|
||||||
table: "Institution",
|
table: "Institution",
|
||||||
column: "UserId");
|
column: "UserId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_InstitutionMetadata_InstitutionId",
|
name: "IX_InstitutionMetadata_InstitutionId",
|
||||||
table: "InstitutionMetadata",
|
table: "InstitutionMetadata",
|
||||||
column: "InstitutionId",
|
column: "InstitutionId",
|
||||||
unique: true);
|
unique: true);
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "InstitutionMetadata");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Institution");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "InstitutionMetadata");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Institution");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,92 +1,93 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace FiscalOS.Infra.Migrations
|
namespace FiscalOS.Infra.Migrations
|
||||||
{
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AccountAndMetadata : Migration
|
||||||
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class AccountAndMetadata : Migration
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
migrationBuilder.CreateTable(
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
name: "Account",
|
||||||
{
|
columns: table => new
|
||||||
migrationBuilder.CreateTable(
|
{
|
||||||
name: "Account",
|
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||||
columns: table => new
|
UserId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||||
{
|
InstituionId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
Name = table.Column<string>(type: "TEXT", nullable: false),
|
||||||
UserId = table.Column<Guid>(type: "TEXT", nullable: false),
|
CreatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false),
|
||||||
InstituionId = table.Column<Guid>(type: "TEXT", nullable: false),
|
UpdatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false)
|
||||||
Name = table.Column<string>(type: "TEXT", nullable: false),
|
},
|
||||||
CreatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false),
|
constraints: table =>
|
||||||
UpdatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false)
|
{
|
||||||
},
|
table.PrimaryKey("PK_Account", x => x.Id);
|
||||||
constraints: table =>
|
table.ForeignKey(
|
||||||
{
|
name: "FK_Account_Institution_InstituionId",
|
||||||
table.PrimaryKey("PK_Account", x => x.Id);
|
column: x => x.InstituionId,
|
||||||
table.ForeignKey(
|
principalTable: "Institution",
|
||||||
name: "FK_Account_Institution_InstituionId",
|
principalColumn: "Id",
|
||||||
column: x => x.InstituionId,
|
onDelete: ReferentialAction.Cascade);
|
||||||
principalTable: "Institution",
|
table.ForeignKey(
|
||||||
principalColumn: "Id",
|
name: "FK_Account_Users_UserId",
|
||||||
onDelete: ReferentialAction.Cascade);
|
column: x => x.UserId,
|
||||||
table.ForeignKey(
|
principalTable: "Users",
|
||||||
name: "FK_Account_Users_UserId",
|
principalColumn: "Id",
|
||||||
column: x => x.UserId,
|
onDelete: ReferentialAction.Cascade);
|
||||||
principalTable: "Users",
|
});
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "AccountMetadata",
|
name: "AccountMetadata",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||||
Type = table.Column<string>(type: "TEXT", maxLength: 21, nullable: false),
|
Type = table.Column<string>(type: "TEXT", maxLength: 21, nullable: false),
|
||||||
AccountId = table.Column<Guid>(type: "TEXT", nullable: false),
|
AccountId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||||
PlaidId = table.Column<string>(type: "TEXT", nullable: true),
|
PlaidId = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
PlaidName = table.Column<string>(type: "TEXT", nullable: true),
|
PlaidName = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
CreatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false),
|
CreatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false),
|
||||||
UpdatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false)
|
UpdatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_AccountMetadata", x => x.Id);
|
table.PrimaryKey("PK_AccountMetadata", x => x.Id);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_AccountMetadata_Account_AccountId",
|
name: "FK_AccountMetadata_Account_AccountId",
|
||||||
column: x => x.AccountId,
|
column: x => x.AccountId,
|
||||||
principalTable: "Account",
|
principalTable: "Account",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Account_InstituionId",
|
name: "IX_Account_InstituionId",
|
||||||
table: "Account",
|
table: "Account",
|
||||||
column: "InstituionId");
|
column: "InstituionId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Account_UserId",
|
name: "IX_Account_UserId",
|
||||||
table: "Account",
|
table: "Account",
|
||||||
column: "UserId");
|
column: "UserId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_AccountMetadata_AccountId",
|
name: "IX_AccountMetadata_AccountId",
|
||||||
table: "AccountMetadata",
|
table: "AccountMetadata",
|
||||||
column: "AccountId",
|
column: "AccountId",
|
||||||
unique: true);
|
unique: true);
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "AccountMetadata");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Account");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "AccountMetadata");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Account");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,59 +4,59 @@
|
|||||||
|
|
||||||
namespace FiscalOS.Infra.Migrations
|
namespace FiscalOS.Infra.Migrations
|
||||||
{
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class FixAccountInstitutionColumnName : Migration
|
||||||
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class FixAccountInstitutionColumnName : Migration
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
migrationBuilder.DropForeignKey(
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
name: "FK_Account_Institution_InstituionId",
|
||||||
{
|
table: "Account");
|
||||||
migrationBuilder.DropForeignKey(
|
|
||||||
name: "FK_Account_Institution_InstituionId",
|
|
||||||
table: "Account");
|
|
||||||
|
|
||||||
migrationBuilder.RenameColumn(
|
migrationBuilder.RenameColumn(
|
||||||
name: "InstituionId",
|
name: "InstituionId",
|
||||||
table: "Account",
|
table: "Account",
|
||||||
newName: "InstitutionId");
|
newName: "InstitutionId");
|
||||||
|
|
||||||
migrationBuilder.RenameIndex(
|
migrationBuilder.RenameIndex(
|
||||||
name: "IX_Account_InstituionId",
|
name: "IX_Account_InstituionId",
|
||||||
table: "Account",
|
table: "Account",
|
||||||
newName: "IX_Account_InstitutionId");
|
newName: "IX_Account_InstitutionId");
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
migrationBuilder.AddForeignKey(
|
||||||
name: "FK_Account_Institution_InstitutionId",
|
name: "FK_Account_Institution_InstitutionId",
|
||||||
table: "Account",
|
table: "Account",
|
||||||
column: "InstitutionId",
|
column: "InstitutionId",
|
||||||
principalTable: "Institution",
|
principalTable: "Institution",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropForeignKey(
|
|
||||||
name: "FK_Account_Institution_InstitutionId",
|
|
||||||
table: "Account");
|
|
||||||
|
|
||||||
migrationBuilder.RenameColumn(
|
|
||||||
name: "InstitutionId",
|
|
||||||
table: "Account",
|
|
||||||
newName: "InstituionId");
|
|
||||||
|
|
||||||
migrationBuilder.RenameIndex(
|
|
||||||
name: "IX_Account_InstitutionId",
|
|
||||||
table: "Account",
|
|
||||||
newName: "IX_Account_InstituionId");
|
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
|
||||||
name: "FK_Account_Institution_InstituionId",
|
|
||||||
table: "Account",
|
|
||||||
column: "InstituionId",
|
|
||||||
principalTable: "Institution",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Account_Institution_InstitutionId",
|
||||||
|
table: "Account");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "InstitutionId",
|
||||||
|
table: "Account",
|
||||||
|
newName: "InstituionId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_Account_InstitutionId",
|
||||||
|
table: "Account",
|
||||||
|
newName: "IX_Account_InstituionId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Account_Institution_InstituionId",
|
||||||
|
table: "Account",
|
||||||
|
column: "InstituionId",
|
||||||
|
principalTable: "Institution",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+39
-38
@@ -1,49 +1,50 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace FiscalOS.Infra.Migrations
|
namespace FiscalOS.Infra.Migrations
|
||||||
{
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddBalancesWithConnectionToAccounts : Migration
|
||||||
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class AddBalancesWithConnectionToAccounts : Migration
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
migrationBuilder.CreateTable(
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
name: "Balance",
|
||||||
{
|
columns: table => new
|
||||||
migrationBuilder.CreateTable(
|
{
|
||||||
name: "Balance",
|
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||||
columns: table => new
|
AccountId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||||
{
|
Current = table.Column<decimal>(type: "TEXT", nullable: false),
|
||||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
Available = table.Column<decimal>(type: "TEXT", nullable: false),
|
||||||
AccountId = table.Column<Guid>(type: "TEXT", nullable: false),
|
CreatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false),
|
||||||
Current = table.Column<decimal>(type: "TEXT", nullable: false),
|
UpdatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false)
|
||||||
Available = table.Column<decimal>(type: "TEXT", nullable: false),
|
},
|
||||||
CreatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false),
|
constraints: table =>
|
||||||
UpdatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false)
|
{
|
||||||
},
|
table.PrimaryKey("PK_Balance", x => x.Id);
|
||||||
constraints: table =>
|
table.ForeignKey(
|
||||||
{
|
name: "FK_Balance_Account_AccountId",
|
||||||
table.PrimaryKey("PK_Balance", x => x.Id);
|
column: x => x.AccountId,
|
||||||
table.ForeignKey(
|
principalTable: "Account",
|
||||||
name: "FK_Balance_Account_AccountId",
|
principalColumn: "Id",
|
||||||
column: x => x.AccountId,
|
onDelete: ReferentialAction.Cascade);
|
||||||
principalTable: "Account",
|
});
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Balance_AccountId",
|
name: "IX_Balance_AccountId",
|
||||||
table: "Balance",
|
table: "Balance",
|
||||||
column: "AccountId");
|
column: "AccountId");
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Balance");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Balance");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,26 +4,26 @@
|
|||||||
|
|
||||||
namespace FiscalOS.Infra.Migrations
|
namespace FiscalOS.Infra.Migrations
|
||||||
{
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddCurrencyCodeToBalanceModel : Migration
|
||||||
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class AddCurrencyCodeToBalanceModel : Migration
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
migrationBuilder.AddColumn<string>(
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
name: "CurrencyCode",
|
||||||
{
|
table: "Balance",
|
||||||
migrationBuilder.AddColumn<string>(
|
type: "TEXT",
|
||||||
name: "CurrencyCode",
|
nullable: false,
|
||||||
table: "Balance",
|
defaultValue: "");
|
||||||
type: "TEXT",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: "");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "CurrencyCode",
|
|
||||||
table: "Balance");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "CurrencyCode",
|
||||||
|
table: "Balance");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<IsAspireSharedProject>true</IsAspireSharedProject>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||||
|
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Http.Resilience" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" />
|
||||||
|
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" />
|
||||||
|
<PackageReference Include="OpenTelemetry.Extensions.Hosting" />
|
||||||
|
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" />
|
||||||
|
<PackageReference Include="OpenTelemetry.Instrumentation.Http" />
|
||||||
|
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
namespace FiscalOS.ServiceDefaults;
|
||||||
|
|
||||||
|
public static class ServiceDefaultsExtensions
|
||||||
|
{
|
||||||
|
private const string HealthEndpointPath = "/health";
|
||||||
|
private const string AlivenessEndpointPath = "/alive";
|
||||||
|
|
||||||
|
public static TBuilder AddServiceDefaults<TBuilder>(this TBuilder builder) where TBuilder : IHostApplicationBuilder
|
||||||
|
{
|
||||||
|
builder.ConfigureOpenTelemetry();
|
||||||
|
|
||||||
|
builder.AddDefaultHealthChecks();
|
||||||
|
|
||||||
|
builder.Services.AddServiceDiscovery();
|
||||||
|
|
||||||
|
builder.Services.ConfigureHttpClientDefaults(static http =>
|
||||||
|
{
|
||||||
|
http.AddStandardResilienceHandler();
|
||||||
|
http.AddServiceDiscovery();
|
||||||
|
});
|
||||||
|
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TBuilder ConfigureOpenTelemetry<TBuilder>(this TBuilder builder) where TBuilder : IHostApplicationBuilder
|
||||||
|
{
|
||||||
|
builder.Logging.AddOpenTelemetry(logging =>
|
||||||
|
{
|
||||||
|
logging.IncludeFormattedMessage = true;
|
||||||
|
logging.IncludeScopes = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.Services.AddOpenTelemetry()
|
||||||
|
.WithMetrics(metrics => metrics.AddAspNetCoreInstrumentation()
|
||||||
|
.AddHttpClientInstrumentation()
|
||||||
|
.AddRuntimeInstrumentation()
|
||||||
|
)
|
||||||
|
.WithTracing(tracing => tracing.AddSource(builder.Environment.ApplicationName)
|
||||||
|
.AddAspNetCoreInstrumentation(tracing =>
|
||||||
|
tracing.Filter = context =>
|
||||||
|
context.Request.Path.StartsWithSegments(HealthEndpointPath, StringComparison.InvariantCultureIgnoreCase) is false &&
|
||||||
|
context.Request.Path.StartsWithSegments(AlivenessEndpointPath, StringComparison.InvariantCultureIgnoreCase) is false
|
||||||
|
)
|
||||||
|
.AddHttpClientInstrumentation()
|
||||||
|
);
|
||||||
|
|
||||||
|
builder.AddOpenTelemetryExporters();
|
||||||
|
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TBuilder AddDefaultHealthChecks<TBuilder>(this TBuilder builder) where TBuilder : IHostApplicationBuilder
|
||||||
|
{
|
||||||
|
builder.Services.AddHealthChecks()
|
||||||
|
.AddCheck("self", static () => HealthCheckResult.Healthy(), ["live"]);
|
||||||
|
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static WebApplication MapDefaultEndpoints(this WebApplication app)
|
||||||
|
{
|
||||||
|
ArgumentNullException.ThrowIfNull(app);
|
||||||
|
|
||||||
|
if (app.Environment.IsDevelopment())
|
||||||
|
{
|
||||||
|
app.MapHealthChecks(HealthEndpointPath);
|
||||||
|
|
||||||
|
app.MapHealthChecks(AlivenessEndpointPath, new HealthCheckOptions
|
||||||
|
{
|
||||||
|
Predicate = static r => r.Tags.Contains("live")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return app;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static TBuilder AddOpenTelemetryExporters<TBuilder>(this TBuilder builder) where TBuilder : IHostApplicationBuilder
|
||||||
|
{
|
||||||
|
var useOtlpExporter = !string.IsNullOrWhiteSpace(builder.Configuration["OTEL_EXPORTER_OTLP_ENDPOINT"]);
|
||||||
|
|
||||||
|
if (useOtlpExporter)
|
||||||
|
{
|
||||||
|
builder.Services.AddOpenTelemetry().UseOtlpExporter();
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
global using Microsoft.AspNetCore.Builder;
|
||||||
|
global using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||||
|
global using Microsoft.Extensions.DependencyInjection;
|
||||||
|
global using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||||
|
global using Microsoft.Extensions.Hosting;
|
||||||
|
global using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
global using OpenTelemetry;
|
||||||
|
global using OpenTelemetry.Metrics;
|
||||||
|
global using OpenTelemetry.Trace;
|
||||||
@@ -4,7 +4,7 @@ public interface ISerializableDictionary<TKey, TValue> : IDictionary<TKey, TValu
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SerializableDictionary<TKey, TValue>
|
public class SerializableDictionary<TKey, TValue>
|
||||||
: Dictionary<TKey, TValue>, ISerializableDictionary<TKey, TValue> where TKey : notnull
|
: Dictionary<TKey, TValue>, ISerializableDictionary<TKey, TValue> where TKey : notnull
|
||||||
{
|
{
|
||||||
public SerializableDictionary() { }
|
public SerializableDictionary() { }
|
||||||
|
|||||||
Reference in New Issue
Block a user