agent and category Dto creation

This commit is contained in:
pradeepkumar
2026-01-11 20:59:12 +05:30
parent 14ca59f02c
commit c72be7d2ac
35 changed files with 3665 additions and 317 deletions

View File

@@ -1,5 +1,5 @@
// Real Estate Agent Platform - Database Schema
// Milestone 1: Foundation & Authentication
// Milestone 1 & 2: Foundation, Authentication & Agent Features
generator client {
provider = "prisma-client-js"
@@ -33,6 +33,19 @@ enum AuthProvider {
TWITTER
}
enum VerificationStatus {
PENDING
APPROVED
REJECTED
}
enum VerificationDocType {
LICENSE
ID_CARD
CERTIFICATE
OTHER
}
// ===========================================
// USER - Authentication Only
// ===========================================
@@ -45,6 +58,7 @@ model User {
status UserStatus @default(ACTIVE)
emailVerified Boolean @default(false)
emailVerifiedAt DateTime?
avatar String? // Profile picture URL
// Social Auth
authProvider AuthProvider @default(LOCAL)
@@ -112,7 +126,7 @@ model AgentProfile {
lastName String?
phone String?
avatar String?
bio String?
bio String? @db.Text
headline String?
// Location
@@ -120,29 +134,162 @@ model AgentProfile {
state String?
country String?
address String?
zipCode String?
latitude Float?
longitude Float?
// Professional Info
yearsOfExperience Int?
licenseNumber String?
companyName String?
website String?
// Social Links
facebookUrl String?
twitterUrl String?
linkedinUrl String?
instagramUrl String?
// Verification Status
isVerified Boolean @default(false)
verifiedAt DateTime?
// Profile Status
isProfileComplete Boolean @default(false)
profileCompleteness Int @default(0)
isPublic Boolean @default(true)
isFeatured Boolean @default(false)
// Stats (denormalized for performance)
totalReviews Int @default(0)
averageRating Float @default(0)
// Timestamps
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
// Relations
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
specializations AgentSpecialization[]
verificationRequests VerificationRequest[]
@@index([userId])
@@index([slug])
@@index([city, state])
@@index([isVerified])
@@index([isPublic])
@@index([isFeatured])
@@map("agent_profiles")
}
// ===========================================
// CATEGORY - Main categories for agents
// ===========================================
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)
// Timestamps
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
// Relations
specializations Specialization[]
@@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")
}
// ===========================================
// SESSION - JWT Token Management
// ===========================================