Repository navigation
feat: Add portfolio edit and delete API routes and frontend UI #64
Description
Problem
PortfolioStorage has updatePortfolio and deletePortfolio methods, and portfolioDb has the corresponding SQL operations. However, no API routes expose these capabilities.
The routes.ts file defines POST /portfolio, GET /user/:address/portfolios, GET /portfolio/:id, and POST /portfolio/:id/rebalance but has no PUT /portfolio/:id or DELETE /portfolio/:id.
On the frontend, Dashboard.tsx has no edit or delete buttons, and PortfolioSetup.tsx is create-only. Users have no way to modify allocations, change the rebalance threshold, or remove a portfolio once created.
Proposed Fix
1. Add API routes
// PUT /portfolio/:id — update allocations, threshold
// DELETE /portfolio/:id — remove portfolioBoth routes should be protected by rate limiter and ownership check (verify userAddress matches the authenticated user).
2. Add Zod schemas
Create updatePortfolioSchema in validation.ts for partial updates.
3. Add frontend UI
- Edit button in
Dashboard.tsxthat opens a modal pre-filled with current allocations - Delete button with a confirmation dialog
- Reuse existing
PortfolioSetupform logic for the edit modal
Files to modify
backend/src/api/routes.ts— addPUTandDELETEroutesbackend/src/api/validation.ts— addupdatePortfolioSchemafrontend/src/components/Dashboard.tsx— add edit/delete UIfrontend/src/config/api.ts— add new endpoint constantsbackend/src/api/__tests__/routes.test.ts— add route tests
Acceptance Criteria
-
PUT /portfolio/:idaccepts partial updates, validates, returns updated portfolio -
DELETE /portfolio/:idremoves portfolio, returns 204 - Both routes protected by rate limiter and ownership check
- Frontend edit button opens modal with current allocations pre-filled
- Frontend delete button shows confirmation dialog
- Test:
PUT /portfolio/:idwith valid data returns updated portfolio - Test:
DELETE /portfolio/:idreturns 204 - Test: edit/delete by non-owner returns 403
- Test: edit/delete non-existent portfolio returns 404
Affected Area
Backend and Frontend
Activity
ijeoma270 commentedon Aug 22, 2026
Please assign this to me
grantfox-oss commentedon Aug 22, 2026
🦊 GrantFox — @ijeoma270 has been assigned to this issue as part of the Third Campaign campaign!
Next steps:
Closes #64)Good luck! Track your progress on GrantFox.
grantfox-oss commentedon Aug 22, 2026
🎉 This issue has been marked as completed on GrantFox as part of the Third Campaign campaign!
@ijeoma270's PR #68 was approved and merged by @Uchechukwu-Ekezie.
🏆 @ijeoma270: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (602 total points). Track your full progress on GrantFox.
👏 Great work, @ijeoma270! Keep contributing to grantFoxin.