Skip to content

feat: Add portfolio edit and delete API routes and frontend UI #64

Closed

Description

@grantfox-oss

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 portfolio

Both 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.tsx that opens a modal pre-filled with current allocations
  • Delete button with a confirmation dialog
  • Reuse existing PortfolioSetup form logic for the edit modal

Files to modify

  • backend/src/api/routes.ts — add PUT and DELETE routes
  • backend/src/api/validation.ts — add updatePortfolioSchema
  • frontend/src/components/Dashboard.tsx — add edit/delete UI
  • frontend/src/config/api.ts — add new endpoint constants
  • backend/src/api/__tests__/routes.test.ts — add route tests

Acceptance Criteria

  • PUT /portfolio/:id accepts partial updates, validates, returns updated portfolio
  • DELETE /portfolio/:id removes 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/:id with valid data returns updated portfolio
  • Test: DELETE /portfolio/:id returns 204
  • Test: edit/delete by non-owner returns 403
  • Test: edit/delete non-existent portfolio returns 404

Affected Area

Backend and Frontend

Activity

  1. added
    enhancementNew feature or request
    help wantedExtra attention is needed
    backendBackend related
    GrantFox OSSIssue tracked in GrantFox OSS
    Maybe RewardedIssue may be eligible for a GrantFox reward
    on Aug 22, 2026
  2. ijeoma270 commented on Aug 22, 2026

    @ijeoma270
    Contributor

    Please assign this to me

  3. grantfox-oss commented on Aug 22, 2026

    @grantfox-oss
    Author

    🦊 GrantFox — @ijeoma270 has been assigned to this issue as part of the Third Campaign campaign!

    Next steps:

    1. Open a Pull Request referencing this issue (e.g., Closes #64)
    2. Your PR will be reviewed by the grantFoxin maintainers

    Good luck! Track your progress on GrantFox.

  4. grantfox-oss commented on Aug 22, 2026

    @grantfox-oss
    Author

    🎉 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third CampaignbackendBackend relatedenhancementNew feature or requestfrontendFrontend UIhelp wantedExtra attention is needed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions