Split into Budget.Core / Budget.Infrastructure / Budget.Api projects
Budget.Core: entities, DTOs, enums, FrequencyCalculator (no EF/ASP.NET deps) Budget.Infrastructure: AppDbContext, migrations, BudgetAuthorizationService Budget.Api: controllers, middleware, Program.cs — references both projects EF and Npgsql packages moved to Infrastructure; Api retains only JwtBearer, HealthChecks, and EF.Design (needed for dotnet ef CLI). Dockerfile updated to copy all three project directories before publishing. Migration namespaces updated from Budget.Api.Data.* to Budget.Infrastructure.Data.* and model type strings updated to Budget.Core.Models.* in the snapshot. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using Budget.Core.Models;
|
||||
|
||||
namespace Budget.Core.Services;
|
||||
|
||||
public static class FrequencyCalculator
|
||||
{
|
||||
public static decimal ToMonthly(decimal amount, Frequency frequency) => frequency switch
|
||||
{
|
||||
Frequency.Biennial => amount / 24m,
|
||||
Frequency.Annually => amount / 12m,
|
||||
Frequency.Biannually => amount * 2m / 12m,
|
||||
Frequency.Quarterly => amount * 4m / 12m,
|
||||
Frequency.EveryTwoMonths => amount * 6m / 12m,
|
||||
Frequency.Monthly => amount,
|
||||
Frequency.SemiMonthly => amount * 2m,
|
||||
Frequency.Biweekly => amount * 26m / 12m,
|
||||
Frequency.Weekly => amount * 52m / 12m,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(frequency)),
|
||||
};
|
||||
|
||||
public static decimal ToAnnually(decimal amount, Frequency frequency) =>
|
||||
ToMonthly(amount, frequency) * 12m;
|
||||
}
|
||||
Reference in New Issue
Block a user