Some checks failed
- Add buyPrice and buyDate to positions for PnL tracking - Implement backend analytics service for real-time portfolio performance - Add server-side security screener with filtering, sorting, and pagination - Update frontend UI with analytics summaries and sortable screener table - Optimize MOEX API calls with batch fetching and portfolio-specific caching - Add unit tests for analytics and screener services
54 lines
1.3 KiB
Plaintext
54 lines
1.3 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "sqlite"
|
|
}
|
|
|
|
model Portfolio {
|
|
id Int @id @default(autoincrement())
|
|
userId Int
|
|
name String
|
|
description String?
|
|
currency String @default("RUB")
|
|
targets String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
positions Position[]
|
|
|
|
@@unique([userId, name])
|
|
}
|
|
|
|
model Position {
|
|
id Int @id @default(autoincrement())
|
|
portfolioId Int
|
|
secid String
|
|
type String @default("share")
|
|
quantity Int
|
|
buyPrice Float?
|
|
buyDate DateTime?
|
|
notes String?
|
|
tags String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
portfolio Portfolio @relation(fields: [portfolioId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([portfolioId, secid])
|
|
}
|
|
|
|
model User {
|
|
id Int @id @default(autoincrement())
|
|
email String @unique
|
|
password String
|
|
name String?
|
|
role String @default("user")
|
|
refreshToken String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
portfolios Portfolio[]
|
|
}
|