refactor(api): consume bank operation oneOf contract (WealthLedger/frontend#144) (#152)
Frontend verify / commits (push) Skipped
Frontend verify / security (push) Successful in 10s
Frontend verify / verify (push) Failing after 8m20s

This commit was merged in pull request #152.
This commit is contained in:
2026-11-04 20:47:51 +03:00
parent 5077bd4f0b
commit 2d070ce2b5
3 changed files with 321 additions and 100 deletions
@@ -120,11 +120,52 @@ const useOperationFormVm = (props: OperationFormProps) => {
body: { ...body, version },
id: props.operation.id,
});
else
await operationCreation.mutateAsync({
else {
const base = {
amount: body.amount,
cardId: values.cardId,
date: values.date,
description: values.description,
id: intent,
...body,
});
};
switch (values.kind) {
case "expense": {
await operationCreation.mutateAsync({
...base,
categoryId: values.categoryId || defaultCategoryId,
kind: values.kind,
});
break;
}
case "refund": {
await operationCreation.mutateAsync({
...base,
kind: values.kind,
originalExpenseId: values.originalExpenseId,
});
break;
}
case "topup": {
await operationCreation.mutateAsync({
...base,
kind: values.kind,
});
break;
}
case "transfer": {
await operationCreation.mutateAsync({
...base,
kind: values.kind,
targetCardId: values.targetCardId,
});
break;
}
}
}
notifications.show({
id: "bank-operation-saved-" + actionId,