65 lines
1.8 KiB
TypeScript
65 lines
1.8 KiB
TypeScript
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: 5, // -1 means unlimited
|
|
maxAiActions: 75,
|
|
features: ['75 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: 20,
|
|
maxAiActions: 250, // -1 means unlimited
|
|
features: ['250 actions IA / mois', '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();
|
|
});
|