Spaces:
Build error
Build error
| // This is your Prisma schema file, | |
| // learn more about it in the docs: https://pris.ly/d/prisma-schema | |
| generator client { | |
| provider = "prisma-client-js" | |
| } | |
| datasource db { | |
| provider = "postgresql" | |
| url = env("DATABASE_URL") | |
| } | |
| // ============================================ | |
| // MODELOS BASE | |
| // ============================================ | |
| model User { | |
| id String | |
| email String? | |
| name String? | |
| externalId String? // ID externo (Telegram chatId, etc.) | |
| source String? // "telegram", "web", "onlyfans", etc. | |
| tier String // free, basic, premium, pro | |
| stripeCustomerId String? | |
| totalSpent Float | |
| createdAt DateTime | |
| updatedAt DateTime | |
| chatSessions ChatSession[] | |
| assetDeliveries AssetDelivery[] | |
| influencerSubscriptions InfluencerSubscription[] | |
| @ | |
| } | |
| model Project { | |
| id String | |
| name String | |
| description String? | |
| style String | |
| status String | |
| createdAt DateTime | |
| updatedAt DateTime | |
| repos Repo[] | |
| analyses Analysis[] | |
| contents Content[] | |
| } | |
| model Repo { | |
| id String | |
| url String | |
| name String | |
| status String | |
| projectId String? | |
| project Project? | |
| analyses Analysis[] | |
| createdAt DateTime | |
| updatedAt DateTime | |
| } | |
| model Analysis { | |
| id String | |
| type String | |
| result String | |
| summary String? | |
| repoId String? | |
| repo Repo? | |
| projectId String? | |
| project Project? | |
| createdAt DateTime | |
| } | |
| model AgentTask { | |
| id String | |
| type String | |
| status String | |
| input String | |
| output String? | |
| createdAt DateTime | |
| completedAt DateTime? | |
| } | |
| // ============================================ | |
| // MODELOS DE INFLUENCER (CHARACTER) | |
| // ============================================ | |
| model Character { | |
| id String | |
| name String | |
| slug String | |
| displayName String? | |
| shortBio String? | |
| description String? | |
| referenceImage String? // Imagen can贸nica para consistencia facial | |
| bodyReference String? // Referencia corporal | |
| traits String? // JSON con rasgos de personalidad | |
| orientation String? // Orientaci贸n/estilo (mujer, hombre gay, etc.) | |
| styleDescription String? // Descripci贸n visual para generaci贸n de im谩genes | |
| systemPrompt String? // Prompt base para el chat | |
| telegramBotToken String? // Token del bot de Telegram espec铆fico | |
| // Storytelling | |
| backstory String? // Historia de fondo | |
| personality String? // Personalidad detallada | |
| interests String? // JSON array de intereses | |
| catchphrases String? // JSON array de frases t铆picas | |
| // Configuraci贸n de chat por tier | |
| chatFreeLimit Int // Mensajes gratis por d铆a | |
| chatBasicTone String? // Tono para tier basic | |
| chatPremiumTone String? // Tono para tier premium (铆ntimo) | |
| chatProTone String? // Tono para tier pro (novia IA) | |
| isActive Boolean | |
| contents Content[] | |
| pets Pet[] | |
| chatSessions ChatSession[] | |
| assetDeliveries AssetDelivery[] | |
| createdAt DateTime | |
| updatedAt DateTime | |
| } | |
| // ============================================ | |
| // MODELOS DE CHAT / NOVIA IA | |
| // ============================================ | |
| model ChatSession { | |
| id String | |
| userId String | |
| user User | |
| characterId String | |
| character Character | |
| channel String // telegram, web, etc. | |
| heatScore Int // 0-100, sube con interacci贸n | |
| msgCountToday Int | |
| lastMessageAt DateTime? | |
| isActive Boolean | |
| messages ChatMessage[] | |
| createdAt DateTime | |
| updatedAt DateTime | |
| @ | |
| } | |
| model ChatMessage { | |
| id String | |
| sessionId String | |
| session ChatSession | |
| role String // "user", "assistant", "system" | |
| content String | |
| metadata String? // JSON (ej: si se envi贸 un asset) | |
| createdAt DateTime | |
| } | |
| // ============================================ | |
| // MODELOS DE CONTENIDO MULTIMEDIA | |
| // ============================================ | |
| model Content { | |
| id String | |
| type String // "image", "video", "audio", "text", "reel", "story", "carousel" | |
| title String | |
| description String? | |
| prompt String | |
| optimizedPrompt String? | |
| filePath String? | |
| thumbnail String? | |
| platform String | |
| status String | |
| nsfwLevel Int // 0=SFW, 1=suggestive, 2=NSFW, 3=explicit | |
| metadata String? | |
| projectId String? | |
| project Project? | |
| characterId String? | |
| character Character? | |
| petId String? | |
| pet Pet? | |
| censorFlags CensorFlag[] | |
| posts Post[] | |
| assetDeliveries AssetDelivery[] | |
| createdAt DateTime | |
| updatedAt DateTime | |
| } | |
| // Tracking de qu茅 assets se han enviado a qu茅 usuario | |
| model AssetDelivery { | |
| id String | |
| contentId String | |
| content Content | |
| userId String | |
| user User | |
| characterId String | |
| character Character | |
| channel String | |
| deliveredAt DateTime | |
| @ // No repetir el mismo asset al mismo usuario | |
| } | |
| // ============================================ | |
| // MODELOS DE CENSURA | |
| // ============================================ | |
| model CensorRule { | |
| id String | |
| platform String | |
| category String | |
| rule String | |
| severity String | |
| autoAction String | |
| isActive Boolean | |
| createdAt DateTime | |
| updatedAt DateTime | |
| } | |
| model CensorFlag { | |
| id String | |
| contentId String | |
| content Content | |
| category String | |
| reason String | |
| severity String | |
| action String | |
| createdAt DateTime | |
| } | |
| // ============================================ | |
| // MODELOS DE MONETIZACI脫N | |
| // ============================================ | |
| model MonetizationPlatform { | |
| id String | |
| name String // OnlyFans, Patreon, Fansly, etc. | |
| type String // "subscription", "tips", "ppv", "mixed" | |
| url String? | |
| apiKey String? | |
| accountId String? | |
| accountName String? | |
| legalTerms String? // JSON con t茅rminos legales | |
| contentRules String? // JSON con reglas de contenido | |
| feePercentage Float? | |
| payoutSchedule String? | |
| isActive Boolean | |
| isVerified Boolean | |
| metadata String? | |
| posts Post[] | |
| earnings Earning[] | |
| subscribers Subscriber[] | |
| createdAt DateTime | |
| updatedAt DateTime | |
| } | |
| model Subscriber { | |
| id String | |
| platformId String | |
| platform MonetizationPlatform | |
| externalId String? | |
| username String? | |
| tier String? | |
| status String | |
| joinedAt DateTime? | |
| expiresAt DateTime? | |
| totalSpent Float | |
| metadata String? | |
| createdAt DateTime | |
| updatedAt DateTime | |
| } | |
| model Earning { | |
| id String | |
| platformId String | |
| platform MonetizationPlatform | |
| subscriptionId String? | |
| subscription InfluencerSubscription? | |
| type String // "subscription", "post", "tip", "ppv" | |
| amount Float | |
| currency String | |
| postId String? | |
| subscriberId String? | |
| status String // pending, completed, failed | |
| paymentMethod String? // "card", "bank_transfer", "paypal" | |
| stripePaymentIntentId String? // Para rastrear en Stripe | |
| isRecurring Boolean | |
| description String? | |
| processedAt DateTime? | |
| metadata String? | |
| createdAt DateTime | |
| } | |
| // ============================================ | |
| // MODELOS DE PUBLICACI脫N | |
| // ============================================ | |
| model Post { | |
| id String | |
| title String? | |
| caption String? | |
| hashtags String? | |
| type String | |
| status String | |
| contentId String? | |
| content Content? | |
| platformId String? | |
| platform MonetizationPlatform? | |
| scheduledAt DateTime? | |
| publishedAt DateTime? | |
| externalPostId String? | |
| postUrl String? | |
| engagementStats String? | |
| storyId String? | |
| story Story? | |
| metadata String? | |
| createdAt DateTime | |
| updatedAt DateTime | |
| } | |
| // ============================================ | |
| // MODELOS DE STORYTELLING | |
| // ============================================ | |
| model Story { | |
| id String | |
| title String | |
| description String? | |
| genre String? | |
| targetAudience String? | |
| tone String? | |
| structure String? | |
| characterIds String? | |
| totalEpisodes Int | |
| currentEpisode Int | |
| status String | |
| monetizationStrategy String? | |
| posts Post[] | |
| episodes StoryEpisode[] | |
| analytics StoryAnalytics? | |
| createdAt DateTime | |
| updatedAt DateTime | |
| } | |
| model StoryEpisode { | |
| id String | |
| storyId String | |
| story Story | |
| episodeNum Int | |
| title String | |
| synopsis String? | |
| content String | |
| hook String? | |
| cliffhanger String? | |
| status String | |
| scheduledAt DateTime? | |
| publishedAt DateTime? | |
| createdAt DateTime | |
| updatedAt DateTime | |
| } | |
| model StoryAnalytics { | |
| id String | |
| storyId String | |
| story Story | |
| totalViews Int | |
| totalEngagement Float | |
| avgWatchTime Float? | |
| completionRate Float? | |
| revenue Float | |
| subscriberGain Int | |
| bestPerformingEpisode Int? | |
| metadata String? | |
| createdAt DateTime | |
| updatedAt DateTime | |
| } | |
| // ============================================ | |
| // MODELOS DE AUTOMATIZACI脫N | |
| // ============================================ | |
| model Automation { | |
| id String | |
| name String | |
| description String? | |
| type String | |
| trigger String | |
| triggerConfig String? | |
| actions String | |
| isActive Boolean | |
| lastRunAt DateTime? | |
| nextRunAt DateTime? | |
| runCount Int | |
| metadata String? | |
| createdAt DateTime | |
| updatedAt DateTime | |
| } | |
| model AutomationLog { | |
| id String | |
| automationId String? | |
| status String | |
| input String? | |
| output String? | |
| error String? | |
| duration Int? | |
| createdAt DateTime | |
| } | |
| // ============================================ | |
| // MODELOS DE TENDENCIAS | |
| // ============================================ | |
| model Trend { | |
| id String | |
| platform String | |
| type String | |
| name String | |
| description String? | |
| volume Int? | |
| growth Float? | |
| startDate DateTime? | |
| endDate DateTime? | |
| relatedTags String? | |
| contentIdeas String? | |
| isActive Boolean | |
| createdAt DateTime | |
| updatedAt DateTime | |
| } | |
| // ============================================ | |
| // MODELOS DE PLANTILLAS | |
| // ============================================ | |
| model PromptTemplate { | |
| id String | |
| name String | |
| category String | |
| template String | |
| variables String | |
| platform String | |
| isActive Boolean | |
| createdAt DateTime | |
| updatedAt DateTime | |
| } | |
| model ContentTemplate { | |
| id String | |
| name String | |
| type String | |
| platform String | |
| structure String | |
| hooks String? | |
| ctas String? | |
| hashtags String? | |
| bestTimes String? | |
| isActive Boolean | |
| createdAt DateTime | |
| updatedAt DateTime | |
| } | |
| // ============================================ | |
| // MODELOS DE MASCOTAS/COMPA脩EROS | |
| // ============================================ | |
| model Pet { | |
| id String | |
| name String | |
| type String | |
| breed String? | |
| description String? | |
| referenceImage String? | |
| traits String? | |
| personality String? | |
| color String? | |
| accessories String? | |
| characterId String? | |
| character Character? | |
| contents Content[] | |
| isActive Boolean | |
| createdAt DateTime | |
| updatedAt DateTime | |
| } | |
| // ============================================ | |
| // MODELOS DE INFLUENCERS IA DE REFERENCIA | |
| // ============================================ | |
| model AIInfluencer { | |
| id String | |
| name String | |
| handle String? | |
| platform String | |
| followers Int? | |
| engagement Float? | |
| niche String? | |
| style String? | |
| contentTypes String? | |
| postingSchedule String? | |
| visualStyle String? | |
| monetizationType String? | |
| signatureElements String? | |
| petCompanion Boolean | |
| petType String? | |
| analysis String? | |
| lessons String? | |
| isActive Boolean | |
| createdAt DateTime | |
| updatedAt DateTime | |
| influencerSubscriptions InfluencerSubscription[] | |
| } | |
| // Suscripciones por influencer: cada cliente se suscribe por separado a cada influencer | |
| model InfluencerSubscription { | |
| id String | |
| influencerId String | |
| influencer AIInfluencer | |
| userId String? | |
| user User? | |
| tier String // tier contratado para esta suscripci贸n (basic, premium, etc.) | |
| status String // active, paused, expired, cancelled | |
| joinedAt DateTime | |
| expiresAt DateTime? | |
| nextRenewalDate DateTime? // Pr贸xima fecha de renovaci贸n autom谩tica | |
| autoRenew Boolean // Renovaci贸n autom谩tica activada | |
| price Float? | |
| currency String | |
| // Integraci贸n con Stripe | |
| stripeSubscriptionId String? // ID de suscripci贸n en Stripe | |
| stripeCustomerId String? // ID de cliente en Stripe | |
| paymentMethodId String? // ID del m茅todo de pago en Stripe | |
| metadata String? | |
| earnings Earning[] // Relaci贸n con pagos registrados | |
| createdAt DateTime | |
| updatedAt DateTime | |
| } | |
| // ============================================ | |
| // MODELOS DE ESTRATEGIAS VIRALES | |
| // ============================================ | |
| model ViralStrategy { | |
| id String | |
| name String | |
| description String? | |
| platform String | |
| contentType String | |
| hook String? | |
| structure String? | |
| elements String? | |
| estimatedReach Int? | |
| difficulty String | |
| timeframe String? | |
| examples String? | |
| tags String? | |
| successRate Float? | |
| isActive Boolean | |
| createdAt DateTime | |
| updatedAt DateTime | |
| } | |