This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
# app/dto/response/__init__.py
|
||||
"""
|
||||
HealthSync AI 응답 DTO 패키지
|
||||
API 응답 모델들을 관리합니다.
|
||||
"""
|
||||
from .mission_response import MissionRecommendationResponse, RecommendedMission
|
||||
from .health_response import HealthDiagnosisResponse
|
||||
from .chat_response import ChatResponse
|
||||
from .chat_history_response import ChatHistoryResponse, ChatHistoryItem
|
||||
from .celebration_response import CelebrationResponse
|
||||
from .similar_mission_news_response import SimilarMissionNewsResponse, MissionNewsItem
|
||||
|
||||
__all__ = [
|
||||
"MissionRecommendationResponse",
|
||||
"RecommendedMission",
|
||||
"HealthDiagnosisResponse",
|
||||
"ChatResponse",
|
||||
"ChatHistoryResponse",
|
||||
"ChatHistoryItem",
|
||||
"CelebrationResponse",
|
||||
"SimilarMissionNewsResponse",
|
||||
"MissionNewsItem"
|
||||
]
|
||||
@@ -0,0 +1,17 @@
|
||||
# app/dto/response/celebration_response.py
|
||||
"""
|
||||
HealthSync AI 미션 축하 응답 DTO
|
||||
"""
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class CelebrationResponse(BaseModel):
|
||||
"""미션 축하 응답 DTO"""
|
||||
congratsMessage: str = Field(..., description="축하 메시지")
|
||||
|
||||
class Config:
|
||||
json_schema_extra = {
|
||||
"example": {
|
||||
"congratsMessage": "🎉 30분 걷기 미션 완료! 건강한 하루를 만들어가시는 모습이 정말 멋져요! 💪✨"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
# app/dto/response/chat_history_response.py
|
||||
"""
|
||||
HealthSync AI 채팅 히스토리 응답 DTO
|
||||
"""
|
||||
from pydantic import BaseModel, Field
|
||||
from datetime import datetime
|
||||
from typing import List, Optional
|
||||
|
||||
|
||||
class ChatHistoryItem(BaseModel):
|
||||
"""개별 채팅 기록 항목"""
|
||||
message_id: int = Field(..., description="메시지 ID")
|
||||
message_type: str = Field(..., description="메시지 타입")
|
||||
message_content: Optional[str] = Field(None, description="사용자 질문 내용 (축하/독려 메시지의 경우 null)")
|
||||
response_content: str = Field(..., description="AI 응답 내용")
|
||||
created_at: datetime = Field(..., description="생성 시간")
|
||||
|
||||
class Config:
|
||||
json_encoders = {
|
||||
datetime: lambda v: v.isoformat()
|
||||
}
|
||||
|
||||
|
||||
class ChatHistoryResponse(BaseModel):
|
||||
"""채팅 히스토리 응답 DTO"""
|
||||
chat_history: List[ChatHistoryItem] = Field(..., description="채팅 기록 목록")
|
||||
total_count: int = Field(..., description="전체 채팅 수")
|
||||
|
||||
class Config:
|
||||
json_schema_extra = {
|
||||
"example": {
|
||||
"chat_history": [
|
||||
{
|
||||
"message_id": 15,
|
||||
"message_type": "consultation",
|
||||
"message_content": "혈압이 높은데 어떻게 관리해야 하나요?",
|
||||
"response_content": "혈압 관리를 위해서는 규칙적인 유산소 운동과 저염식 식단을 권장합니다.",
|
||||
"created_at": "2025-06-16T14:30:00.000Z"
|
||||
},
|
||||
{
|
||||
"message_id": 12,
|
||||
"message_type": "consultation",
|
||||
"message_content": "콜레스테롤 수치가 높다고 나왔는데 음식 조절 방법을 알려주세요.",
|
||||
"response_content": "콜레스테롤 관리를 위해 포화지방 섭취를 줄이고 오메가3가 풍부한 생선을 섭취하시기 바랍니다.",
|
||||
"created_at": "2025-06-15T10:15:00.000Z"
|
||||
}
|
||||
],
|
||||
"total_count": 2
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
# app/dto/response/chat_response.py
|
||||
"""
|
||||
HealthSync AI 챗봇 상담 응답 DTO
|
||||
"""
|
||||
from pydantic import BaseModel, Field
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class ChatResponse(BaseModel):
|
||||
"""챗봇 상담 응답 DTO"""
|
||||
response: str = Field(..., description="AI 답변 내용")
|
||||
timestamp: datetime = Field(..., description="답변 생성 시간")
|
||||
|
||||
class Config:
|
||||
json_encoders = {
|
||||
datetime: lambda v: v.isoformat()
|
||||
}
|
||||
json_schema_extra = {
|
||||
"example": {
|
||||
"response": "혈압 관리를 위해서는 규칙적인 유산소 운동과 저염식 식단을 권장합니다. 특히 IT 업무 특성상 스트레스 관리도 중요하므로 명상이나 심호흡 운동을 병행하시기 바랍니다.",
|
||||
"timestamp": "2025-06-16T10:30:00.000Z"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
# app/dto/response/health_response.py
|
||||
"""
|
||||
HealthSync AI 건강 분석 응답 DTO
|
||||
"""
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class HealthDiagnosisResponse(BaseModel):
|
||||
"""건강 진단 응답 DTO"""
|
||||
threeSentenceSummary: str = Field(..., description="3줄 요약 진단")
|
||||
|
||||
class Config:
|
||||
json_schema_extra = {
|
||||
"example": {
|
||||
"threeSentenceSummary": "혈압과 콜레스테롤 수치가 정상 범위를 약간 초과하여 심혈관 질환 위험이 있습니다. IT 개발자 직업 특성상 장시간 앉아있어 운동 부족과 스트레스가 주요 원인으로 보입니다. 규칙적인 유산소 운동과 식단 조절을 통해 충분히 개선 가능한 상태입니다."
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
"""
|
||||
HealthSync AI 미션 추천 응답 DTO
|
||||
"""
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import List
|
||||
|
||||
|
||||
class RecommendedMission(BaseModel):
|
||||
"""추천 미션 개별 DTO"""
|
||||
title: str = Field(..., description="미션 제목")
|
||||
daily_target_count: int = Field(..., ge=1, le=5, description="일일 목표 횟수 (1-5)")
|
||||
reason: str = Field(..., description="추천 이유")
|
||||
|
||||
class Config:
|
||||
json_schema_extra = {
|
||||
"example": {
|
||||
"title": "하루 30분 이상 걷기",
|
||||
"daily_target_count": 1,
|
||||
"reason": "유산소 운동을 통해 심혈관 건강을 개선하고 체중 관리에 도움이 됩니다."
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class MissionRecommendationResponse(BaseModel):
|
||||
"""미션 추천 응답 DTO"""
|
||||
missions: List[RecommendedMission] = Field(..., description="추천 미션 목록")
|
||||
|
||||
class Config:
|
||||
json_schema_extra = {
|
||||
"example": {
|
||||
"missions": [
|
||||
{
|
||||
"mission_id": "mission_001",
|
||||
"title": "하루 30분 이상 걷기",
|
||||
"daily_target_count": 1,
|
||||
"reason": "혈압이 높고 체중이 증가한 상태로, 유산소 운동을 통해 심혈관 건강을 개선하고 체중 관리에 도움이 됩니다."
|
||||
},
|
||||
{
|
||||
"mission_id": "mission_002",
|
||||
"title": "물 2컵씩 마시기",
|
||||
"daily_target_count": 4,
|
||||
"reason": "충분한 수분 섭취로 혈액 순환을 개선하고 신진대사를 활성화하여 전반적인 건강 상태를 향상시킵니다."
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
# app/dto/response/similar_mission_news_response.py
|
||||
"""
|
||||
HealthSync AI 유사 사용자 미션 완료 소식 응답 DTO
|
||||
"""
|
||||
from pydantic import BaseModel, Field
|
||||
from datetime import datetime
|
||||
from typing import List
|
||||
|
||||
|
||||
class MissionNewsItem(BaseModel):
|
||||
"""개별 미션 소식 항목"""
|
||||
message: str = Field(..., description="미션 완료 소식 메시지")
|
||||
mission_category: str = Field(..., description="미션 카테고리")
|
||||
similarity_score: float = Field(..., description="유사도 점수 (0-1)")
|
||||
completed_at: datetime = Field(..., description="완료 시간")
|
||||
|
||||
class Config:
|
||||
json_encoders = {
|
||||
datetime: lambda v: v.isoformat()
|
||||
}
|
||||
|
||||
|
||||
class SimilarMissionNewsResponse(BaseModel):
|
||||
"""유사 사용자 미션 완료 소식 응답 DTO"""
|
||||
similar_mission_news: List[MissionNewsItem] = Field(..., description="유사 사용자 미션 소식 목록")
|
||||
total_count: int = Field(..., description="전체 소식 수")
|
||||
|
||||
class Config:
|
||||
json_schema_extra = {
|
||||
"example": {
|
||||
"similar_mission_news": [
|
||||
{
|
||||
"message": "IT직군 김OO님이 물마시기 미션을 완료했어요! 💧",
|
||||
"mission_category": "hydration",
|
||||
"similarity_score": 0.87,
|
||||
"completed_at": "2025-06-17T10:30:00.000Z"
|
||||
},
|
||||
{
|
||||
"message": "23세 혈당높은 홍OO님이 산책 3회를 완료했어요! 🚶♀️",
|
||||
"mission_category": "exercise",
|
||||
"similarity_score": 0.82,
|
||||
"completed_at": "2025-06-17T09:15:00.000Z"
|
||||
},
|
||||
{
|
||||
"message": "사무직 박OO님이 스트레칭 미션을 달성했어요! 🧘♂️",
|
||||
"mission_category": "stretching",
|
||||
"similarity_score": 0.79,
|
||||
"completed_at": "2025-06-17T08:45:00.000Z"
|
||||
}
|
||||
],
|
||||
"total_count": 3
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user