feat(core): add models for account

This commit is contained in:
Stevan Freeborn
2026-02-13 12:33:37 -06:00
parent 1a41c3c0b6
commit 23823a4c23
3 changed files with 45 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
namespace FiscalOS.Core.Accounts;
public sealed class Account : Entity
{
public Guid UserId { get; init; }
public Guid InstituionId { get; init; }
public Institution Institution { get; init; } = null!;
public string Name { get; init; } = string.Empty;
public AccountMetadata Metadata { get; init; } = null!;
public static Account From(Guid institutionId, string name, AccountMetadata accountMetadata)
{
return new()
{
InstituionId = institutionId,
Name = name,
Metadata = accountMetadata,
};
}
}
@@ -0,0 +1,15 @@
namespace FiscalOS.Core.Accounts;
public abstract class AccountMetadata : Entity
{
private readonly string _type;
public string Type => _type;
public Guid AccountId { get; init; }
protected AccountMetadata(string type)
{
_type = type;
}
}
+10
View File
@@ -13,6 +13,9 @@ public sealed class User : Entity
private readonly List<Institution> _institutions = []; private readonly List<Institution> _institutions = [];
public IEnumerable<Institution> Institutions => _institutions; public IEnumerable<Institution> Institutions => _institutions;
private readonly List<Account> _accounts = [];
public IEnumerable<Account> Accounts => _accounts;
private User() private User()
{ {
} }
@@ -50,4 +53,11 @@ public sealed class User : Entity
_institutions.Add(institution); _institutions.Add(institution);
} }
public void AddAccount(Account account)
{
ArgumentNullException.ThrowIfNull(account, nameof(account));
_accounts.Add(account);
}
} }