feat: added estimate fixed expenses
All checks were successful
Deploy / deploy (push) Successful in 1m26s
Security Tests / security-non-db (push) Successful in 20s
Security Tests / security-db (push) Successful in 22s

This commit is contained in:
2026-03-02 10:49:12 -06:00
parent e0313df24b
commit 301b3f8967
7 changed files with 583 additions and 6 deletions

View File

@@ -11,6 +11,8 @@ export type NewPlan = {
name: string;
totalCents: number; // >= 0
fundedCents?: number; // optional, default 0
amountMode?: "fixed" | "estimated";
estimatedCents?: number | null;
priority: number; // int
dueOn: string; // ISO date
frequency?: "one-time" | "weekly" | "biweekly" | "monthly";
@@ -21,6 +23,20 @@ export type NewPlan = {
};
export type UpdatePlan = Partial<NewPlan>;
export type TrueUpActualResult = {
ok: boolean;
planId: string;
amountMode: "estimated";
previousTargetCents: number;
actualCents: number;
deltaCents: number;
autoPulledCents: number;
refundedCents: number;
remainingShortfallCents: number;
fundedCents: number;
totalCents: number;
};
export const fixedPlansApi = {
create: (body: NewPlan) => apiPost<{ id: string }>("/fixed-plans", body),
update: (id: string, body: UpdatePlan) =>
@@ -90,4 +106,6 @@ export const fixedPlansApi = {
availableBudget?: number;
message: string;
}>(`/fixed-plans/${id}/catch-up-funding`, {}),
trueUpActual: (id: string, body: { actualCents: number }) =>
apiPost<TrueUpActualResult>(`/fixed-plans/${id}/true-up-actual`, body),
};