feat: 新增心情打卡功能模块

实现心情打卡的完整功能,包括数据库表设计、API接口、业务逻辑和文档说明。支持记录多种心情类型、强度评分和统计分析功能。
This commit is contained in:
richarjiang
2025-08-21 15:20:05 +08:00
parent 513d6e071d
commit f26d8e64c6
9 changed files with 888 additions and 0 deletions

94
test-mood-checkins.http Normal file
View File

@@ -0,0 +1,94 @@
### 心情打卡功能测试
### 1. 创建心情打卡 - 开心
POST http://localhost:3000/mood-checkins
Authorization: Bearer YOUR_JWT_TOKEN
Content-Type: application/json
{
"moodType": "happy",
"intensity": 8,
"description": "今天完成了重要的项目,心情很好!",
"checkinDate": "2025-08-21",
"metadata": {
"tags": ["工作", "成就感"],
"trigger": "完成项目里程碑"
}
}
### 2. 创建心情打卡 - 焦虑
POST http://localhost:3000/mood-checkins
Authorization: Bearer YOUR_JWT_TOKEN
Content-Type: application/json
{
"moodType": "anxious",
"intensity": 6,
"description": "明天有重要的会议,感到有些紧张",
"checkinDate": "2025-08-21",
"metadata": {
"tags": ["工作", "压力"],
"trigger": "重要会议前的紧张"
}
}
### 3. 创建心情打卡 - 心动
POST http://localhost:3000/mood-checkins
Authorization: Bearer YOUR_JWT_TOKEN
Content-Type: application/json
{
"moodType": "excited",
"intensity": 9,
"description": "看到喜欢的人发来消息,心跳加速",
"checkinDate": "2025-08-21",
"metadata": {
"tags": ["感情", "甜蜜"],
"trigger": "收到心仪对象的消息"
}
}
### 3. 获取今日心情打卡
GET http://localhost:3000/mood-checkins/daily
Authorization: Bearer YOUR_JWT_TOKEN
### 4. 获取指定日期心情打卡
GET http://localhost:3000/mood-checkins/daily?date=2025-08-21
Authorization: Bearer YOUR_JWT_TOKEN
### 5. 获取心情打卡历史
GET http://localhost:3000/mood-checkins/history?startDate=2025-08-01&endDate=2025-08-31
Authorization: Bearer YOUR_JWT_TOKEN
### 6. 获取心情打卡历史(按类型过滤)
GET http://localhost:3000/mood-checkins/history?startDate=2025-08-01&endDate=2025-08-31&moodType=happy
Authorization: Bearer YOUR_JWT_TOKEN
### 7. 获取心情统计数据
GET http://localhost:3000/mood-checkins/statistics?startDate=2025-08-01&endDate=2025-08-31
Authorization: Bearer YOUR_JWT_TOKEN
### 8. 更新心情打卡
PUT http://localhost:3000/mood-checkins
Authorization: Bearer YOUR_JWT_TOKEN
Content-Type: application/json
{
"id": "MOOD_CHECKIN_ID",
"moodType": "thrilled",
"intensity": 9,
"description": "更新后的心情描述 - 非常兴奋!",
"metadata": {
"tags": ["更新", "兴奋"],
"trigger": "收到好消息"
}
}
### 9. 删除心情打卡
DELETE http://localhost:3000/mood-checkins
Authorization: Bearer YOUR_JWT_TOKEN
Content-Type: application/json
{
"id": "MOOD_CHECKIN_ID"
}