Added a-frame-architecture usiung wolverine sample.

This commit is contained in:
2026-08-03 17:08:18 +02:00
parent 1b5bf4f8d4
commit 61fe59cf83
72 changed files with 3012 additions and 0 deletions
@@ -0,0 +1,53 @@
using FinancialApi.Domain.Exceptions;
namespace FinancialApi.Domain.Entities;
public enum AccountType
{
Spend,
Borrow,
Revenue
}
public record Account
{
public Account(int Id, decimal Balance, AccountType Type)
{
this.Id = Id;
this.Balance = Balance;
this.Type = Type;
if (Balance < 0 && Type is AccountType.Spend or AccountType.Revenue)
{
throw new InvalidStartingBalanceException("Insufficient funds.");
}
}
public Account ApplyPosting(decimal amount, EntryType entryType)
{
if (amount <= 0)
{
throw new ArgumentException("Amount must be positive.");
}
var newBalance = entryType == EntryType.Credit ? Balance + amount : Balance - amount;
if (newBalance < 0 && Type is AccountType.Spend or AccountType.Revenue)
{
throw new InsufficientFundsException("Insufficient funds.");
}
return this with { Balance = newBalance };
}
public int Id { get; init; }
public decimal Balance { get; init; }
public AccountType Type { get; init; }
public void Deconstruct(out int Id, out decimal Balance, out AccountType Type)
{
Id = this.Id;
Balance = this.Balance;
Type = this.Type;
}
}