Spaces:
Configuration error
Configuration error
| generator client { | |
| provider = "prisma-client-js" | |
| } | |
| datasource db { | |
| provider = "postgresql" | |
| } | |
| model User { | |
| id String | |
| email String | |
| name String? | |
| username String? | |
| image String? | |
| bio String? | |
| rank String? // bronze, silver, gold, verified | |
| totalRuns Int | |
| totalStars Int | |
| totalRemixes Int | |
| socialLinks Json? | |
| // Notification preferences | |
| notifyEmail Boolean | |
| notifyStars Boolean | |
| notifyRemixes Boolean | |
| // Stripe / Billing | |
| stripeCustomerId String? | |
| stripePlan String // free, pro | |
| stripeSubscriptionId String? | |
| stripeSubscriptionStatus String? // active, canceled, past_due, etc. | |
| createdAt DateTime | |
| updatedAt DateTime | |
| prompts Prompt[] | |
| stars Star[] | |
| runs Run[] | |
| collections Collection[] | |
| comments Comment[] | |
| commentLikes CommentLike[] | |
| imagePrompts ImagePrompt[] | |
| imageVotes ImagePromptVote[] | |
| characters Character[] | |
| characterVotes CharacterVote[] | |
| workflows Workflow[] | |
| forumPosts ForumPost[] | |
| forumReplies ForumReply[] | |
| notifications Notification[] | |
| followers Follow[] | |
| following Follow[] | |
| subscription Subscription? | |
| purchases PromptPurchase[] | |
| } | |
| model Prompt { | |
| id String | |
| slug String | |
| title String | |
| description String? | |
| template String .Text | |
| schema Json | |
| category String? | |
| tags String[] | |
| visibility String // public, unlisted, private | |
| modelDefault String | |
| modelAllowed String[] | |
| maxTokens Int | |
| totalRuns Int | |
| starsCount Int | |
| remixesCount Int | |
| // Tier 3 fields | |
| framework String? // RACE, CARE, APE, etc. | |
| badges String[] // Auto-calculated quality badges | |
| // Version tracking | |
| currentVersion Int | |
| // Premium marketplace | |
| isPremium Boolean // Is this a paid prompt? | |
| price Int? // Price in cents (e.g., 299 = $2.99) | |
| creatorId String? | |
| creator User? | |
| parentId String? | |
| parent Prompt? | |
| remixes Prompt[] | |
| stars Star[] | |
| runs Run[] | |
| savedRuns SavedPromptRun[] | |
| collections CollectionPrompt[] | |
| comments Comment[] | |
| versions PromptVersion[] | |
| purchases PromptPurchase[] | |
| createdAt DateTime | |
| updatedAt DateTime | |
| @ | |
| @ | |
| @ | |
| @ | |
| } | |
| model Star { | |
| userId String | |
| promptId String | |
| user User | |
| prompt Prompt | |
| createdAt DateTime | |
| @ | |
| } | |
| model Run { | |
| id String | |
| promptId String | |
| userId String? | |
| model String | |
| tokens Int? | |
| cached Boolean | |
| ipHash String? | |
| prompt Prompt | |
| user User? | |
| createdAt DateTime | |
| @ | |
| @ | |
| } | |
| model Collection { | |
| id String | |
| name String | |
| description String? | |
| userId String | |
| user User | |
| prompts CollectionPrompt[] | |
| isPublic Boolean | |
| viewCount Int | |
| createdAt DateTime | |
| updatedAt DateTime | |
| @ | |
| @ | |
| } | |
| model CollectionPrompt { | |
| collectionId String | |
| promptId String | |
| collection Collection | |
| prompt Prompt | |
| addedAt DateTime | |
| @ | |
| @ | |
| @ | |
| } | |
| model Workflow { | |
| id String | |
| slug String | |
| name String | |
| description String? | |
| steps Json // Array of workflow steps | |
| variables Json? // Input variables for the workflow | |
| visibility String // public, unlisted, private | |
| totalRuns Int | |
| starsCount Int | |
| creatorId String? | |
| creator User? | |
| runs WorkflowRun[] | |
| createdAt DateTime | |
| updatedAt DateTime | |
| @ | |
| @ | |
| @ | |
| } | |
| model WorkflowRun { | |
| id String | |
| workflowId String | |
| workflow Workflow | |
| userId String? // Who ran it | |
| name String? // Optional name for the run (user can name it) | |
| variables Json? // The variable values used for this run | |
| outputs Json // Array of step outputs | |
| model String // Model used for the run | |
| createdAt DateTime | |
| @ | |
| @ | |
| } | |
| // Saved prompt execution results | |
| model SavedPromptRun { | |
| id String | |
| promptId String | |
| prompt Prompt | |
| userId String? | |
| name String? | |
| variables Json? // Variable values used | |
| output String .Text // The AI output | |
| model String | |
| createdAt DateTime | |
| @ | |
| @ | |
| } | |
| // Saved AI tool execution results | |
| model SavedToolRun { | |
| id String | |
| toolSlug String // Tool identifier (no relation, tools are static) | |
| userId String? | |
| name String? | |
| inputs Json? // Input values used | |
| output String .Text // The AI output | |
| model String | |
| createdAt DateTime | |
| @ | |
| @ | |
| } | |
| // Saved model comparison results (Thunderdome / Performance) | |
| model SavedComparison { | |
| id String | |
| type String // "thunderdome" or "performance" | |
| userId String? | |
| name String? | |
| prompt String .Text // The prompt used | |
| results Json // Array of model results with outputs | |
| winner String? // Winning model (for thunderdome) | |
| createdAt DateTime | |
| @ | |
| @ | |
| } | |
| // ============================================ | |
| // NEW FEATURES - December 2025 | |
| // ============================================ | |
| // Comments on prompts (threaded discussions) | |
| model Comment { | |
| id String | |
| content String .Text | |
| promptId String | |
| prompt Prompt | |
| userId String | |
| user User | |
| parentId String? // For threaded replies | |
| parent Comment? | |
| replies Comment[] | |
| // Per-user like tracking (replaces plain Int to prevent spam) | |
| commentLikes CommentLike[] | |
| likesCount Int // Denormalized count for quick display | |
| createdAt DateTime | |
| updatedAt DateTime | |
| @ | |
| @ | |
| @ | |
| } | |
| // Per-user comment likes — prevents duplicate/spam likes | |
| model CommentLike { | |
| commentId String | |
| comment Comment | |
| userId String | |
| user User | |
| createdAt DateTime | |
| @ | |
| @ | |
| @ | |
| } | |
| // Image Generation Prompts (Midjourney, DALL-E, Stable Diffusion, FLUX) | |
| model ImagePrompt { | |
| id String | |
| slug String | |
| title String | |
| description String? | |
| // The actual prompt text | |
| prompt String .Text | |
| negativePrompt String? .Text // For SD/FLUX | |
| // Target model | |
| model String // midjourney, dalle, stable-diffusion, flux, leonardo | |
| modelVersion String? // v6.1, SDXL, FLUX.1-dev, etc. | |
| // Image settings | |
| aspectRatio String? // 16:9, 1:1, 9:16, etc. | |
| style String? // photorealistic, anime, cartoon, etc. | |
| // Generated image preview (URL) | |
| previewImage String? | |
| gallery String[] // Multiple generated images | |
| // Metadata | |
| category String? // portrait, landscape, abstract, etc. | |
| tags String[] | |
| visibility String | |
| // Stats | |
| totalUses Int | |
| votesCount Int | |
| savesCount Int | |
| creatorId String? | |
| creator User? | |
| votes ImagePromptVote[] | |
| createdAt DateTime | |
| updatedAt DateTime | |
| @ | |
| @ | |
| @ | |
| @ | |
| } | |
| // Votes for image prompts | |
| model ImagePromptVote { | |
| id String | |
| imagePromptId String | |
| imagePrompt ImagePrompt | |
| userId String | |
| user User | |
| value Int // 1 for upvote, -1 for downvote | |
| createdAt DateTime | |
| @ | |
| @ | |
| @ | |
| } | |
| // Character/Persona System | |
| model Character { | |
| id String | |
| slug String | |
| name String | |
| description String? .Text | |
| // Persona definition | |
| personality String .Text // Character's personality traits | |
| background String? .Text // Character's backstory | |
| systemPrompt String .Text // The actual system prompt | |
| // Visual representation | |
| avatar String? // URL to avatar image | |
| style String? // anime, realistic, cartoon, etc. | |
| // Metadata | |
| category String? // assistant, roleplay, educational, etc. | |
| tags String[] | |
| visibility String | |
| // Conversation settings | |
| responseStyle String? // formal, casual, playful, etc. | |
| temperature Float | |
| // Stats | |
| totalChats Int | |
| votesCount Int | |
| savesCount Int | |
| creatorId String? | |
| creator User? | |
| votes CharacterVote[] | |
| createdAt DateTime | |
| updatedAt DateTime | |
| @ | |
| @ | |
| @ | |
| } | |
| // Votes for characters | |
| model CharacterVote { | |
| id String | |
| characterId String | |
| character Character | |
| userId String | |
| user User | |
| value Int | |
| createdAt DateTime | |
| @ | |
| @ | |
| @ | |
| } | |
| // Engagement metrics tracking | |
| model EngagementMetric { | |
| id String | |
| // What was engaged with | |
| targetType String // prompt, imagePrompt, character, workflow | |
| targetId String | |
| // Type of engagement | |
| action String // view, use, save, share, copy | |
| userId String? // Null for anonymous | |
| ipHash String? // For anonymous tracking | |
| createdAt DateTime | |
| @ | |
| @ | |
| @ | |
| } | |
| // Extension Analytics - tracks prompt usage from extension | |
| model ExtensionAnalytics { | |
| id String | |
| // User tracking | |
| userId String? // Null for anonymous users | |
| deviceId String // Unique device identifier from extension | |
| // What action was taken | |
| action String // inject, capture, broadcast, shortcut_use, context_menu | |
| // Platform info | |
| platform String // chatgpt, claude, gemini, etc. | |
| platforms String[] // For broadcast (multiple platforms) | |
| // Prompt info (optional - for inject/capture) | |
| promptId String? // If from OpenPrompt library | |
| promptTitle String? | |
| promptText String? .Text // For captured prompts | |
| // Source info | |
| source String // extension, website | |
| // Metadata | |
| metadata Json? // Additional data like shortcut used, etc. | |
| createdAt DateTime | |
| @ | |
| @ | |
| @ | |
| @ | |
| @ | |
| } | |
| // Captured prompts from AI chats (saved by users via extension) | |
| model CapturedPrompt { | |
| id String | |
| userId String? | |
| deviceId String | |
| title String? | |
| text String .Text | |
| platform String // Where it was captured from | |
| url String? // Original URL | |
| // If saved to library | |
| savedToLibrary Boolean | |
| promptId String? // If converted to a Prompt | |
| tags String[] | |
| createdAt DateTime | |
| @ | |
| @ | |
| @ | |
| @ | |
| } | |
| // ============================================ | |
| // COMMUNITY FEATURES - December 2025 | |
| // ============================================ | |
| // Forum Posts (Community Q&A) | |
| model ForumPost { | |
| id String | |
| title String | |
| content String .Text | |
| category String // general, help, showcase, feature-request, tips | |
| userId String | |
| user User | |
| replies ForumReply[] | |
| views Int | |
| likes Int | |
| isPinned Boolean | |
| isClosed Boolean | |
| createdAt DateTime | |
| updatedAt DateTime | |
| @ | |
| @ | |
| @ | |
| } | |
| // Forum Replies | |
| model ForumReply { | |
| id String | |
| content String .Text | |
| postId String | |
| post ForumPost | |
| userId String | |
| user User | |
| parentId String? // For nested replies | |
| likes Int | |
| isAccepted Boolean | |
| createdAt DateTime | |
| updatedAt DateTime | |
| @ | |
| @ | |
| @ | |
| } | |
| // User Conversations (Messaging) | |
| model Conversation { | |
| id String | |
| participant1 String | |
| participant2 String | |
| messages Message[] | |
| lastMessage String? .Text | |
| lastActivity DateTime | |
| createdAt DateTime | |
| @ | |
| @ | |
| @ | |
| @ | |
| } | |
| // Direct Messages | |
| model Message { | |
| id String | |
| content String .Text | |
| senderId String | |
| conversationId String | |
| conversation Conversation | |
| isRead Boolean | |
| createdAt DateTime | |
| @ | |
| @ | |
| @ | |
| } | |
| // Character Memory (Persistent context) | |
| model CharacterMemory { | |
| id String | |
| characterId String | |
| userId String | |
| contextSummary String? .Text | |
| recentMessages Json | |
| userFacts Json | |
| messageCount Int | |
| createdAt DateTime | |
| updatedAt DateTime | |
| @ | |
| @ | |
| @ | |
| } | |
| // ============================================ | |
| // NEW FEATURES - Follow & Notifications | |
| // ============================================ | |
| // Follow system for creators | |
| model Follow { | |
| id String | |
| followerId String | |
| follower User | |
| followingId String | |
| following User | |
| createdAt DateTime | |
| @ | |
| @ | |
| @ | |
| } | |
| // Notification system | |
| model Notification { | |
| id String | |
| userId String // Who receives the notification | |
| user User | |
| type String // star, remix, comment, follow, mention | |
| title String | |
| message String? | |
| // What triggered the notification | |
| actorId String? // Who performed the action | |
| targetType String? // prompt, workflow, comment, etc. | |
| targetId String? | |
| targetSlug String? // For linking | |
| isRead Boolean | |
| createdAt DateTime | |
| @ | |
| @ | |
| } | |
| // Prompt version history | |
| model PromptVersion { | |
| id String | |
| promptId String | |
| prompt Prompt | |
| version Int | |
| title String | |
| template String .Text | |
| schema Json | |
| changeNote String? // What changed | |
| createdAt DateTime | |
| @ | |
| @ | |
| } | |
| // ============================================ | |
| // BILLING — Stripe Integration | |
| // ============================================ | |
| // Active subscription record (one per user) | |
| model Subscription { | |
| id String | |
| userId String | |
| user User | |
| // Stripe identifiers | |
| stripeCustomerId String | |
| stripeSubscriptionId String | |
| stripePriceId String | |
| // Plan info | |
| plan String // pro, enterprise | |
| status String // active, canceled, past_due, trialing, unpaid | |
| // Billing cycle | |
| currentPeriodStart DateTime | |
| currentPeriodEnd DateTime | |
| cancelAtPeriodEnd Boolean | |
| canceledAt DateTime? | |
| createdAt DateTime | |
| updatedAt DateTime | |
| @ | |
| @ | |
| } | |
| // Records when a user purchases a premium prompt | |
| model PromptPurchase { | |
| id String | |
| userId String | |
| user User | |
| promptId String | |
| prompt Prompt | |
| // Payment info | |
| amount Int // in cents | |
| currency String | |
| stripePaymentIntentId String | |
| // Creator payout (80% to creator) | |
| creatorPayout Int // 80% of amount in cents | |
| creatorPaid Boolean | |
| createdAt DateTime | |
| @ // One purchase per user per prompt | |
| @ | |
| @ | |
| } | |