feat: Introduce agent types module, replacing categories and verification modules, and updating agent-related DTOs, services, and Prisma schema.

This commit is contained in:
pradeepkumar
2026-01-20 12:16:01 +05:30
parent c04ca2bcef
commit 3df8ea067a
30 changed files with 345 additions and 1559 deletions

View File

@@ -12,7 +12,48 @@ async function main() {
console.log('🌱 Starting database seeding...\n');
// Admin credentials
// =============================================
// Seed Agent Types
// =============================================
console.log('📋 Seeding Agent Types...');
const agentTypes = [
{
name: 'Professional',
description: 'Licensed real estate professionals',
icon: 'briefcase',
sortOrder: 1,
},
{
name: 'Lender',
description: 'Mortgage and loan specialists',
icon: 'bank',
sortOrder: 2,
},
];
for (const agentType of agentTypes) {
const existing = await prisma.agentType.findUnique({
where: { name: agentType.name },
});
if (existing) {
console.log(` ⚠️ Agent type "${agentType.name}" already exists`);
} else {
await prisma.agentType.create({
data: agentType,
});
console.log(` ✅ Created agent type: ${agentType.name}`);
}
}
console.log('');
// =============================================
// Seed Admin User
// =============================================
console.log('👤 Seeding Admin User...');
const adminEmail = process.env.ADMIN_EMAIL || 'admin@realestate.com';
const adminPassword = process.env.ADMIN_PASSWORD || 'Admin@123456';
@@ -25,7 +66,7 @@ async function main() {
});
if (existingAdmin) {
console.log(`⚠️ Admin user already exists: ${adminEmail}`);
console.log(` ⚠️ Admin user already exists: ${adminEmail}`);
} else {
// Create admin user
const admin = await prisma.user.create({
@@ -40,7 +81,7 @@ async function main() {
},
});
console.log('✅ Admin user created successfully!');
console.log(' ✅ Admin user created successfully!');
console.log(' ───────────────────────────────');
console.log(` 📧 Email: ${adminEmail}`);
console.log(` 🔑 Password: ${adminPassword}`);
@@ -49,13 +90,17 @@ async function main() {
console.log(' ───────────────────────────────\n');
}
// =============================================
// Summary
// =============================================
const userCount = await prisma.user.count();
const adminCount = await prisma.user.count({ where: { role: UserRole.ADMIN } });
const agentTypeCount = await prisma.agentType.count();
console.log('📊 Database Summary:');
console.log(` Total Users: ${userCount}`);
console.log(` Admins: ${adminCount}`);
console.log(` Total Users: ${userCount}`);
console.log(` Admins: ${adminCount}`);
console.log(` Agent Types: ${agentTypeCount}`);
console.log('\n🌱 Seeding completed!\n');
await prisma.$disconnect();