mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-02-13 17:55:46 +01:00
fix: resolve Prettier markdown code block parsing errors
- Fix syntax errors in skills markdown files (.github/skills, .opencode/skills) - Change typescript to tsx for code blocks with JSX - Replace ellipsis (...) in array examples with valid syntax - Separate CSS from TypeScript into distinct code blocks - Convert JavaScript object examples to valid JSON in docs - Fix enum definitions with proper comma separation
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
// seed.ts - Create initial admin user, company, and AI models
|
||||
// seed.ts - Create initial company and AI models
|
||||
// Note: Users are created via Neon Auth signup, this just creates the placeholder
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
import bcrypt from "bcryptjs";
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
console.log("🌱 Starting database seeding...");
|
||||
console.log("Starting database seeding...");
|
||||
|
||||
// Create the Jumbo company
|
||||
const company = await prisma.company.create({
|
||||
@@ -17,19 +17,29 @@ async function main() {
|
||||
csvPassword: "jumboadmin",
|
||||
},
|
||||
});
|
||||
console.log(`✅ Created company: ${company.name}`);
|
||||
console.log(`Created company: ${company.name}`);
|
||||
|
||||
// Create admin user
|
||||
const hashedPassword = await bcrypt.hash("8QbL26tB7fWS", 10);
|
||||
// Create admin user placeholder (they'll complete signup via Neon Auth)
|
||||
const adminUser = await prisma.user.create({
|
||||
data: {
|
||||
email: "max.kowalski.contact@gmail.com",
|
||||
password: hashedPassword,
|
||||
name: "Max Kowalski",
|
||||
role: "ADMIN",
|
||||
companyId: company.id,
|
||||
},
|
||||
});
|
||||
console.log(`✅ Created admin user: ${adminUser.email}`);
|
||||
console.log(`Created admin user placeholder: ${adminUser.email}`);
|
||||
|
||||
// Create platform super admin placeholder
|
||||
const platformAdmin = await prisma.user.create({
|
||||
data: {
|
||||
email: "admin@notso.ai",
|
||||
name: "Platform Admin",
|
||||
role: "PLATFORM_SUPER_ADMIN",
|
||||
companyId: null, // Platform users have no company
|
||||
},
|
||||
});
|
||||
console.log(`Created platform admin placeholder: ${platformAdmin.email}`);
|
||||
|
||||
// Create AI Models
|
||||
const aiModels = [
|
||||
@@ -59,13 +69,13 @@ async function main() {
|
||||
},
|
||||
];
|
||||
|
||||
const createdModels: any[] = [];
|
||||
const createdModels: { id: string; name: string }[] = [];
|
||||
for (const modelData of aiModels) {
|
||||
const model = await prisma.aIModel.create({
|
||||
data: modelData,
|
||||
});
|
||||
createdModels.push(model);
|
||||
console.log(`✅ Created AI model: ${model.name}`);
|
||||
console.log(`Created AI model: ${model.name}`);
|
||||
}
|
||||
|
||||
// Create current pricing for AI models (as of December 2024)
|
||||
@@ -102,10 +112,10 @@ async function main() {
|
||||
promptTokenCost: pricing.promptTokenCost,
|
||||
completionTokenCost: pricing.completionTokenCost,
|
||||
effectiveFrom: currentTime,
|
||||
effectiveUntil: null, // Current pricing
|
||||
effectiveUntil: null,
|
||||
},
|
||||
});
|
||||
console.log(`✅ Created pricing for: ${model.name}`);
|
||||
console.log(`Created pricing for: ${model.name}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,21 +129,25 @@ async function main() {
|
||||
isDefault: true,
|
||||
},
|
||||
});
|
||||
console.log(`✅ Set default AI model for company: ${defaultModel.name}`);
|
||||
console.log(`Set default AI model for company: ${defaultModel.name}`);
|
||||
}
|
||||
|
||||
console.log("\n🎉 Database seeding completed successfully!");
|
||||
console.log("\n📋 Summary:");
|
||||
console.log("\nDatabase seeding completed successfully!");
|
||||
console.log("\nSummary:");
|
||||
console.log(`Company: ${company.name}`);
|
||||
console.log(`Admin user: ${adminUser.email}`);
|
||||
console.log(`Password: 8QbL26tB7fWS`);
|
||||
console.log(
|
||||
`Admin user: ${adminUser.email} (needs to sign up via /auth/sign-up)`
|
||||
);
|
||||
console.log(
|
||||
`Platform admin: ${platformAdmin.email} (needs to sign up via /auth/sign-up)`
|
||||
);
|
||||
console.log(
|
||||
`AI Models: ${createdModels.length} models created with current pricing`
|
||||
);
|
||||
console.log(`Default model: ${defaultModel?.name}`);
|
||||
console.log("\n🚀 Ready to start importing CSV data!");
|
||||
console.log("\nReady to start importing CSV data!");
|
||||
} catch (error) {
|
||||
console.error("❌ Error seeding database:", error);
|
||||
console.error("Error seeding database:", error);
|
||||
process.exit(1);
|
||||
} finally {
|
||||
await prisma.$disconnect();
|
||||
|
||||
Reference in New Issue
Block a user