feat(assets): track selected indices by FIGI

Add the nullable FIGI migration, owner-scoped asset identity operations, and the explicit index search and selection flow.

Refs #4

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-11-20 22:31:52 +01:00
parent 5cb45138df
commit 8f42c30ec6
20 changed files with 1082 additions and 147 deletions

View File

@ -1,9 +1,12 @@
import { api } from './client'
export interface Asset { id: string; user_id: string; symbol: string; name: string; created_at: string }
export interface Asset { id: string; user_id: string; symbol: string; name: string; figi: string | null; created_at: string }
export interface IndexSearchResult { figi: string; name: string; symbol: string; market?: string }
export interface FollowAsset { symbol: string; name: string; figi?: string | null }
export const assetsApi = {
list: () => api.get<Asset[]>('/me/assets'),
add: (symbol: string, name: string) => api.post<Asset>('/me/assets', { symbol, name }),
remove: (symbol: string) => api.delete<void>(`/me/assets/${symbol}`),
search: (query: string, limit = 20) => api.get<IndexSearchResult[]>(`/indices/search?${new URLSearchParams({ q: query, limit: String(limit) })}`),
add: (asset: FollowAsset) => api.post<Asset>('/me/assets', asset),
remove: (id: string) => api.delete<void>(`/me/assets/${encodeURIComponent(id)}`),
}