test run for user rebalance expenses feature, added safeguard for estimate exepenses acceptance in onboarding
This commit is contained in:
@@ -11,8 +11,6 @@ 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";
|
||||
|
||||
26
web/src/api/rebalance.ts
Normal file
26
web/src/api/rebalance.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { apiGet, apiPost } from "./http";
|
||||
|
||||
export type RebalanceCategory = {
|
||||
id: string;
|
||||
name: string;
|
||||
percent: number;
|
||||
isSavings: boolean;
|
||||
balanceCents: number;
|
||||
};
|
||||
|
||||
export type RebalanceInfo = {
|
||||
ok: boolean;
|
||||
availableCents: number;
|
||||
categories: RebalanceCategory[];
|
||||
};
|
||||
|
||||
export type ManualRebalanceBody = {
|
||||
targets: Array<{ id: string; targetCents: number }>;
|
||||
forceLowerSavings?: boolean;
|
||||
};
|
||||
|
||||
export const rebalanceApi = {
|
||||
fetchInfo: () => apiGet<RebalanceInfo>("/variable-categories/manual-rebalance"),
|
||||
submit: (body: ManualRebalanceBody) =>
|
||||
apiPost<RebalanceInfo>("/variable-categories/manual-rebalance", body),
|
||||
};
|
||||
Reference in New Issue
Block a user