feat: add hourly portfolio sync history
This commit is contained in:
@@ -17,6 +17,7 @@ model User {
|
||||
bankCardOperations BankCardOperation[]
|
||||
sessions Session[]
|
||||
tbankConnection TbankConnection?
|
||||
tbankValueHistory TbankPortfolioValueHistory[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
@@ -69,6 +70,34 @@ model TbankPortfolio {
|
||||
@@id([userId, revision, accountId])
|
||||
}
|
||||
|
||||
// Account valuation history survives connection replacement and stays hidden
|
||||
// until the current connection confirms the account again.
|
||||
model TbankPortfolioValueHistory {
|
||||
userId String
|
||||
accountId String
|
||||
deletedAt DateTime?
|
||||
updatedAt DateTime @updatedAt
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
points TbankPortfolioValuePoint[]
|
||||
|
||||
@@id([userId, accountId])
|
||||
}
|
||||
|
||||
// One row per currency of a fully valued successful portfolio attempt.
|
||||
model TbankPortfolioValuePoint {
|
||||
userId String
|
||||
accountId String
|
||||
attemptId String
|
||||
currency String
|
||||
value String
|
||||
capturedAt DateTime
|
||||
createdAt DateTime @default(now())
|
||||
history TbankPortfolioValueHistory @relation(fields: [userId, accountId], references: [userId, accountId], onDelete: Cascade, onUpdate: Restrict)
|
||||
|
||||
@@id([userId, accountId, attemptId, currency])
|
||||
@@index([userId, accountId, capturedAt])
|
||||
}
|
||||
|
||||
model TbankOperation {
|
||||
userId String
|
||||
revision String
|
||||
|
||||
Reference in New Issue
Block a user