feat: Implement pricing page, AI generation/transformation APIs, user/project management, and database schema.
This commit is contained in:
@@ -7,16 +7,38 @@ generator client {
|
||||
}
|
||||
|
||||
// =====================
|
||||
// AUTH
|
||||
// AUTH & SUBSCRIPTIONS
|
||||
// =====================
|
||||
model Plan {
|
||||
id String @id // e.g., 'free', 'pro', 'master'
|
||||
name String @unique
|
||||
displayName String
|
||||
price Float
|
||||
description String
|
||||
maxProjects Int // -1 for unlimited
|
||||
maxAiActions Int // -1 for unlimited
|
||||
features String[]
|
||||
isPopular Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
users User[]
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(cuid())
|
||||
name String?
|
||||
email String @unique
|
||||
hashedPassword String
|
||||
avatar String?
|
||||
bio String?
|
||||
plan String @default("free") // free | pro | master
|
||||
|
||||
// Legacy string plan (temporarily kept to avoid DB drop errors)
|
||||
plan String @default("free")
|
||||
|
||||
// New Subscription
|
||||
planId String? @default("free")
|
||||
subscriptionPlan Plan? @relation(fields: [planId], references: [id])
|
||||
|
||||
aiActionsUsed Int @default(0)
|
||||
dailyWordGoal Int @default(500)
|
||||
writingStreak Int @default(0)
|
||||
|
||||
64
prisma/seed.ts
Normal file
64
prisma/seed.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
import { config } from 'dotenv';
|
||||
config({ path: '.env.local' });
|
||||
import getDB from '../src/lib/prisma';
|
||||
|
||||
const prisma = getDB();
|
||||
|
||||
async function main() {
|
||||
console.log('Seeding plans...');
|
||||
|
||||
const plans = [
|
||||
{
|
||||
id: 'free',
|
||||
name: 'free',
|
||||
displayName: 'Gratuit',
|
||||
price: 0,
|
||||
description: 'Idéal pour découvrir PlumeIA.',
|
||||
maxProjects: 1,
|
||||
maxAiActions: 10,
|
||||
features: ['10 actions IA / mois', '1 projet actif', 'Bible du monde simple'],
|
||||
isPopular: false,
|
||||
},
|
||||
{
|
||||
id: 'pro',
|
||||
name: 'pro',
|
||||
displayName: 'Auteur Pro',
|
||||
price: 12,
|
||||
description: 'Pour les écrivains sérieux.',
|
||||
maxProjects: -1, // -1 means unlimited
|
||||
maxAiActions: 500,
|
||||
features: ['500 actions IA / mois', 'Projets illimités', 'Export Word & EPUB', 'Support prioritaire'],
|
||||
isPopular: true,
|
||||
},
|
||||
{
|
||||
id: 'master',
|
||||
name: 'master',
|
||||
displayName: 'Maître Plume',
|
||||
price: 29,
|
||||
description: 'Le summum de l\'écriture IA.',
|
||||
maxProjects: -1,
|
||||
maxAiActions: -1, // -1 means unlimited
|
||||
features: ['Actions IA illimitées', 'Accès Gemini 3 Pro', 'Bible du monde avancée', 'Outils de révision avancés'],
|
||||
isPopular: false,
|
||||
},
|
||||
];
|
||||
|
||||
for (const plan of plans) {
|
||||
await prisma.plan.upsert({
|
||||
where: { id: plan.id },
|
||||
update: plan,
|
||||
create: plan,
|
||||
});
|
||||
}
|
||||
|
||||
console.log('Plans seeded successfully.');
|
||||
}
|
||||
|
||||
main()
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
})
|
||||
.finally(async () => {
|
||||
await prisma.$disconnect();
|
||||
});
|
||||
Reference in New Issue
Block a user