first commit!
Build Images and Deploy / Update-PROD-Stack (push) Failing after 15s

This commit is contained in:
2026-03-18 15:44:49 -04:00
commit 3b479f8382
56 changed files with 7387 additions and 0 deletions
+111
View File
@@ -0,0 +1,111 @@
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id String @id @default(cuid())
username String @unique
passwordHash String
balance Float @default(2000)
researchPoints Int @default(1)
isAdmin Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
positions Position[]
trades Trade[]
passwordResets PasswordReset[]
}
model PasswordReset {
id String @id @default(cuid())
token String @unique @default(uuid())
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
expiresAt DateTime
used Boolean @default(false)
createdAt DateTime @default(now())
@@index([token])
}
model Hashtag {
id String @id @default(cuid())
tag String @unique // lowercase, no #
displayTag String // original case as entered
currentPrice Float @default(0.25)
isActive Boolean @default(true)
// Consecutive zero-result count; after 3 failed updates the hashtag auto-deactivates
zeroCount Int @default(0)
lastUpdated DateTime @default(now())
createdAt DateTime @default(now())
priceHistory PriceHistory[]
positions Position[]
trades Trade[]
@@index([isActive, lastUpdated])
}
model PriceHistory {
id String @id @default(cuid())
hashtagId String
hashtag Hashtag @relation(fields: [hashtagId], references: [id], onDelete: Cascade)
price Float
postsPerHour Float
recordedAt DateTime @default(now())
@@index([hashtagId, recordedAt])
}
model Position {
id String @id @default(cuid())
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
hashtagId String
hashtag Hashtag @relation(fields: [hashtagId], references: [id])
shares Float @default(0)
positionType PositionType
avgBuyPrice Float
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([userId, hashtagId, positionType])
@@index([userId])
@@index([hashtagId])
}
model Trade {
id String @id @default(cuid())
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
hashtagId String
hashtag Hashtag @relation(fields: [hashtagId], references: [id])
type TradeType
shares Float
price Float // price per share at time of trade
total Float // cost/proceeds of the trade
profit Float @default(0) // realized P&L (for SELL trades)
createdAt DateTime @default(now())
@@index([userId])
@@index([hashtagId])
@@index([createdAt])
}
enum PositionType {
LONG
SHORT
}
enum TradeType {
BUY_LONG
SELL_LONG
BUY_SHORT
SELL_SHORT
}