# AI日记系统数据库结构

## _User
- **系统字段**
  - objectId
  - username
  - email
  - emailVerified
  - authData
  - password
  - createdAt
  - updatedAt
- **扩展字段**
  - nickname
  - avatar
  - bio
  - lastActiveAt
  - privacySettings

## Diary
- **基础字段**
  - objectId
  - createdAt
  - updatedAt
  - title
  - content
- **关联字段**
  - author → _User
- **功能字段**
  - mood
  - tags
  - isPublic
  - location(GeoPoint)
  - weather
  - aiAnalysis

## ChatMessage
- **基础字段**
  - objectId
  - createdAt
  - updatedAt
  - content
- **关联字段**
  - sender → _User
  - receiver → _User
  - diaryRef → Diary
- **状态字段**
  - isRead
  - messageType
- **媒体字段**
  - attachments[File]

## Moment
- **基础字段**
  - objectId
  - createdAt
  - updatedAt
  - content
- **关联字段**
  - creator → _User
  - refDiary → Diary
- **媒体字段**
  - images[File]
- **地理字段**
  - location(GeoPoint)
- **统计字段**
  - interactionCount

## Interaction
- **基础字段**
  - objectId
  - createdAt
  - updatedAt
  - type
- **关联字段**
  - fromUser → _User
  - toUser → _User
  - targetId(Pointer)
- **分类字段**
  - targetType
- **内容字段**
  - content
- **状态字段**
  - status

## 关系网络
- _User 1→n Diary
- _User 1→n ChatMessage
- _User 1→n Moment
- _User 1→n Interaction
- Diary 1→n ChatMessage
- Diary 1→n Moment
- Diary 1→n Interaction
- Moment 1→n Interaction