9 Commits

Author SHA1 Message Date
cfb7ddedd3 feat: implement user identity middleware for session management
- Added UserIdentityMiddleware to manage user sessions by generating a unique user ID stored in a cookie.
- Implemented logic to update the last seen timestamp for existing users in the database.
- Enhanced ScaleResult model to associate responses with users, improving data tracking and user experience.
2025-06-17 15:44:10 +08:00
319844e55c feat: add CSV download endpoint for scale results
- Implemented a new endpoint to download scale results as a CSV file.
- The endpoint retrieves responses based on the scale ID and formats the data, including question IDs and subscale scores, into a CSV format.
- Updated database URL to remove the public directory reference for better file access.
2025-06-16 10:19:52 +08:00
fc9d439cf9 feat: add created_at timestamp to ScaleResult model and response handling
- Introduced created_at field in the ScaleResult model to track response creation time.
- Updated result handling logic in app.py to populate created_at with the current UTC time when saving responses.
2025-06-16 09:08:21 +08:00
90720b3cec refactor: rename RawResponse to ScaleResult for improved clarity
- Updated the database model from RawResponse to ScaleResult to better reflect its purpose.
- Adjusted the result handling logic in app.py to utilize the new ScaleResult model for storing user responses.
2025-06-16 06:50:25 +08:00
ce020a5674 refactor: update response model and location handling
- Renamed RawResponse model to Response for clarity.
- Changed location field type from String to JSON in the Response model.
- Updated result handling logic to store location as a JSON object instead of a string.
2025-06-16 06:47:40 +08:00
7cb36eb1af fix: update database URL to point to public directory
- Changed the SQLALCHEMY_DATABASE_URL to use the public directory for the SQLite database file, ensuring proper access and organization of database resources.
2025-06-16 06:39:49 +08:00
ee9e6a5cca feat: 增强IP地址记录功能以支持地理位置获取
- 在app.py中新增GeoIP2数据库支持,获取用户IP的地理位置信息
- 更新RawResponse模型,新增location、raw_response、sum_response和avg_response字段以存储更多用户响应数据
- 修改结果处理逻辑,保存用户的地理位置信息和响应数据
- 更新.gitignore以排除GeoLite2-City.mmdb文件
2025-06-16 06:13:11 +08:00
ff44ce6264 feat: 增加IP地址记录功能以保存用户响应
- 在RawResponse模型中新增ip_address字段
- 更新结果处理逻辑以记录用户的IP地址
2025-06-16 05:27:45 +08:00
7989c8ed4e feat: 添加数据库支持以保存问卷响应
- 新增数据库模型和连接配置,使用SQLite存储问卷响应
- 更新结果处理逻辑,将用户响应保存到数据库
- 更新.gitignore以排除数据库文件和缓存目录
2025-06-16 05:17:49 +08:00