From f3fe1ea1467f0baf4fefe9fd952ff9ffd47fa3a9 Mon Sep 17 00:00:00 2001 From: Spencer Twaddle <7374698+stwaddle@users.noreply.github.com> Date: Sun, 3 May 2026 07:20:19 -0500 Subject: [PATCH] Removed tax settings --- .../Controllers/BudgetsController.cs | 8 +- .../Controllers/SummaryController.cs | 44 +-- src/Budget.Client/src/api/summary.ts | 15 +- src/Budget.Client/src/pages/SettingsPage.tsx | 51 +--- src/Budget.Client/src/schemas/index.ts | 6 - src/Budget.Client/src/types/index.ts | 6 - src/Budget.Core/DTOs/BudgetDtos.cs | 2 +- src/Budget.Core/DTOs/SummaryDtos.cs | 9 +- src/Budget.Core/Models/Budget.cs | 1 - .../Data/AppDbContext.cs | 1 - ...3121617_RemoveEffectiveTaxRate.Designer.cs | 265 ++++++++++++++++++ .../20260503121617_RemoveEffectiveTaxRate.cs | 31 ++ .../Migrations/AppDbContextModelSnapshot.cs | 4 - update-budget-site.ps1 | 2 +- 14 files changed, 319 insertions(+), 126 deletions(-) create mode 100644 src/Budget.Infrastructure/Data/Migrations/20260503121617_RemoveEffectiveTaxRate.Designer.cs create mode 100644 src/Budget.Infrastructure/Data/Migrations/20260503121617_RemoveEffectiveTaxRate.cs diff --git a/src/Budget.Api/Controllers/BudgetsController.cs b/src/Budget.Api/Controllers/BudgetsController.cs index 89d6340..496031e 100644 --- a/src/Budget.Api/Controllers/BudgetsController.cs +++ b/src/Budget.Api/Controllers/BudgetsController.cs @@ -31,7 +31,7 @@ public class BudgetsController(AppDbContext db, BudgetAuthorizationService authz var budgets = await db.Budgets .Where(b => b.OwnerUserId == userId || b.Shares.Any(s => s.SharedWithUserId == userId && !s.IsPending)) - .Select(b => new BudgetDto(b.Id, b.Name, b.EffectiveTaxRate, b.CreatedAt, b.UpdatedAt)) + .Select(b => new BudgetDto(b.Id, b.Name, b.CreatedAt, b.UpdatedAt)) .ToListAsync(); return Ok(budgets); } @@ -52,7 +52,7 @@ public class BudgetsController(AppDbContext db, BudgetAuthorizationService authz db.Budgets.Add(budget); await db.SaveChangesAsync(); return CreatedAtAction(nameof(Get), new { id = budget.Id }, - new BudgetDto(budget.Id, budget.Name, budget.EffectiveTaxRate, budget.CreatedAt, budget.UpdatedAt)); + new BudgetDto(budget.Id, budget.Name, budget.CreatedAt, budget.UpdatedAt)); } [HttpGet("{id:guid}")] @@ -62,7 +62,7 @@ public class BudgetsController(AppDbContext db, BudgetAuthorizationService authz if (!await authz.CanReadAsync(id, userId)) return Forbid(); var b = await db.Budgets.FindAsync(id); if (b is null) return NotFound(); - return Ok(new BudgetDto(b.Id, b.Name, b.EffectiveTaxRate, b.CreatedAt, b.UpdatedAt)); + return Ok(new BudgetDto(b.Id, b.Name, b.CreatedAt, b.UpdatedAt)); } [HttpPut("{id:guid}")] @@ -83,7 +83,7 @@ public class BudgetsController(AppDbContext db, BudgetAuthorizationService authz { return Conflict(new { error = "The budget was modified by another user. Please refresh and retry." }); } - return Ok(new BudgetDto(b.Id, b.Name, b.EffectiveTaxRate, b.CreatedAt, b.UpdatedAt)); + return Ok(new BudgetDto(b.Id, b.Name, b.CreatedAt, b.UpdatedAt)); } [HttpDelete("{id:guid}")] diff --git a/src/Budget.Api/Controllers/SummaryController.cs b/src/Budget.Api/Controllers/SummaryController.cs index 95f2f67..d749213 100644 --- a/src/Budget.Api/Controllers/SummaryController.cs +++ b/src/Budget.Api/Controllers/SummaryController.cs @@ -6,7 +6,6 @@ using Budget.Infrastructure.Data; using Budget.Infrastructure.Services; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.RateLimiting; using Microsoft.EntityFrameworkCore; namespace Budget.Api.Controllers; @@ -34,10 +33,10 @@ public class SummaryController(AppDbContext db, BudgetAuthorizationService authz if (budget is null) return NotFound(); var incomes = await db.Incomes.Where(i => i.BudgetId == budgetId).ToListAsync(); - var outgos = await db.Outgos.Where(o => o.BudgetId == budgetId).ToListAsync(); + var outgos = await db.Outgos.Where(o => o.BudgetId == budgetId).ToListAsync(); var monthlyIncome = incomes.Sum(i => FrequencyCalculator.ToMonthly(i.Amount, i.Frequency)); - var annualIncome = monthlyIncome * 12m; + var annualIncome = monthlyIncome * 12m; var typeTargets = new Dictionary { @@ -51,43 +50,20 @@ public class SummaryController(AppDbContext db, BudgetAuthorizationService authz foreach (var (type, target) in typeTargets) { - var typeOutgos = outgos.Where(o => o.Type == type).ToList(); - var monthlyTotal = typeOutgos.Sum(o => FrequencyCalculator.ToMonthly(o.Amount, o.Frequency)); - var annualTotal = monthlyTotal * 12m; + var typeOutgos = outgos.Where(o => o.Type == type).ToList(); + var monthlyTotal = typeOutgos.Sum(o => FrequencyCalculator.ToMonthly(o.Amount, o.Frequency)); + var annualTotal = monthlyTotal * 12m; totalMonthlyOutgo += monthlyTotal; - var percent = monthlyIncome > 0 ? Math.Round(monthlyTotal / monthlyIncome * 100, 2) : 0m; - var maxAmount = monthlyIncome * target / 100m; - var remaining = maxAmount - monthlyTotal; + var percent = monthlyIncome > 0 ? Math.Round(monthlyTotal / monthlyIncome * 100, 2) : 0m; + var maxAmount = monthlyIncome * target / 100m; + var remaining = maxAmount - monthlyTotal; breakdown.Add(new SummaryBreakdownItem(type.ToString(), target, monthlyTotal, annualTotal, percent, maxAmount, remaining)); } - var unspent = monthlyIncome - totalMonthlyOutgo; + var unspent = monthlyIncome - totalMonthlyOutgo; var unspentPercent = monthlyIncome > 0 ? Math.Round(unspent / monthlyIncome * 100, 2) : 0m; breakdown.Add(new SummaryBreakdownItem("Unspent", null, unspent, unspent * 12m, unspentPercent, null, null)); - var annualOutgoTotal = totalMonthlyOutgo * 12m; - var minimumAnnualGross = budget.EffectiveTaxRate < 1m - ? annualOutgoTotal / (1m - budget.EffectiveTaxRate) - : 0m; - - return Ok(new SummaryDto( - monthlyIncome, - annualIncome, - breakdown, - new PreTaxIncomeDto(budget.EffectiveTaxRate, minimumAnnualGross, minimumAnnualGross / 12m))); - } - - [HttpPut("tax-rate")] - [EnableRateLimiting("writes")] - public async Task UpdateTaxRate(Guid budgetId, [FromBody] UpdateTaxRateRequest req) - { - if (TryGetUserId(out var userId) is { } err) return err; - if (!await authz.CanWriteAsync(budgetId, userId)) return Forbid(); - var budget = await db.Budgets.FindAsync(budgetId); - if (budget is null) return NotFound(); - budget.EffectiveTaxRate = req.EffectiveTaxRate; - budget.UpdatedAt = DateTimeOffset.UtcNow; - await db.SaveChangesAsync(); - return NoContent(); + return Ok(new SummaryDto(monthlyIncome, annualIncome, breakdown)); } } diff --git a/src/Budget.Client/src/api/summary.ts b/src/Budget.Client/src/api/summary.ts index 0d81bf4..a15a29c 100644 --- a/src/Budget.Client/src/api/summary.ts +++ b/src/Budget.Client/src/api/summary.ts @@ -1,4 +1,4 @@ -import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'; +import { useQuery } from '@tanstack/react-query'; import { api } from './client'; import type { SummaryDto } from '../types/index'; @@ -8,16 +8,3 @@ export function useSummary(budgetId: string) { queryFn: () => api.get(`/api/budgets/${budgetId}/summary`), }); } - -export function useUpdateTaxRate(budgetId: string) { - const qc = useQueryClient(); - return useMutation({ - mutationFn: (effectiveTaxRate: number) => - api.put(`/api/budgets/${budgetId}/summary/tax-rate`, { effectiveTaxRate }), - onSuccess: () => { - qc.invalidateQueries({ queryKey: ['budgets', budgetId, 'summary'] }); - qc.invalidateQueries({ queryKey: ['budgets', budgetId] }); - }, - meta: { successMessage: 'Tax rate saved', errorMessage: 'Failed to save tax rate' }, - }); -} diff --git a/src/Budget.Client/src/pages/SettingsPage.tsx b/src/Budget.Client/src/pages/SettingsPage.tsx index fb42b05..f106cf7 100644 --- a/src/Budget.Client/src/pages/SettingsPage.tsx +++ b/src/Budget.Client/src/pages/SettingsPage.tsx @@ -6,14 +6,11 @@ import type { SharePermission } from '../types/index'; import { Trash2 } from 'lucide-react'; import { BudgetNav } from '../components/BudgetNav'; import { useBudget, useUpdateBudget } from '../api/budgets'; -import { useUpdateTaxRate } from '../api/summary'; import { useShares, useAddShare, useUpdateShare, useRevokeShare } from '../api/shares'; import { createBudgetSchema, - updateTaxRateSchema, createShareSchema, type CreateBudgetInput, - type UpdateTaxRateInput, type CreateShareInput, } from '../schemas/index'; @@ -23,8 +20,7 @@ export function SettingsPage() { const { data: shares = [] } = useShares(budgetId!); const updateBudget = useUpdateBudget(budgetId!); - const updateTaxRate = useUpdateTaxRate(budgetId!); - const addShare = useAddShare(budgetId!); + const addShare = useAddShare(budgetId!); const updateShare = useUpdateShare(budgetId!); const revokeShare = useRevokeShare(budgetId!); @@ -33,31 +29,19 @@ export function SettingsPage() { defaultValues: { name: '' }, }); - const taxForm = useForm({ - resolver: zodResolver(updateTaxRateSchema), - defaultValues: { effectiveTaxRate: 0 }, - }); - const shareForm = useForm({ resolver: zodResolver(createShareSchema), defaultValues: { email: '', permission: 'View' }, }); useEffect(() => { - if (budget) { - renameForm.reset({ name: budget.name }); - taxForm.reset({ effectiveTaxRate: Math.round(budget.effectiveTaxRate * 100) }); - } + if (budget) renameForm.reset({ name: budget.name }); }, [budget]); // eslint-disable-line react-hooks/exhaustive-deps const onRename = async (data: CreateBudgetInput) => { await updateBudget.mutateAsync({ name: data.name }); }; - const onSaveTaxRate = async (data: UpdateTaxRateInput) => { - await updateTaxRate.mutateAsync(data.effectiveTaxRate / 100); - }; - const onAddShare = async (data: CreateShareInput) => { await addShare.mutateAsync({ email: data.email, permission: data.permission }); shareForm.reset({ email: '', permission: 'View' }); @@ -90,33 +74,6 @@ export function SettingsPage() { -
-
Effective Tax Rate
-
-
- - - -
- {taxForm.formState.errors.effectiveTaxRate && ( - {taxForm.formState.errors.effectiveTaxRate.message} - )} -
-
-
Sharing
@@ -150,7 +107,9 @@ export function SettingsPage() { : Active} - + ))} diff --git a/src/Budget.Client/src/schemas/index.ts b/src/Budget.Client/src/schemas/index.ts index f682831..8b1338c 100644 --- a/src/Budget.Client/src/schemas/index.ts +++ b/src/Budget.Client/src/schemas/index.ts @@ -38,13 +38,7 @@ export const createShareSchema = z.object({ permission: z.enum(['View', 'Edit']), }); -// UI shows percent (0-99); callers divide by 100 before sending to API -export const updateTaxRateSchema = z.object({ - effectiveTaxRate: z.number().min(0, 'Must be ≥ 0').max(99, 'Must be less than 100'), -}); - export type CreateBudgetInput = z.infer; export type CreateIncomeInput = z.infer; export type CreateOutgoInput = z.infer; export type CreateShareInput = z.infer; -export type UpdateTaxRateInput = z.infer; diff --git a/src/Budget.Client/src/types/index.ts b/src/Budget.Client/src/types/index.ts index 186dbe3..6a0ec5c 100644 --- a/src/Budget.Client/src/types/index.ts +++ b/src/Budget.Client/src/types/index.ts @@ -43,7 +43,6 @@ export interface OutgoDto { export interface BudgetDto { id: string; name: string; - effectiveTaxRate: number; createdAt: string; updatedAt: string; } @@ -70,9 +69,4 @@ export interface SummaryDto { monthlyIncome: number; annualIncome: number; breakdown: SummaryBreakdownItem[]; - preTaxIncome: { - effectiveTaxRate: number; - minimumAnnualGross: number; - minimumMonthlyGross: number; - }; } diff --git a/src/Budget.Core/DTOs/BudgetDtos.cs b/src/Budget.Core/DTOs/BudgetDtos.cs index 4b91d53..b9576c1 100644 --- a/src/Budget.Core/DTOs/BudgetDtos.cs +++ b/src/Budget.Core/DTOs/BudgetDtos.cs @@ -2,7 +2,7 @@ using System.ComponentModel.DataAnnotations; namespace Budget.Core.DTOs; -public record BudgetDto(Guid Id, string Name, decimal EffectiveTaxRate, DateTimeOffset CreatedAt, DateTimeOffset UpdatedAt); +public record BudgetDto(Guid Id, string Name, DateTimeOffset CreatedAt, DateTimeOffset UpdatedAt); public record CreateBudgetRequest([Required][MaxLength(200)] string Name); diff --git a/src/Budget.Core/DTOs/SummaryDtos.cs b/src/Budget.Core/DTOs/SummaryDtos.cs index 6ba8e00..63dab1e 100644 --- a/src/Budget.Core/DTOs/SummaryDtos.cs +++ b/src/Budget.Core/DTOs/SummaryDtos.cs @@ -9,14 +9,7 @@ public record SummaryBreakdownItem( decimal? MaxAmount, decimal? Remaining); -public record PreTaxIncomeDto(decimal EffectiveTaxRate, decimal MinimumAnnualGross, decimal MinimumMonthlyGross); - public record SummaryDto( decimal MonthlyIncome, decimal AnnualIncome, - List Breakdown, - PreTaxIncomeDto PreTaxIncome); - -public record UpdateTaxRateRequest( - [System.ComponentModel.DataAnnotations.Range(0.0, 0.9999, ErrorMessage = "Effective tax rate must be between 0 and 0.9999.")] - decimal EffectiveTaxRate); + List Breakdown); diff --git a/src/Budget.Core/Models/Budget.cs b/src/Budget.Core/Models/Budget.cs index ca6640f..57d864a 100644 --- a/src/Budget.Core/Models/Budget.cs +++ b/src/Budget.Core/Models/Budget.cs @@ -5,7 +5,6 @@ public class Budget : ISoftDeletable public Guid Id { get; set; } public required string Name { get; set; } public required string OwnerUserId { get; set; } - public decimal EffectiveTaxRate { get; set; } = 0.25m; public DateTimeOffset CreatedAt { get; set; } public DateTimeOffset UpdatedAt { get; set; } public bool IsDeleted { get; set; } diff --git a/src/Budget.Infrastructure/Data/AppDbContext.cs b/src/Budget.Infrastructure/Data/AppDbContext.cs index 65ab97b..6ee45df 100644 --- a/src/Budget.Infrastructure/Data/AppDbContext.cs +++ b/src/Budget.Infrastructure/Data/AppDbContext.cs @@ -18,7 +18,6 @@ public class AppDbContext(DbContextOptions options) : DbContext(op b.HasKey(x => x.Id); b.Property(x => x.Name).IsRequired().HasMaxLength(200); b.Property(x => x.OwnerUserId).IsRequired().HasMaxLength(200); - b.Property(x => x.EffectiveTaxRate).HasPrecision(5, 4); b.HasMany(x => x.Incomes).WithOne(i => i.Budget).HasForeignKey(i => i.BudgetId).OnDelete(DeleteBehavior.Cascade); b.HasMany(x => x.Outgos).WithOne(o => o.Budget).HasForeignKey(o => o.BudgetId).OnDelete(DeleteBehavior.Cascade); b.HasMany(x => x.Shares).WithOne(s => s.Budget).HasForeignKey(s => s.BudgetId).OnDelete(DeleteBehavior.Cascade); diff --git a/src/Budget.Infrastructure/Data/Migrations/20260503121617_RemoveEffectiveTaxRate.Designer.cs b/src/Budget.Infrastructure/Data/Migrations/20260503121617_RemoveEffectiveTaxRate.Designer.cs new file mode 100644 index 0000000..05647b2 --- /dev/null +++ b/src/Budget.Infrastructure/Data/Migrations/20260503121617_RemoveEffectiveTaxRate.Designer.cs @@ -0,0 +1,265 @@ +// +using System; +using Budget.Infrastructure.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Budget.Infrastructure.Data.Migrations +{ + [DbContext(typeof(AppDbContext))] + [Migration("20260503121617_RemoveEffectiveTaxRate")] + partial class RemoveEffectiveTaxRate + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "10.0.7") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Budget.Core.Models.Budget", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("OwnerUserId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("xmin") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.HasKey("Id"); + + b.ToTable("Budgets"); + }); + + modelBuilder.Entity("Budget.Core.Models.BudgetShare", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("BudgetId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("IsPending") + .HasColumnType("boolean"); + + b.Property("Permission") + .HasColumnType("integer"); + + b.Property("SharedWithEmail") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("SharedWithUserId") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("Id"); + + b.HasIndex("BudgetId", "SharedWithEmail") + .IsUnique(); + + b.ToTable("BudgetShares"); + }); + + modelBuilder.Entity("Budget.Core.Models.Income", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("numeric(18,2)"); + + b.Property("BudgetId") + .HasColumnType("uuid"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Frequency") + .HasColumnType("integer"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("SortOrder") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("BudgetId"); + + b.ToTable("Incomes"); + }); + + modelBuilder.Entity("Budget.Core.Models.KnownUser", b => + { + b.Property("Id") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("LastSeenAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("Id"); + + b.ToTable("KnownUsers"); + }); + + modelBuilder.Entity("Budget.Core.Models.Outgo", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Amount") + .HasPrecision(18, 2) + .HasColumnType("numeric(18,2)"); + + b.Property("BudgetId") + .HasColumnType("uuid"); + + b.Property("Category") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Frequency") + .HasColumnType("integer"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("PaymentSource") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("SortOrder") + .HasColumnType("integer"); + + b.Property("Type") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("BudgetId"); + + b.ToTable("Outgos"); + }); + + modelBuilder.Entity("Budget.Core.Models.BudgetShare", b => + { + b.HasOne("Budget.Core.Models.Budget", "Budget") + .WithMany("Shares") + .HasForeignKey("BudgetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Budget"); + }); + + modelBuilder.Entity("Budget.Core.Models.Income", b => + { + b.HasOne("Budget.Core.Models.Budget", "Budget") + .WithMany("Incomes") + .HasForeignKey("BudgetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Budget"); + }); + + modelBuilder.Entity("Budget.Core.Models.Outgo", b => + { + b.HasOne("Budget.Core.Models.Budget", "Budget") + .WithMany("Outgos") + .HasForeignKey("BudgetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Budget"); + }); + + modelBuilder.Entity("Budget.Core.Models.Budget", b => + { + b.Navigation("Incomes"); + + b.Navigation("Outgos"); + + b.Navigation("Shares"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Budget.Infrastructure/Data/Migrations/20260503121617_RemoveEffectiveTaxRate.cs b/src/Budget.Infrastructure/Data/Migrations/20260503121617_RemoveEffectiveTaxRate.cs new file mode 100644 index 0000000..2a6676b --- /dev/null +++ b/src/Budget.Infrastructure/Data/Migrations/20260503121617_RemoveEffectiveTaxRate.cs @@ -0,0 +1,31 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Budget.Infrastructure.Data.Migrations +{ + /// + public partial class RemoveEffectiveTaxRate : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "EffectiveTaxRate", + table: "Budgets"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "EffectiveTaxRate", + table: "Budgets", + type: "numeric(5,4)", + precision: 5, + scale: 4, + nullable: false, + defaultValue: 0m); + } + } +} diff --git a/src/Budget.Infrastructure/Data/Migrations/AppDbContextModelSnapshot.cs b/src/Budget.Infrastructure/Data/Migrations/AppDbContextModelSnapshot.cs index 57c2f6f..f6b280c 100644 --- a/src/Budget.Infrastructure/Data/Migrations/AppDbContextModelSnapshot.cs +++ b/src/Budget.Infrastructure/Data/Migrations/AppDbContextModelSnapshot.cs @@ -34,10 +34,6 @@ namespace Budget.Infrastructure.Data.Migrations b.Property("DeletedAt") .HasColumnType("timestamp with time zone"); - b.Property("EffectiveTaxRate") - .HasPrecision(5, 4) - .HasColumnType("numeric(5,4)"); - b.Property("IsDeleted") .HasColumnType("boolean"); diff --git a/update-budget-site.ps1 b/update-budget-site.ps1 index 380bfd1..a75cd2f 100644 --- a/update-budget-site.ps1 +++ b/update-budget-site.ps1 @@ -2,4 +2,4 @@ $image = "docker.stwaddle.com/budget:latest" docker build -t $image . if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } docker push $image -ssh stwaddle_com "./stwaddlecom/update-budget.sh" \ No newline at end of file +ssh stwaddle_com "cd stwaddlecom; ./update-budget.sh" \ No newline at end of file