Download packages/database/prisma/schema.prisma from safetrack/edtech: direct link, hf CLI and curl.
- Browser
- Download file 17.5 kB
-
https://huggingface.co/spaces/safetrack/edtech/resolve/main/packages/database/prisma/schema.prisma
- Command line
-
hf download hf://spaces/safetrack/edtech/packages/database/prisma/schema.prisma
-
curl -L -o schema.prisma https://huggingface.co/spaces/safetrack/edtech/resolve/main/packages/database/prisma/schema.prisma
17.5 kB
| generator client { | |
| provider = "prisma-client-js" | |
| } | |
| datasource db { | |
| provider = "postgresql" | |
| url = env("DATABASE_URL") | |
| } | |
| model Organization { | |
| id String | |
| name String | |
| wabaId String? | |
| metaBusinessId String? | |
| systemUserToken String? | |
| systemUserTokenIssuedAt DateTime? | |
| createdAt DateTime | |
| updatedAt DateTime | |
| slug String? // For subdomains like polytech.xamle.studio | |
| brandingData Json? | |
| customPrompt String? | |
| personalityConfig Json? | |
| flowConfig Json? | |
| knowledgeBaseUrl String? | |
| mode OrganizationMode | |
| useCase OrganizationUseCase | |
| isCrmActive Boolean | |
| isEdTechActive Boolean | |
| webhookSecret String? | |
| webhookUrl String? | |
| openAiApiKey String? | |
| googleAiApiKey String? | |
| subscriptionStatus String? | |
| subscriptionPlan SubscriptionPlan | |
| stripeCustomerId String? | |
| stripeSubscriptionId String? | |
| aiCreditsLimit Int | |
| aiCreditsUsed Int | |
| whatsappMessagesSent Int | |
| billingPeriodStart DateTime | |
| walletBalance Int | |
| isHardStopped Boolean | |
| businessProfiles BusinessProfile[] | |
| usageEvents UsageEvent[] | |
| walletTransactions WalletTransaction[] | |
| enrollments Enrollment[] | |
| kbEntries KnowledgeBaseEntry[] | |
| messages Message[] | |
| payments Payment[] | |
| responses Response[] | |
| teamMembers TeamMember[] | |
| tracks Track[] | |
| trackDays TrackDay[] | |
| users User[] | |
| userBadges UserBadge[] | |
| progress UserProgress[] | |
| phoneNumbers WhatsAppPhoneNumber[] | |
| analytics AnalyticsLog[] | |
| campaigns CampaignHistory[] | |
| contacts Contact[] | |
| broadcastLists BroadcastList[] | |
| } | |
| model Contact { | |
| id String | |
| phoneNumber String | |
| name String? | |
| attributes Json? // For dynamic Excel columns | |
| tags String[] | |
| organizationId String | |
| createdAt DateTime | |
| updatedAt DateTime | |
| organization Organization | |
| campaigns CampaignHistory[] | |
| broadcastLists BroadcastList[] | |
| messages Message[] | |
| language Language | |
| @ | |
| @ | |
| } | |
| model BroadcastList { | |
| id String | |
| name String | |
| organizationId String | |
| organization Organization | |
| contacts Contact[] | |
| createdAt DateTime | |
| @ | |
| } | |
| // ... existing models ... | |
| model CampaignHistory { | |
| id String | |
| organizationId String | |
| contactId String | |
| whatsappMessageId String? // ID returned by Meta | |
| content String | |
| status CampaignStatus | |
| error String? | |
| sentAt DateTime | |
| updatedAt DateTime | |
| organization Organization | |
| contact Contact | |
| analytics AnalyticsLog[] | |
| @ | |
| @ | |
| @ | |
| } | |
| model AnalyticsLog { | |
| id String | |
| organizationId String | |
| campaignHistoryId String | |
| eventType AnalyticsEventType | |
| metadata Json? | |
| occurredAt DateTime | |
| organization Organization | |
| campaign CampaignHistory | |
| @ | |
| @ | |
| @ | |
| } | |
| // ... existing enums ... | |
| model KnowledgeBaseEntry { | |
| id String | |
| organizationId String | |
| content String | |
| embedding Unsupported("vector")? | |
| metadata Json? | |
| createdAt DateTime | |
| organization Organization | |
| @ | |
| } | |
| model WhatsAppPhoneNumber { | |
| id String | |
| displayPhone String | |
| organizationId String | |
| createdAt DateTime | |
| updatedAt DateTime | |
| organization Organization | |
| } | |
| model User { | |
| id String | |
| phone String? // Made optional for Email-based admins | |
| name String? | |
| role Role | |
| language Language | |
| city String? | |
| activity String? | |
| createdAt DateTime | |
| updatedAt DateTime | |
| email String? | |
| passwordHash String? | |
| currentStreak Int | |
| longestStreak Int | |
| lastActivityAt DateTime? | |
| deletedAt DateTime? | |
| organizationId String | |
| businessProfile BusinessProfile? | |
| enrollments Enrollment[] | |
| messages Message[] | |
| payments Payment[] | |
| responses Response[] | |
| organization Organization | |
| progress UserProgress[] | |
| pushSubscriptions PushSubscription[] | |
| @ | |
| @ | |
| @ | |
| @ | |
| @ | |
| } | |
| model PushSubscription { | |
| id String | |
| userId String | |
| organizationId String | |
| endpoint String | |
| p256dh String | |
| auth String | |
| createdAt DateTime | |
| user User | |
| @ | |
| @ | |
| } | |
| model BusinessProfile { | |
| id String | |
| userId String | |
| activityLabel String? | |
| activityPhrase String? | |
| activityType String? | |
| locationCity String? | |
| mainCustomer String? | |
| mainProblem String? | |
| offerSimple String? | |
| promise String? | |
| marketData Json? | |
| competitorList Json? | |
| financialProjections Json? | |
| fundingAsk String? | |
| lastUpdatedFromDay Int | |
| createdAt DateTime | |
| updatedAt DateTime | |
| organizationId String | |
| organization Organization | |
| user User | |
| teamMembersList TeamMember[] | |
| @ | |
| } | |
| model TeamMember { | |
| id String | |
| businessProfileId String | |
| name String? | |
| role String? | |
| bio String? | |
| photoUrl String? | |
| organizationId String | |
| businessProfile BusinessProfile | |
| organization Organization | |
| @ | |
| } | |
| model Track { | |
| id String | |
| title String | |
| description String? | |
| duration Int | |
| language Language | |
| isPremium Boolean | |
| priceAmount Int? | |
| createdAt DateTime | |
| updatedAt DateTime | |
| organizationId String | |
| enrollments Enrollment[] | |
| payments Payment[] | |
| organization Organization | |
| days TrackDay[] | |
| progress UserProgress[] | |
| @ | |
| } | |
| model TrackDay { | |
| id String | |
| trackId String | |
| dayNumber Int | |
| title String? | |
| audioUrl String? | |
| imageUrl String? | |
| videoUrl String? | |
| videoCaption String? | |
| lessonText String? | |
| exerciseType ExerciseType | |
| exercisePrompt String? | |
| validationKeyword String? | |
| buttonsJson Json? | |
| exerciseCriteria Json? | |
| badges Json? | |
| unlockCondition String? | |
| createdAt DateTime | |
| updatedAt DateTime | |
| organizationId String | |
| organization Organization | |
| track Track | |
| @ | |
| @ | |
| } | |
| model UserProgress { | |
| id String | |
| userId String | |
| trackId String | |
| score Int | |
| lastInteraction DateTime | |
| exerciseStatus ExerciseStatus | |
| badges Json? | |
| behavioralScoring Json? | |
| confidenceScore Float? | |
| adminTranscription String? | |
| overrideAudioUrl String? | |
| reviewedBy String? | |
| createdAt DateTime | |
| updatedAt DateTime | |
| iterationCount Int | |
| aiSource String? | |
| organizationId String | |
| userBadges UserBadge[] | |
| organization Organization | |
| track Track | |
| user User | |
| @ | |
| @ | |
| @ | |
| } | |
| model Enrollment { | |
| id String | |
| userId String | |
| trackId String | |
| status EnrollmentStatus | |
| currentDay Int | |
| startedAt DateTime | |
| completedAt DateTime? | |
| lastActivityAt DateTime | |
| deletedAt DateTime? | |
| organizationId String | |
| organization Organization | |
| track Track | |
| user User | |
| responses Response[] | |
| @ | |
| @ | |
| @ | |
| } | |
| model Response { | |
| id String | |
| enrollmentId String | |
| userId String | |
| dayNumber Int | |
| content String? | |
| mediaUrl String? | |
| createdAt DateTime | |
| aiSource String? | |
| organizationId String | |
| enrollment Enrollment | |
| organization Organization | |
| user User | |
| @ | |
| @ | |
| @ | |
| } | |
| model Message { | |
| id String | |
| userId String? | |
| contactId String? | |
| direction Direction | |
| channel String | |
| content String? | |
| mediaUrl String? | |
| mediaType MediaType? | |
| mediaId String? | |
| payload Json? | |
| createdAt DateTime | |
| status MessageStatus | |
| organizationId String | |
| organization Organization | |
| user User? | |
| contact Contact? | |
| @ | |
| @ | |
| @ | |
| @ | |
| } | |
| model Payment { | |
| id String | |
| userId String | |
| trackId String | |
| amount Int | |
| currency String | |
| status PaymentStatus | |
| paymentSessionId String? | |
| createdAt DateTime | |
| updatedAt DateTime | |
| organizationId String | |
| organization Organization | |
| track Track | |
| user User | |
| @ | |
| } | |
| model TrainingData { | |
| id String | |
| audioUrl String | |
| transcription String | |
| manualCorrection String? | |
| rawWER Float? | |
| normalizedWER Float? | |
| status TrainingStatus | |
| createdAt DateTime | |
| updatedAt DateTime | |
| } | |
| model NormalizationRule { | |
| id String | |
| original String | |
| replacement String | |
| language String | |
| createdAt DateTime | |
| updatedAt DateTime | |
| @ | |
| } | |
| model UserBadge { | |
| id String | |
| userProgressId String | |
| name String | |
| earnedAt DateTime | |
| organizationId String | |
| organization Organization | |
| userProgress UserProgress | |
| @ | |
| } | |
| enum Role { | |
| STUDENT | |
| ADMIN | |
| ORG_MEMBER | |
| ORG_ADMIN | |
| SUPER_ADMIN | |
| } | |
| enum OrganizationMode { | |
| EDTECH | |
| WEBHOOK | |
| AI_AGENT | |
| CRM_MARKETING | |
| PEDAGOGY | |
| CUSTOMER_SERVICE | |
| } | |
| enum OrganizationUseCase { | |
| EDUCATION | |
| CRM_WHATSAPP | |
| } | |
| enum EnrollmentStatus { | |
| ACTIVE | |
| COMPLETED | |
| DROPPED | |
| } | |
| enum Language { | |
| FR | |
| EN | |
| ES | |
| PT | |
| WOLOF | |
| } | |
| enum ContentType { | |
| TEXT | |
| AUDIO | |
| IMAGE | |
| VIDEO | |
| } | |
| enum MessageStatus { | |
| SENT | |
| DELIVERED | |
| READ | |
| RECEIVED | |
| } | |
| enum Direction { | |
| INBOUND | |
| OUTBOUND | |
| } | |
| enum PaymentStatus { | |
| PENDING | |
| COMPLETED | |
| FAILED | |
| REFUNDED | |
| } | |
| enum ResponseType { | |
| TEXT | |
| AUDIO | |
| VIDEO | |
| } | |
| enum MediaType { | |
| AUDIO | |
| IMAGE | |
| VIDEO | |
| DOCUMENT | |
| } | |
| enum ExerciseType { | |
| TEXT | |
| AUDIO | |
| BUTTON | |
| } | |
| enum ExerciseStatus { | |
| PENDING | |
| PENDING_REMEDIATION | |
| PENDING_REVIEW | |
| COMPLETED | |
| PENDING_DEEPDIVE | |
| } | |
| enum TrainingStatus { | |
| PENDING | |
| REVIEWED | |
| IGNORED | |
| } | |
| enum SubscriptionPlan { | |
| STARTER | |
| GROWTH | |
| SCALE | |
| ENTERPRISE | |
| } | |
| enum UsageEventType { | |
| AI_TEXT | |
| AI_AUDIO | |
| AI_IMAGE | |
| WHATSAPP_SENT | |
| } | |
| enum UsageProvider { | |
| GEMINI | |
| OPENAI | |
| META | |
| } | |
| enum UsageFeature { | |
| LESSON | |
| FEEDBACK | |
| DEEPDIVE | |
| TRANSCRIPTION | |
| IMAGE_ANALYSIS | |
| SPEECH | |
| CAMPAIGN | |
| KB_QUERY | |
| ONBOARDING | |
| OTHER | |
| } | |
| model UsageEvent { | |
| id String | |
| organizationId String | |
| userId String? | |
| type UsageEventType | |
| provider UsageProvider | |
| feature UsageFeature | |
| tokensIn Int | |
| tokensOut Int | |
| durationMs Int? | |
| costUsd Float | |
| createdAt DateTime | |
| organization Organization | |
| @ | |
| @ | |
| } | |
| model WalletTransaction { | |
| id String | |
| organizationId String | |
| amount Int | |
| balanceAfter Int | |
| type WalletTransactionType | |
| description String? | |
| actorId String? | |
| byok Boolean | |
| metadata Json? | |
| createdAt DateTime | |
| organization Organization | |
| @ | |
| @ | |
| @ | |
| } | |
| enum WalletTransactionType { | |
| TOP_UP_MANUAL | |
| TOP_UP_PAYMENT | |
| DEBIT_AI | |
| DEBIT_WHATSAPP | |
| DEBIT_BROADCAST | |
| ADJUSTMENT | |
| } | |
| model AuditLog { | |
| id String | |
| action String | |
| actorId String? | |
| resourceId String? | |
| details Json? | |
| createdAt DateTime | |
| @ | |
| @ | |
| @ | |
| @ | |
| } | |
| enum CampaignStatus { | |
| SENT | |
| DELIVERED | |
| READ | |
| FAILED | |
| } | |
| enum AnalyticsEventType { | |
| CLICK | |
| READ | |
| RESPONSE | |
| } | |