feat: added estimate fixed expenses
This commit is contained in:
@@ -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),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user