이 문서는 개발 시작 전 큰 그림을 잡기 위한 문서입니다. 상세 스키마/API는 개발하면서 확정합니다.


1. 엔티티 관계도

User (사용자)
├── Goal (목표) - 1:1
│   └── Track (트랙) - 1:N
│       ├── Mission (미션) - 1:N
│       │   └── MissionLog (완료 기록) - 1:N
│       └── ActionGuide (액션가이드) - 1:N
│
├── Diary (일기) - 1:N
│   └── DiaryEmbedding (임베딩) - 1:1
│
├── Chat (대화) - 1:N
│   └── ChatEmbedding (임베딩) - 1:1
│
├── EnergyLog (에너지 기록) - 1:N
└── DeviceToken (푸시 토큰) - 1:N

2. 주요 엔티티

2.1 사용자/인증

엔티티 핵심 필드 설명
User id, email, nickname, provider, createdAt 사용자 정보
DeviceToken id, userId, token, platform, createdAt FCM 푸시 토큰

2.2 목표/트랙/미션

엔티티 핵심 필드 설명
Goal id, userId, title, status, createdAt 사용자 목표 (1개)
Track id, goalId, title, type, status, order 트랙 (3~4개)
Mission id, trackId, title, ready, action, week, day, order 미션
MissionLog id, missionId, userId, date, readyDone, actionDone, memo, photoUrl 완료 기록
ActionGuide id, trackId, content, order 액션가이드

Track.type:

Track.status:

2.3 일기/대화

엔티티 핵심 필드 설명
Diary id, userId, content, mood, aiComment, createdAt 일기
Chat id, userId, role, content, context, createdAt AI 대화
DiaryEmbedding id, diaryId, embedding(vector) RAG용 임베딩
ChatEmbedding id, chatId, embedding(vector) RAG용 임베딩

Chat.role:

2.4 에너지

엔티티 핵심 필드 설명
EnergyLog id, userId, level, date, time, createdAt 에너지 체크 기록

EnergyLog.level: 1~5 (😵~⚡)


3. 핵심 API