feat: update account handling in add endpoint and tests

This commit is contained in:
Stevan Freeborn
2026-03-09 04:29:01 -05:00
parent 3866030eae
commit 62a7dde443
4 changed files with 12 additions and 4 deletions
+4 -1
View File
@@ -1,3 +1,5 @@
using Account = FiscalOS.Core.Accounts.Account;
namespace FiscalOS.API.Accounts.Add;
internal static class Endpoint
@@ -59,8 +61,9 @@ internal static class Endpoint
var decryptedAccessToken = await encryptor.DecryptAsyncFor(user, plaidInstitutionMetadata.EncryptedAccessToken, ct);
var accountMetadata = PlaidAccountMetadata.From(request.PlaidAccountId, request.PlaidAccountName);
var account = Account.From(user.Institutions.First().Id, request.PlaidAccountName, accountMetadata);
var account = Account.From(request.PlaidAccountName, accountMetadata);
user.AddAccount(account);
user.Institutions.First().AddAccount(account);
await appDbContext.SaveChangesAsync(ct);
await queue.EnqueueAsync(new(plaidInstitutionMetadata.ItemId), ct);
@@ -1,3 +1,5 @@
using Institution = FiscalOS.Core.Accounts.Institution;
namespace FiscalOS.API.Institutions.Connect;
internal static class Endpoint
@@ -1,3 +1,6 @@
using Account = FiscalOS.Core.Accounts.Account;
using Institution = FiscalOS.Core.Accounts.Institution;
namespace FiscalOS.API.Institutions.Get;
internal sealed record Response