feat: update seed data for Cabo Pickleball Club

- Organization: Cabo Pickleball Club, Mazatlan timezone
- Single site: Corridor Courts, Cabo San Lucas
- 6 outdoor courts at 300 MXN/person
- Admin: ivan@horuxfin.com
- 5 membership plans: Day Pass, 10-Day, 10-Morning, Monthly, Family
- Pickleball products replacing padel items

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ivan
2026-03-01 21:29:16 +00:00
parent d3419a8cc5
commit 25b1495bb0

View File

@@ -40,12 +40,12 @@ async function main() {
const organization = await prisma.organization.create({
data: {
name: 'SmashPoint Demo',
slug: 'smashpoint-demo',
name: 'Cabo Pickleball Club',
slug: 'cabo-pickleball-club',
settings: {
currency: 'MXN',
timezone: 'America/Mexico_City',
language: 'es',
timezone: 'America/Mazatlan',
language: 'en',
},
},
});
@@ -56,39 +56,19 @@ async function main() {
// =============================================================================
// SITES
// =============================================================================
console.log('Creating sites...');
console.log('Creating site...');
const sitesData = [
{
name: 'Sede Norte',
slug: 'sede-norte',
address: 'Av. Universidad 1000, Col. Del Valle',
phone: '+52 55 1234 5678',
email: 'norte@smashpoint.com',
timezone: 'America/Mexico_City',
name: 'Corridor Courts',
slug: 'corridor-courts',
address: 'Corridor area, Cabo San Lucas, BCS',
phone: '+52-624-151-5455',
email: 'topdogcabo@yahoo.com',
timezone: 'America/Mazatlan',
openTime: '07:00',
closeTime: '23:00',
},
{
name: 'Sede Sur',
slug: 'sede-sur',
address: 'Av. Insurgentes 2000, Col. Roma',
phone: '+52 55 2345 6789',
email: 'sur@smashpoint.com',
timezone: 'America/Mexico_City',
openTime: '08:00',
closeTime: '22:00',
},
{
name: 'Sede Centro',
slug: 'sede-centro',
address: 'Calle Reforma 500, Centro Historico',
phone: '+52 55 3456 7890',
email: 'centro@smashpoint.com',
timezone: 'America/Mexico_City',
openTime: '06:00',
closeTime: '24:00',
},
];
const sites = await Promise.all(
@@ -107,44 +87,27 @@ async function main() {
console.log('');
// =============================================================================
// COURTS (2 per site)
// COURTS (6 outdoor courts)
// =============================================================================
console.log('Creating courts...');
const courts: { id: string; name: string; siteId: string }[] = [];
for (const site of sites) {
const courtData = [
{
name: 'Cancha 1',
type: CourtType.INDOOR,
for (let i = 1; i <= 6; i++) {
const created = await prisma.court.create({
data: {
siteId: sites[0].id,
name: `Court ${i}`,
type: CourtType.OUTDOOR,
status: CourtStatus.AVAILABLE,
pricePerHour: 350,
description: 'Cancha techada con iluminacion LED',
features: ['Iluminacion LED', 'Techada', 'Cristal panoramico'],
displayOrder: 1,
pricePerHour: 300,
description: 'Outdoor court with night lighting',
features: ['Night lighting', 'Court dividers'],
displayOrder: i,
},
{
name: 'Cancha 2',
type: CourtType.INDOOR,
status: CourtStatus.AVAILABLE,
pricePerHour: 450,
description: 'Cancha premium con aire acondicionado',
features: ['Iluminacion LED', 'Techada', 'Aire acondicionado', 'Cristal panoramico', 'Premium'],
displayOrder: 2,
},
];
for (const court of courtData) {
const created = await prisma.court.create({
data: {
siteId: site.id,
...court,
},
});
courts.push(created);
console.log(` Created court: ${site.name} - ${created.name}`);
}
});
courts.push(created);
console.log(` Created court: ${created.name}`);
}
console.log('');
@@ -152,17 +115,17 @@ async function main() {
// =============================================================================
// ADMIN USER (SUPER_ADMIN)
// =============================================================================
console.log('Creating admin users...');
console.log('Creating admin user...');
const hashedPassword = await bcrypt.hash('admin123', 10);
const hashedPassword = await bcrypt.hash('Aasi940812', 10);
const adminUser = await prisma.user.create({
data: {
organizationId: organization.id,
email: 'admin@smashpoint.com',
email: 'ivan@horuxfin.com',
password: hashedPassword,
firstName: 'Administrador',
lastName: 'Sistema',
firstName: 'Ivan',
lastName: 'Admin',
role: UserRole.SUPER_ADMIN,
phone: '+52 55 9999 0000',
siteIds: sites.map(s => s.id),
@@ -171,41 +134,6 @@ async function main() {
console.log(` Created super admin: ${adminUser.email}`);
// =============================================================================
// SITE ADMINS (one per site)
// =============================================================================
const siteAdminsData = [
{ email: 'norte@smashpoint.com', firstName: 'Carlos', lastName: 'Rodriguez', site: sites[0] },
{ email: 'sur@smashpoint.com', firstName: 'Maria', lastName: 'Gonzalez', site: sites[1] },
{ email: 'centro@smashpoint.com', firstName: 'Luis', lastName: 'Hernandez', site: sites[2] },
];
for (const adminData of siteAdminsData) {
const siteAdmin = await prisma.user.create({
data: {
organizationId: organization.id,
email: adminData.email,
password: hashedPassword,
firstName: adminData.firstName,
lastName: adminData.lastName,
role: UserRole.SITE_ADMIN,
siteIds: [adminData.site.id],
},
});
// Connect user to site
await prisma.site.update({
where: { id: adminData.site.id },
data: {
users: {
connect: { id: siteAdmin.id },
},
},
});
console.log(` Created site admin: ${siteAdmin.email} (${adminData.site.name})`);
}
console.log('');
// =============================================================================
@@ -214,10 +142,10 @@ async function main() {
console.log('Creating product categories...');
const categoriesData = [
{ name: 'Bebidas', description: 'Bebidas y refrescos', displayOrder: 1 },
{ name: 'Snacks', description: 'Botanas y snacks', displayOrder: 2 },
{ name: 'Equipamiento', description: 'Equipo y accesorios de padel', displayOrder: 3 },
{ name: 'Alquiler', description: 'Articulos en renta', displayOrder: 4 },
{ name: 'Drinks', description: 'Beverages and refreshments', displayOrder: 1 },
{ name: 'Snacks', description: 'Snacks and light food', displayOrder: 2 },
{ name: 'Equipment', description: 'Pickleball equipment and accessories', displayOrder: 3 },
{ name: 'Rental', description: 'Rental items', displayOrder: 4 },
];
const categories: { id: string; name: string }[] = [];
@@ -236,28 +164,24 @@ async function main() {
console.log('');
// =============================================================================
// PRODUCTS (for organization, shown in Sede Norte initially)
// PRODUCTS
// =============================================================================
console.log('Creating products...');
const bebidasCategory = categories.find(c => c.name === 'Bebidas');
const drinksCategory = categories.find(c => c.name === 'Drinks');
const snacksCategory = categories.find(c => c.name === 'Snacks');
const equipamientoCategory = categories.find(c => c.name === 'Equipamiento');
const alquilerCategory = categories.find(c => c.name === 'Alquiler');
const equipmentCategory = categories.find(c => c.name === 'Equipment');
const rentalCategory = categories.find(c => c.name === 'Rental');
const productsData = [
// Bebidas
{ name: 'Agua', description: 'Agua natural 600ml', price: 20, costPrice: 8, stock: 100, categoryId: bebidasCategory?.id, sku: 'BEB-001' },
{ name: 'Gatorade', description: 'Bebida deportiva 500ml', price: 35, costPrice: 18, stock: 50, categoryId: bebidasCategory?.id, sku: 'BEB-002' },
{ name: 'Cerveza', description: 'Cerveza artesanal 355ml', price: 45, costPrice: 22, stock: 48, categoryId: bebidasCategory?.id, sku: 'BEB-003' },
// Snacks
{ name: 'Papas', description: 'Papas fritas 45g', price: 25, costPrice: 12, stock: 30, categoryId: snacksCategory?.id, sku: 'SNK-001' },
{ name: 'Barra energetica', description: 'Barra de proteina 50g', price: 30, costPrice: 15, stock: 25, categoryId: snacksCategory?.id, sku: 'SNK-002' },
// Equipamiento
{ name: 'Pelotas HEAD', description: 'Tubo de 3 pelotas HEAD Pro', price: 180, costPrice: 90, stock: 20, categoryId: equipamientoCategory?.id, sku: 'EQP-001' },
{ name: 'Grip', description: 'Overgrip Wilson Pro', price: 50, costPrice: 25, stock: 40, categoryId: equipamientoCategory?.id, sku: 'EQP-002' },
// Alquiler
{ name: 'Raqueta alquiler', description: 'Raqueta de padel (por hora)', price: 100, costPrice: 0, stock: 10, categoryId: alquilerCategory?.id, sku: 'ALQ-001', trackStock: false },
{ name: 'Water', description: 'Natural water 600ml', price: 20, costPrice: 8, stock: 100, categoryId: drinksCategory?.id, sku: 'DRK-001' },
{ name: 'Gatorade', description: 'Sports drink 500ml', price: 35, costPrice: 18, stock: 50, categoryId: drinksCategory?.id, sku: 'DRK-002' },
{ name: 'Beer', description: 'Craft beer 355ml', price: 45, costPrice: 22, stock: 48, categoryId: drinksCategory?.id, sku: 'DRK-003' },
{ name: 'Chips', description: 'Potato chips 45g', price: 25, costPrice: 12, stock: 30, categoryId: snacksCategory?.id, sku: 'SNK-001' },
{ name: 'Energy Bar', description: 'Protein bar 50g', price: 30, costPrice: 15, stock: 25, categoryId: snacksCategory?.id, sku: 'SNK-002' },
{ name: 'Pickleballs', description: 'Franklin X-40 Outdoor (3 pack)', price: 180, costPrice: 90, stock: 20, categoryId: equipmentCategory?.id, sku: 'EQP-001' },
{ name: 'Paddle Grip', description: 'Replacement grip', price: 50, costPrice: 25, stock: 40, categoryId: equipmentCategory?.id, sku: 'EQP-002' },
{ name: 'Paddle Rental', description: 'Pickleball paddle rental (per session)', price: 100, costPrice: 0, stock: 10, categoryId: rentalCategory?.id, sku: 'RNT-001', trackStock: false },
];
for (const productData of productsData) {
@@ -279,31 +203,49 @@ async function main() {
const membershipPlansData = [
{
name: 'Basico',
description: 'Plan basico mensual con beneficios esenciales',
price: 499,
name: 'Day Pass',
description: 'Single day access to all courts',
price: 300,
durationMonths: 1,
courtHours: 2,
discountPercent: 10,
benefits: ['2 horas gratis de cancha al mes', '10% descuento en reservas', '5% descuento en tienda'],
courtHours: 0,
discountPercent: 0,
benefits: ['Full day access', 'All courts', 'Night play included'],
},
{
name: 'Premium',
description: 'Plan premium con mayores beneficios',
price: 899,
durationMonths: 1,
courtHours: 5,
discountPercent: 20,
benefits: ['5 horas gratis de cancha al mes', '20% descuento en reservas', '10% descuento en tienda', 'Acceso prioritario a torneos'],
},
{
name: 'VIP',
description: 'Plan VIP con todos los beneficios',
price: 1499,
durationMonths: 1,
name: '10-Day Pass',
description: '10 visits, any time of day',
price: 2500,
durationMonths: 3,
courtHours: 10,
discountPercent: 15,
benefits: ['10 day passes', 'Valid any time', 'Save vs single day pass'],
},
{
name: '10-Morning Pass',
description: '10 morning sessions (7am-12pm)',
price: 2000,
durationMonths: 3,
courtHours: 10,
discountPercent: 10,
benefits: ['10 morning passes', '7:00 AM - 12:00 PM only', 'Best value for morning players'],
},
{
name: 'Monthly Individual',
description: 'Unlimited monthly access for one player',
price: 4000,
durationMonths: 1,
courtHours: 30,
discountPercent: 25,
benefits: ['Unlimited court access', 'Priority booking', 'All time slots'],
},
{
name: 'Monthly Family',
description: 'Unlimited monthly access for up to 4 family members',
price: 6500,
durationMonths: 1,
courtHours: 60,
discountPercent: 30,
benefits: ['10 horas gratis de cancha al mes', '30% descuento en reservas', '15% descuento en tienda', 'Acceso prioritario a torneos', 'Invitados con descuento', 'Casillero incluido'],
benefits: ['Up to 4 family members', 'Unlimited court access', 'Priority booking', 'All time slots'],
},
];
@@ -317,7 +259,7 @@ async function main() {
},
});
membershipPlans.push(plan);
console.log(` Created membership plan: ${plan.name} - $${plan.price}/mes`);
console.log(` Created membership plan: ${plan.name} - $${plan.price}`);
}
console.log('');
@@ -386,31 +328,31 @@ async function main() {
console.log('');
// =============================================================================
// MEMBERSHIP FOR ONE CLIENT (Maria Garcia with Premium)
// MEMBERSHIP FOR ONE CLIENT (Maria Garcia with Monthly Individual)
// =============================================================================
console.log('Creating sample membership...');
const premiumPlan = membershipPlans.find(p => p.name === 'Premium');
const monthlyPlan = membershipPlans.find(p => p.name === 'Monthly Individual');
const mariaClient = clients.find(c => c.firstName === 'Maria');
if (premiumPlan && mariaClient) {
if (monthlyPlan && mariaClient) {
const startDate = new Date();
const endDate = new Date();
endDate.setMonth(endDate.getMonth() + 1);
const membership = await prisma.membership.create({
data: {
planId: premiumPlan.id,
planId: monthlyPlan.id,
clientId: mariaClient.id,
startDate,
endDate,
status: MembershipStatus.ACTIVE,
remainingHours: premiumPlan.courtHours,
remainingHours: monthlyPlan.courtHours,
autoRenew: true,
},
});
console.log(` Created Premium membership for ${mariaClient.firstName} ${mariaClient.lastName}`);
console.log(` Created Monthly Individual membership for ${mariaClient.firstName} ${mariaClient.lastName}`);
}
console.log('');
@@ -424,9 +366,9 @@ async function main() {
console.log('');
console.log('Summary:');
console.log(` - 1 Organization: ${organization.name}`);
console.log(` - ${sites.length} Sites`);
console.log(` - ${courts.length} Courts (${courts.length / sites.length} per site)`);
console.log(` - 4 Users (1 super admin + 3 site admins)`);
console.log(` - ${sites.length} Site`);
console.log(` - ${courts.length} Courts`);
console.log(` - 1 Admin user`);
console.log(` - ${categories.length} Product Categories`);
console.log(` - ${productsData.length} Products`);
console.log(` - ${membershipPlans.length} Membership Plans`);
@@ -434,8 +376,7 @@ async function main() {
console.log(` - 1 Active Membership`);
console.log('');
console.log('Login credentials:');
console.log(' Super Admin: admin@smashpoint.com / admin123');
console.log(' Site Admins: norte@smashpoint.com, sur@smashpoint.com, centro@smashpoint.com / admin123');
console.log(' Admin: ivan@horuxfin.com / Aasi940812');
console.log('');
}