---
# System prepended metadata

title: Untitled

---

```
model User {
  id        String     @id @default(cuid())
  createdAt DateTime   @default(now())
  email     String     @unique
  name      String?
  role      Role       @default(USER)
  image     String?
  password  String
  balance   Int        @default(0)
  Investor  Investor[]
}

model Report {
  id        String     @id @default(cuid())
  title     String
  dateStart DateTime
  dateEnd   DateTime
  pnl       Int        @default(0)
  createdAt DateTime   @default(now())
  investors Investor[]
  traders   Trader[]
  result    Result[]

  @@unique([title])
}

model Investor {
  id         String @id @default(cuid())
  sum        Int
  percentage Int
  User       User   @relation(fields: [userId], references: [id])
  userId     String
  Report     Report @relation(fields: [reportId], references: [id])
  reportId   String
}

model Trader {
  id         String   @id @default(cuid())
  sum        Int
  percentage Int
  pnl        Int
  Report     Report   @relation(fields: [reportId], references: [id])
  reportId   String
  result     Result[]
}

model Result {
  id        String   @id @default(cuid())
  userId    String
  dateStart DateTime
  dateEnd   DateTime
  pnl       Int
  Report    Report   @relation(fields: [reportId], references: [id])
  reportId  String
  Trader    Trader   @relation(fields: [traderId], references: [id])
  traderId  String
}
```