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

@@ -33,18 +33,6 @@ enum AuthProvider {
TWITTER
}
enum VerificationStatus {
PENDING
APPROVED
REJECTED
}
enum VerificationDocType {
LICENSE
ID_CARD
CERTIFICATE
OTHER
}
// ===========================================
// USER - Authentication Only
@@ -120,6 +108,7 @@ model AgentProfile {
id String @id @default(uuid())
userId String @unique
slug String @unique
agentTypeId String?
// Basic Info
firstName String?
@@ -170,10 +159,10 @@ model AgentProfile {
// Relations
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
specializations AgentSpecialization[]
verificationRequests VerificationRequest[]
agentType AgentType? @relation(fields: [agentTypeId], references: [id])
@@index([userId])
@@index([agentTypeId])
@@index([slug])
@@index([city, state])
@@index([isVerified])
@@ -183,111 +172,26 @@ model AgentProfile {
}
// ===========================================
// CATEGORY - Main categories for agents
// AGENT TYPE - Dynamic agent types (Professional, Lender, etc.)
// ===========================================
model Category {
id String @id @default(uuid())
name String @unique
slug String @unique
description String?
icon String?
image String?
isActive Boolean @default(true)
sortOrder Int @default(0)
model AgentType {
id String @id @default(uuid())
name String @unique
description String?
icon String?
isActive Boolean @default(true)
sortOrder Int @default(0)
// Timestamps
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
// Relations
specializations Specialization[]
agents AgentProfile[]
@@index([slug])
@@index([isActive])
@@map("categories")
}
// ===========================================
// SPECIALIZATION - Sub-categories under Category
// ===========================================
model Specialization {
id String @id @default(uuid())
categoryId String
name String
slug String @unique
description String?
isActive Boolean @default(true)
sortOrder Int @default(0)
// Timestamps
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
// Relations
category Category @relation(fields: [categoryId], references: [id], onDelete: Cascade)
agents AgentSpecialization[]
@@unique([categoryId, name])
@@index([categoryId])
@@index([slug])
@@map("specializations")
}
// ===========================================
// AGENT SPECIALIZATION - Many-to-Many pivot
// ===========================================
model AgentSpecialization {
id String @id @default(uuid())
agentProfileId String
specializationId String
// Timestamps
createdAt DateTime @default(now())
// Relations
agentProfile AgentProfile @relation(fields: [agentProfileId], references: [id], onDelete: Cascade)
specialization Specialization @relation(fields: [specializationId], references: [id], onDelete: Cascade)
@@unique([agentProfileId, specializationId])
@@index([agentProfileId])
@@index([specializationId])
@@map("agent_specializations")
}
// ===========================================
// VERIFICATION REQUEST - Agent verification
// ===========================================
model VerificationRequest {
id String @id @default(uuid())
agentProfileId String
// Document Info
documentType VerificationDocType
documentUrl String
documentName String?
notes String? @db.Text
// Status
status VerificationStatus @default(PENDING)
reviewedAt DateTime?
reviewedBy String? // Admin user ID
adminNotes String? @db.Text
rejectionReason String?
// Timestamps
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
// Relations
agentProfile AgentProfile @relation(fields: [agentProfileId], references: [id], onDelete: Cascade)
@@index([agentProfileId])
@@index([status])
@@map("verification_requests")
@@map("agent_types")
}
// ===========================================