Skip to content

feat: add user profile API endpoint#5

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/update-user-profile-page
Draft

feat: add user profile API endpoint#5
Copilot wants to merge 2 commits intomainfrom
copilot/update-user-profile-page

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 16, 2026

No user profile endpoint existed to back a frontend profile page. Adds GET /api/v1/user/profile that aggregates wallet data across chains.

Changes

src/app/service/user_service.go (new)

  • UserService.GetProfile(address) — queries users table to sum totalStaked (wei → ether) and points across all chains; derives activeStakes as Staked events minus withdraw events
  • Warns via zap when decimal → float64 conversion loses precision

src/app/api/user_api.go (new)

  • UserApi.GetProfile — resolves wallet address from JWT ****** or walletAddress query param (reuses extractWalletAddress); logs service errors before returning DBQueryFailed

src/core/gin/router/router.go

  • Registers GET /api/v1/user/profile

Response shape

GET /api/v1/user/profile?walletAddress=0xabc...

{
  "code": 0,
  "msg": "OK",
  "data": {
    "address": "0xabc...",
    "totalStaked": 12.5,
    "points": 1234.56,
    "activeStakes": 3
  }
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: a123665404 <36843331+a123665404@users.noreply.github.com>
Copilot AI changed the title [WIP] Update user profile page design feat: add user profile API endpoint Mar 16, 2026
Copilot AI requested a review from a123665404 March 16, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants