feat: implement core platform features including business directory, admin dashboard, authentication, and API infrastructure
Some checks failed
Build and Push App / build (push) Failing after 16m2s
Some checks failed
Build and Push App / build (push) Failing after 16m2s
This commit is contained in:
97
prisma/seed-plans.ts
Normal file
97
prisma/seed-plans.ts
Normal file
@@ -0,0 +1,97 @@
|
||||
import pkg from '@prisma/client';
|
||||
const { PrismaClient } = pkg;
|
||||
import { PrismaPg } from '@prisma/adapter-pg';
|
||||
import pg from 'pg';
|
||||
import dotenv from 'dotenv';
|
||||
|
||||
dotenv.config({ path: '.env.local' });
|
||||
dotenv.config();
|
||||
|
||||
const connectionString = process.env.DATABASE_URL!;
|
||||
const pool = new pg.Pool({ connectionString });
|
||||
const adapter = new PrismaPg(pool);
|
||||
const prisma = new PrismaClient({ adapter });
|
||||
|
||||
const Plan = {
|
||||
STARTER: 'STARTER',
|
||||
BOOSTER: 'BOOSTER',
|
||||
EMPIRE: 'EMPIRE'
|
||||
} as const;
|
||||
|
||||
async function main() {
|
||||
console.log('Seeding pricing plans...');
|
||||
|
||||
const plans = [
|
||||
{
|
||||
tier: Plan.STARTER,
|
||||
name: 'Starter',
|
||||
priceXOF: 'Gratuit',
|
||||
priceEUR: '0€',
|
||||
description: 'Pour démarrer votre présence en ligne.',
|
||||
features: [
|
||||
'Fiche entreprise basique',
|
||||
'Visible dans la recherche',
|
||||
'1 Offre produit/service',
|
||||
'Support par email'
|
||||
],
|
||||
offerLimit: 1,
|
||||
recommended: false,
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
tier: Plan.BOOSTER,
|
||||
name: 'Booster',
|
||||
priceXOF: '5.000 FCFA',
|
||||
priceEUR: '8€',
|
||||
description: "L'indispensable pour les entreprises en croissance.",
|
||||
features: [
|
||||
'Tout du plan Starter',
|
||||
'Badge "Vérifié" ✅',
|
||||
'Jusqu\'à 10 Offres produits',
|
||||
'Lien vers réseaux sociaux & Site Web',
|
||||
'Statistiques de base (Vues)'
|
||||
],
|
||||
offerLimit: 10,
|
||||
recommended: true,
|
||||
color: 'brand'
|
||||
},
|
||||
{
|
||||
tier: Plan.EMPIRE,
|
||||
name: 'Empire',
|
||||
priceXOF: '15.000 FCFA',
|
||||
priceEUR: '23€',
|
||||
description: 'Dominez votre marché avec une visibilité maximale.',
|
||||
features: [
|
||||
'Tout du plan Booster',
|
||||
'Badge "Recommandé" 🏆',
|
||||
'Offres illimitées',
|
||||
'Intégration vidéo Youtube',
|
||||
'Interview écrite sur le Blog',
|
||||
'Support prioritaire WhatsApp'
|
||||
],
|
||||
offerLimit: 1000,
|
||||
recommended: false,
|
||||
color: 'gray'
|
||||
}
|
||||
];
|
||||
|
||||
for (const planData of plans) {
|
||||
await prisma.pricingPlan.upsert({
|
||||
where: { tier: planData.tier as any },
|
||||
update: planData,
|
||||
create: planData,
|
||||
});
|
||||
}
|
||||
|
||||
console.log('Pricing plans seeded successfully.');
|
||||
}
|
||||
|
||||
main()
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
})
|
||||
.finally(async () => {
|
||||
await prisma.$disconnect();
|
||||
await pool.end();
|
||||
});
|
||||
Reference in New Issue
Block a user