User Schema
{
nickname: String (unique),
email: String (unique),
password: String (hashed),
kakaoId: String (unique, sparse),
createdAt: Date,
updatedAt: Date
}
Plan Schema
{
name: String,
price: Number,
data: String,// "무제한", "20GB" 등
call: String,// "무제한", "300분" 등
sms: String,// "무제한", "100건" 등
description: String,
features: [String],
tags: [String],
targetAge: String,
benefits: [String],
category: String,// '5G', 'LTE'
isActive: Boolean,
createdAt: Date,
updatedAt: Date
}
Bookmark Schema
{
userId: ObjectId (ref: User),
planId: ObjectId (ref: Plan),
createdAt: Date
}
DiagnosisQuestion Schema
{
order: Number,
question: String,
type: String,// 'single', 'multiple', 'range'
options: [String],
weight: Number,
category: String,// 'data', 'call', 'price'
isActive: Boolean,
createdAt: Date,
updatedAt: Date
}
DiagnosisResult Schema
{
userId: ObjectId (ref: User, optional),
sessionId: String,
answers: [{
questionId: ObjectId (ref: DiagnosisQuestion),
answer: String
}],
recommendedPlans: [ObjectId (ref: Plan)],
score: {
data: Number,
call: Number,
price: Number
},
createdAt: Date
}
Conversation Schema
{
sessionId: String, // 클라이언트 식별자 (예: "client_1750438045987")
messages: [
{
role: String, // 'user' | 'assistant' | 'system'
content: String | Array, // 일반 메시지 또는 추천 질문 배열
type: String, // 'bot' | 'user' | 'faq-recommend' 등 (선택)
timestamp: Date // 기본값: Date.now()
}
],
metadata: {
ipAddress: String, // 클라이언트 IP (선택)
userAgent: String // 브라우저 정보 (선택)
},
createdAt: Date,
updatedAt: Date
}
예시 메시지 타입별 content
일반 텍스트 메시지
{
"role": "assistant",
"content": "안녕하세요, 요플밍입니다!",
"type": "bot"
}
추천 질문 메시지 (faq-recommend)
{
"role": "assistant",
"content": ["10대 요금제 추천", "무제한 요금제 알려줘", "통화 많은 요금제"],
"type": "faq-recommend"
}