CognxSafeTrack
feat: Implement Multi-AI Architecture with Google Gemini provider and failover logic
f41372b | generator client { | |
| provider = "prisma-client-js" | |
| } | |
| datasource db { | |
| provider = "postgresql" | |
| url = env("DATABASE_URL") | |
| } | |
| model User { | |
| id String | |
| phone String | |
| name String? | |
| role Role | |
| language Language | |
| city String? | |
| activity String? // Business activity/sector | |
| createdAt DateTime | |
| updatedAt DateTime | |
| currentStreak Int | |
| longestStreak Int | |
| lastActivityAt DateTime? | |
| enrollments Enrollment[] | |
| responses Response[] | |
| messages Message[] | |
| payments Payment[] | |
| progress UserProgress[] | |
| businessProfile BusinessProfile? | |
| } | |
| model BusinessProfile { | |
| id String | |
| userId String | |
| activityLabel String? // e.g. "Jus de Bissap" | |
| activityPhrase String? // Optimized elevator pitch | |
| activityType String? // e.g. "Production", "Service" | |
| locationCity String? | |
| mainCustomer String? | |
| mainProblem String? | |
| offerSimple String? | |
| promise String? | |
| marketData Json? // Stored Google Search results for TAM/SAM/SOM & Competition | |
| competitorList Json? // List of rivals found or declared | |
| financialProjections Json? // 3-year growth data | |
| fundingAsk String? // Amount and purpose | |
| lastUpdatedFromDay Int | |
| createdAt DateTime | |
| updatedAt DateTime | |
| user User | |
| } | |
| model Track { | |
| id String | |
| title String | |
| description String? | |
| duration Int // Duration in days | |
| language Language | |
| // Payment Integration Fields | |
| isPremium Boolean | |
| priceAmount Int? // Price in smallest currency unit (e.g., cents/XOF) | |
| stripePriceId String? // Stripe Price ID | |
| createdAt DateTime | |
| updatedAt DateTime | |
| days TrackDay[] | |
| enrollments Enrollment[] | |
| payments Payment[] | |
| progress UserProgress[] | |
| } | |
| model TrackDay { | |
| id String | |
| trackId String | |
| dayNumber Float | |
| title String? | |
| audioUrl String? | |
| imageUrl String? | |
| videoUrl String? | |
| videoCaption String? | |
| lessonText String? | |
| exerciseType ExerciseType | |
| exercisePrompt String? | |
| validationKeyword String? | |
| buttonsJson Json? | |
| exerciseCriteria Json? | |
| badges Json? // Array of strings: ["B_MODULE_1_OK"] | |
| unlockCondition String? | |
| createdAt DateTime | |
| updatedAt DateTime | |
| track Track | |
| } | |
| model UserProgress { | |
| id String | |
| userId String | |
| trackId String | |
| score Int | |
| lastInteraction DateTime | |
| exerciseStatus ExerciseStatus | |
| badges Json? // Array of strings: ["CLARTE", "CONFIANCE"] | |
| behavioralScoring Json? // { discipline_financiere: 0, organisation: 0, ... } | |
| confidenceScore Float? // STT Whisper avg_logprob mapped to 0-100% | |
| adminTranscription String? | |
| overrideAudioUrl String? | |
| reviewedBy String? | |
| iterationCount Int // Tracks Deep Dive loops | |
| aiSource String? // Provider used (GEMINI, OPENAI) | |
| // Removed Enriched Data for Pitch Deck (Moved to BusinessProfile - Sprint 38) | |
| createdAt DateTime | |
| updatedAt DateTime | |
| user User | |
| track Track | |
| @ | |
| } | |
| model Enrollment { | |
| id String | |
| userId String | |
| trackId String | |
| status EnrollmentStatus | |
| currentDay Float | |
| startedAt DateTime | |
| completedAt DateTime? | |
| lastActivityAt DateTime | |
| user User | |
| track Track | |
| responses Response[] | |
| } | |
| model Response { | |
| id String | |
| enrollmentId String | |
| userId String | |
| dayNumber Int | |
| content String? // Text response | |
| mediaUrl String? // Voice/Image response | |
| createdAt DateTime | |
| aiSource String? // Provider used (GEMINI, OPENAI) | |
| enrollment Enrollment | |
| user User | |
| } | |
| model Message { | |
| id String | |
| userId String | |
| direction Direction // INBOUND, OUTBOUND | |
| channel String | |
| content String? | |
| mediaUrl String? | |
| payload Json? // Raw payload from provider | |
| createdAt DateTime | |
| user User | |
| @ | |
| } | |
| enum Role { | |
| STUDENT | |
| ADMIN | |
| } | |
| enum EnrollmentStatus { | |
| ACTIVE | |
| COMPLETED | |
| DROPPED | |
| } | |
| enum Language { | |
| FR | |
| WOLOF | |
| } | |
| enum ContentType { | |
| TEXT | |
| AUDIO | |
| IMAGE | |
| VIDEO | |
| } | |
| enum Direction { | |
| INBOUND | |
| OUTBOUND | |
| } | |
| model Payment { | |
| id String | |
| userId String | |
| trackId String | |
| amount Int | |
| currency String | |
| status PaymentStatus | |
| stripeSessionId String? | |
| createdAt DateTime | |
| updatedAt DateTime | |
| user User | |
| track Track | |
| } | |
| enum PaymentStatus { | |
| PENDING | |
| COMPLETED | |
| FAILED | |
| REFUNDED | |
| } | |
| enum ExerciseType { | |
| TEXT | |
| AUDIO | |
| BUTTON | |
| } | |
| enum ExerciseStatus { | |
| PENDING | |
| PENDING_REMEDIATION | |
| PENDING_REVIEW | |
| PENDING_DEEPDIVE | |
| COMPLETED | |
| } | |
| model TrainingData { | |
| id String | |
| audioUrl String | |
| transcription String .Text | |
| manualCorrection String? .Text | |
| rawWER Float? | |
| normalizedWER Float? | |
| status TrainingStatus | |
| createdAt DateTime | |
| updatedAt DateTime | |
| } | |
| enum TrainingStatus { | |
| PENDING | |
| REVIEWED | |
| IGNORED | |
| } | |