Problem / Motivation
Currently, the app only supports adding new contributions via the Add Contribution wizard. If a user makes a mistake (e.g., wrong amount, wrong scope, or wrong date), they cannot edit the contribution and must delete and recreate it. We need the ability to modify an existing contribution, reusing the existing wizard flow just as we do for expenses and groups.
Proposed Solution
We need to refactor the current Add Contribution wizard to support both creation and editing.
- Domain Layer:
- Ensure there is an
UpdateContributionUseCase available in :domain to handle modifying the record.
- Presentation Layer (
:features:contributions):
- Update the navigation route/graph to accept an optional
contributionId argument (e.g., Route.ContributionWizard(groupId: String, contributionId: String?)).
- Refactor
AddContributionFeature, AddContributionViewModel, and related state classes (possibly renaming to AddEditContribution... or ContributionWizard... to match convention).
- If
contributionId is provided, load the existing contribution data upon ViewModel initialization and pre-fill the wizard state.
- Update the submit handler: if a
contributionId is present, invoke the update use case; otherwise, invoke the add use case.
- Update
AddContributionUiMapper.kt and the top app bar to display appropriate titles (e.g., "Edit Contribution" vs. "Add Contribution") based on the mode.
Acceptance Criteria
Out of Scope
- Modifying paired contributions that were generated automatically from an expense (these should be edited via the parent expense instead).
Related Issues / PRs
Problem / Motivation
Currently, the app only supports adding new contributions via the Add Contribution wizard. If a user makes a mistake (e.g., wrong amount, wrong scope, or wrong date), they cannot edit the contribution and must delete and recreate it. We need the ability to modify an existing contribution, reusing the existing wizard flow just as we do for expenses and groups.
Proposed Solution
We need to refactor the current Add Contribution wizard to support both creation and editing.
UpdateContributionUseCaseavailable in:domainto handle modifying the record.:features:contributions):contributionIdargument (e.g.,Route.ContributionWizard(groupId: String, contributionId: String?)).AddContributionFeature,AddContributionViewModel, and related state classes (possibly renaming toAddEditContribution...orContributionWizard...to match convention).contributionIdis provided, load the existing contribution data upon ViewModel initialization and pre-fill the wizard state.contributionIdis present, invoke the update use case; otherwise, invoke the add use case.AddContributionUiMapper.ktand the top app bar to display appropriate titles (e.g., "Edit Contribution" vs. "Add Contribution") based on the mode.Acceptance Criteria
contributionId.contributionIdis passed, the wizard pre-fills with the existing contribution's data (amount, scope, date, etc.).contributionId) continues to work as before.make fast-checkpasses during iterative development (~15–30s).make check > build.log 2>&1 && echo "Check passed successfully" || (tail -n 100 build.log && exit 1)passes with 0 failures before merging.Out of Scope
Related Issues / PRs