Admin & Platform ERD¶
This diagram covers admin-facing tables, platform infrastructure (chat, support,
bots, site config), and third-party integration models. All live in the public
Postgres schema (libs/_prisma/src/schema/api.prisma).
These tables are primarily read/written by the admin endpoints behind
JwtGuard + RolesGuard (apps/api/src/admin/) and the backoffice app
(apps/bo/).
erDiagram
User {
int id PK
string username
string email
}
AdminActionLog {
int id PK
datetime createdAt
string method
string url
int userId FK
string userAgent
string ipAddress
int status
json response
float durationMs
json requestBody
}
UserNote {
int id PK
int userId FK
int createdById FK
string note
enum riskLevel
datetime createdAt
}
AdminTips {
int id PK
int senderId FK
int recipientId FK
decimal amount
enum currencyId
decimal usdAmount
string notes
string transactionId UK
enum type
enum tag
}
SiteConfig {
enum type PK
json config
datetime updatedAt
}
Faq {
int id PK
string title
string text
int order
}
SupportRequest {
int id PK
string name
string email
string message
string notes
enum status
int userId FK
}
ChatRoom {
string id PK
string code
enum lang
json settings
}
ChatMessage {
string id PK
datetime createdAt
enum type
string content
int userId FK
string roomId FK
string replyToId FK
}
BotsCasino {
int userId PK,FK
enum type
enum behavior
string startTime
boolean isActive
}
GameInBotsCasino {
int botsCasinoUserId PK,FK
int gameIdentityId PK,FK
}
ArbitrageIncome {
int userId UK,FK
string subId
enum provider
json actions
}
FastTrackBonusReporting {
string id PK
int userId FK
int actionId
int activityId
string triggerHash
}
St8Bonus {
string uuid PK
boolean active
datetime createdAt
}
St8CanceledUnknownSlotTransaction {
string slotTransactionId PK
datetime createdAt
}
VipProgram {
int id PK
int userId UK,FK
enum status
string name
string social
json transfer
string favorites
}
User ||--o{ AdminActionLog : "performed"
User ||--o{ UserNote : "about"
User ||--o{ UserNote : "created"
User ||--o{ AdminTips : "sent"
User ||--o{ AdminTips : "received"
User ||--o{ SupportRequest : "submitted"
User ||--o{ ChatMessage : "authored"
User ||--o| BotsCasino : "config"
User ||--o| ArbitrageIncome : "tracks"
User ||--o{ FastTrackBonusReporting : "reported"
User ||--o| VipProgram : "applied"
ChatRoom ||--o{ ChatMessage : "contains"
ChatMessage ||--o{ ChatMessage : "replies"
BotsCasino ||--o{ GameInBotsCasino : "plays"
Table reference¶
| Table | PK | Purpose | Prisma line |
|---|---|---|---|
AdminActionLog |
id (autoincrement) |
HTTP audit trail for admin requests | api.prisma:1479 |
UserNote |
id (autoincrement) |
Admin notes on users with risk level | api.prisma:322 |
AdminTips |
id (autoincrement) |
Admin-initiated balance adjustments | api.prisma:530 |
SiteConfig |
type (enum) |
Singleton config rows (affiliates, withdrawals, etc.) | api.prisma:135 |
Faq |
id (autoincrement) |
Ordered FAQ entries | api.prisma:113 |
SupportRequest |
id (autoincrement) |
User support tickets | api.prisma:1253 |
ChatRoom |
id (uuid) |
Chat rooms per language | api.prisma:992 |
ChatMessage |
id (uuid) |
Chat messages with reply threading | api.prisma:1006 |
BotsCasino |
userId |
Bot player configuration | api.prisma:1651 |
GameInBotsCasino |
(botsCasinoUserId, gameIdentityId) |
Games assigned to a bot | api.prisma:1669 |
ArbitrageIncome |
userId (unique) |
Third-party arbitrage tracking | api.prisma:1597 |
FastTrackBonusReporting |
id (string) |
FastTrack CRM bonus dedup | api.prisma:295 |
St8Bonus |
uuid |
Active ST8 slot bonuses | api.prisma:929 |
St8CanceledUnknownSlotTransaction |
slotTransactionId |
Canceled unknown slot txns | api.prisma:939 |
VipProgram |
id (autoincrement) |
VIP applications from users | api.prisma:1619 |
Cross-references¶
AdminActionLogis populated by the admin-action-log interceptor — seedocs/flows/admin-user-mgmt.md.AdminTipscreates aTransaction(linked viatransactionId) — seedocs/flows/admin-sign-in.md.BotsCasinodrives the bot system inapps/api/src/bots/— bots simulate real player activity.FastTrackBonusReportingis part of the stubbed FastTrack integration (apps/api/src/fast-track/).ChatMessage.replyToIdenables threaded replies within aChatRoom.