feat: add investment and redemption functionality for hedge funds
Build Images and Deploy / Update-PROD-Stack (push) Successful in 1m21s

- Implemented POST endpoint for investing in hedge funds, allowing users to invest a specified amount and receive shares based on the fund's NAV.
- Implemented POST endpoint for redeeming shares in hedge funds, enabling users to redeem shares for cash based on the current NAV.
- Created InvestPanel component for user interactions, including investing and redeeming shares, displaying current NAV, user balance, and holdings summary.
This commit is contained in:
2026-03-18 20:50:51 -04:00
parent 50b1b3472f
commit 8e808d5e7c
8 changed files with 436 additions and 10 deletions
+25 -7
View File
@@ -26,21 +26,39 @@ model User {
passwordResets PasswordReset[]
managedFunds FundManager[]
fund HedgeFund?
fundInvestments FundInvestment[]
}
model HedgeFund {
id String @id @default(cuid())
name String @unique
slug String @unique // lowercase, URL-safe
userId String @unique // shadow User account that holds positions/trades/balance
user User @relation(fields: [userId], references: [id])
createdAt DateTime @default(now())
id String @id @default(cuid())
name String @unique
slug String @unique // lowercase, URL-safe
userId String @unique // shadow User account that holds positions/trades/balance
user User @relation(fields: [userId], references: [id])
sharesOutstanding Float @default(0) // total fund shares currently in circulation
createdAt DateTime @default(now())
managers FundManager[]
managers FundManager[]
investments FundInvestment[]
@@index([slug])
}
model FundInvestment {
id String @id @default(cuid())
fundId String
fund HedgeFund @relation(fields: [fundId], references: [id], onDelete: Cascade)
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
shares Float // fund shares held by this investor
avgNavAtBuy Float // NAV per share at time of purchase (for display only)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([fundId, userId])
@@index([userId])
}
model FundManager {
id String @id @default(cuid())
fundId String