-
Notifications
You must be signed in to change notification settings - Fork 21
feat: Add portfolio edit and delete API routes and frontend UI #64
Copy link
Copy link
Closed
Labels
GrantFox OSSIssue tracked in GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third CampaignCampaign: Third CampaignbackendBackend relatedBackend relatedenhancementNew feature or requestNew feature or requestfrontendFrontend UIFrontend UIhelp wantedExtra attention is neededExtra attention is needed
Description
Activity
Metadata
Metadata
Assignees
Labels
GrantFox OSSIssue tracked in GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third CampaignCampaign: Third CampaignbackendBackend relatedBackend relatedenhancementNew feature or requestNew feature or requestfrontendFrontend UIFrontend UIhelp wantedExtra attention is neededExtra attention is needed
Problem
PortfolioStoragehasupdatePortfolioanddeletePortfoliomethods, andportfolioDbhas the corresponding SQL operations. However, no API routes expose these capabilities.The
routes.tsfile definesPOST /portfolio,GET /user/:address/portfolios,GET /portfolio/:id, andPOST /portfolio/:id/rebalancebut has noPUT /portfolio/:idorDELETE /portfolio/:id.On the frontend,
Dashboard.tsxhas no edit or delete buttons, andPortfolioSetup.tsxis 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
Both routes should be protected by rate limiter and ownership check (verify
userAddressmatches the authenticated user).2. Add Zod schemas
Create
updatePortfolioSchemainvalidation.tsfor partial updates.3. Add frontend UI
Dashboard.tsxthat opens a modal pre-filled with current allocationsPortfolioSetupform logic for the edit modalFiles 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 testsAcceptance Criteria
PUT /portfolio/:idaccepts partial updates, validates, returns updated portfolioDELETE /portfolio/:idremoves portfolio, returns 204PUT /portfolio/:idwith valid data returns updated portfolioDELETE /portfolio/:idreturns 204Affected Area
Backend and Frontend