Conversation
OrenZhang
suggested changes
Jul 4, 2025
6 tasks
OrenZhang
suggested changes
Jul 4, 2025
There was a problem hiding this comment.
Pull Request Overview
本 PR 新增了项目状态字段及相关过滤,并同步更新了仪表盘 SQL、GORM 查询、Swagger 文档和用户分数计算逻辑
- 在
Project模型中引入status字段和ProjectStatus枚举,新增ProjectReport模型并更新自动迁移 - 在 SQL 存储过程和 GORM 查询中统一增加
status = 0过滤 - 更新 Swagger 定义和示例配置,同时在用户分数计算中引入违规扣分机制
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| support-files/sql/create_dashboard_proc.sql | 仪表盘 SQL 添加状态过滤及字段更新 |
| internal/db/migrator/migrator.go | 迁移添加 ProjectReport |
| internal/config/model.go | 增加 projectApp 配置模型 |
| internal/apps/project/models.go | 定义 Status 与 ProjectReport |
| internal/apps/project/utils.go | 查询中加入 status 过滤 |
| internal/apps/project/routers.go | Exact 调用和错误响应调整 |
| internal/apps/project/middlewares.go | 中间件 Exact 调用修改 |
| internal/apps/project/constants.go | 定义 ProjectStatus 枚举 |
| internal/apps/project/err.go | 新增 NotFound 错误码 |
| internal/apps/oauth/tasks.go | 用户分数计算引入违规扣分 |
| internal/apps/oauth/models.go | 用户模型新增字段 |
| docs/swagger.yaml/.json/.go | 更新 Swagger 定义新增状态与举报数 |
| config.example.yaml | 示例配置新增 projectApp |
Comments suppressed due to low confidence (2)
internal/apps/project/utils.go:53
- 新增了
status过滤条件,建议补充单元测试以验证在不同ProjectStatus下查询结果的正确性。
WHERE p.end_time > ? AND p.is_completed = false AND p.status = ? AND p.minimum_trust_level <= ? AND p.risk_level >= ? AND NOT EXISTS ( SELECT 1 FROM project_items pi WHERE pi.project_id = p.id AND pi.receiver_id = ?)`
internal/apps/project/routers.go:76
- 直接返回
err.Error()可能泄露底层实现细节,建议使用统一的NotFound错误码或友好提示,如ProjectErrNotFound,并在响应中使用该常量。
c.JSON(http.StatusNotFound, ProjectResponse{ErrorMsg: err.Error()})
OrenZhang
approved these changes
Jul 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
例行检查
变更内容
新增新字段同步一些sql的条件搜索