新增会话管理功能,包括获取会话列表、获取会话详情和删除会话的API,更新AI教练模块以支持会话模型,调整相关服务和数据传输对象。

This commit is contained in:
richarjiang
2025-08-14 11:23:33 +08:00
parent d1a6e3d42e
commit 8c358a21f7
7 changed files with 170 additions and 24 deletions

View File

@@ -80,18 +80,19 @@ export class UsersService {
};
}
const profile = await this.userProfileModel.findByPk(existingUser.id);
const [profile] = await this.userProfileModel.findOrCreate({
where: { userId: existingUser.id },
defaults: { userId: existingUser.id },
});
const returnData = {
...existingUser.toJSON(),
maxUsageCount: DEFAULT_FREE_USAGE_COUNT,
isVip: existingUser.isVip,
profile: profile ? {
dailyStepsGoal: profile.dailyStepsGoal,
dailyCaloriesGoal: profile.dailyCaloriesGoal,
pilatesPurposes: profile.pilatesPurposes,
weight: profile.weight,
height: profile.height,
} : undefined,
dailyStepsGoal: profile?.dailyStepsGoal,
dailyCaloriesGoal: profile?.dailyCaloriesGoal,
pilatesPurposes: profile?.pilatesPurposes,
weight: profile?.weight,
height: profile?.height,
}
this.logger.log(`getProfile returnData: ${JSON.stringify(returnData, null, 2)}`);