Summary
Today a new user signs up with a 0 balance and there is no way to add funds — the only money movement is a transfer between existing users (src/routes/WalletRoutes.js). Add a deposit endpoint that credits the authenticated user's wallet, plus a small "Add funds" UI, so a fresh account can actually start using the app. This is mock funding (no real payment processor) — it simulates a top-up for demo purposes and must be clearly labeled as such.
Scope
Likely files
src/routes/WalletRoutes.js (new POST /wallet/deposit)
src/services/WalletService.js (a deposit function, reusing the atomic update + transaction-record flow)
src/models/Transaction.js (record the deposit as an incoming entry)
src/middleware/ (amount validation, reuse ValidateTransfer's rules)
frontend/src/pages/Dashboard.jsx (an "Add funds" button on the hero tile)
frontend/src/services/api.js (a deposit call)
- optionally
frontend/src/components/ui.jsx (reuse the modal/confirm surface)
Acceptance criteria
- Authenticated
POST /wallet/deposit credits the caller's wallet by a validated amount
- Amount is validated server-side: positive, numeric, rounded to 2 decimals, with a sane upper cap
- A transaction record is created so the deposit shows in the transactions list
- Works in both Postgres and local-JSON storage modes
- Frontend exposes an "Add funds" action that updates the balance counter on success
- UI clearly labels this as demo / mock funding (no real money)
- Identity comes from the JWT, never from the request body
Verification
- Sign up a fresh account ($0), add funds, and confirm the balance and transactions list update
- Send a non-positive / NaN / oversized amount and confirm a 4xx with a clear message
- Confirm the deposit appears as an incoming transaction in both storage modes
Labels: backend, frontend, enhancement, help wanted
Summary
Today a new user signs up with a
0balance and there is no way to add funds — the only money movement is a transfer between existing users (src/routes/WalletRoutes.js). Add a deposit endpoint that credits the authenticated user's wallet, plus a small "Add funds" UI, so a fresh account can actually start using the app. This is mock funding (no real payment processor) — it simulates a top-up for demo purposes and must be clearly labeled as such.Scope
Likely files
src/routes/WalletRoutes.js(newPOST /wallet/deposit)src/services/WalletService.js(adepositfunction, reusing the atomic update + transaction-record flow)src/models/Transaction.js(record the deposit as an incoming entry)src/middleware/(amount validation, reuseValidateTransfer's rules)frontend/src/pages/Dashboard.jsx(an "Add funds" button on the hero tile)frontend/src/services/api.js(adepositcall)frontend/src/components/ui.jsx(reuse the modal/confirm surface)Acceptance criteria
POST /wallet/depositcredits the caller's wallet by a validated amountVerification
Labels:
backend,frontend,enhancement,help wanted