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:
@@ -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}`),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user