Private
Public Access
1
0

Add investment holdings CRUD (create, edit, delete)

Add POST/PUT/DELETE endpoints to InvestmentsController with find-or-create
Security by normalized symbol, price upsert helper, and ownership checks.
Frontend gets add/edit dialog with per-share cost basis input, delete
confirmation, actions column on holdings table, and success/error snackbar.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Catherine Renelle
2026-02-15 23:31:44 -05:00
parent 24839a3a21
commit 7f15cd11e3
5 changed files with 346 additions and 9 deletions
+10 -1
View File
@@ -1,5 +1,5 @@
import api from './api'
import type { InvestmentHolding, InvestmentPerformance } from '@/types'
import type { InvestmentHolding, InvestmentPerformance, CreateInvestmentHoldingRequest, UpdateInvestmentHoldingRequest } from '@/types'
export const investmentsApi = {
getHoldings: (accountId: string) =>
@@ -7,4 +7,13 @@ export const investmentsApi = {
getPerformance: (accountId: string) =>
api.get<InvestmentPerformance>(`/investments/${accountId}/performance`),
createHolding: (accountId: string, data: CreateInvestmentHoldingRequest) =>
api.post<InvestmentHolding>(`/investments/${accountId}/holdings`, data),
updateHolding: (accountId: string, holdingId: string, data: UpdateInvestmentHoldingRequest) =>
api.put<InvestmentHolding>(`/investments/${accountId}/holdings/${holdingId}`, data),
deleteHolding: (accountId: string, holdingId: string) =>
api.delete(`/investments/${accountId}/holdings/${holdingId}`),
}