Skip to content

chore: fitness data storage#32

Merged
Jiahe114514 merged 3 commits intomainfrom
chore/fitnessStorage
Jan 22, 2026
Merged

chore: fitness data storage#32
Jiahe114514 merged 3 commits intomainfrom
chore/fitnessStorage

Conversation

@Jiahe114514
Copy link
Contributor

@Jiahe114514 Jiahe114514 commented Jan 21, 2026

Summary by CodeRabbit

  • 新功能

    • 新增创建、更新、删除体测成绩的 HTTP 接口(POST/PATCH/DELETE),可通过 /fitness/score 和 /staff/v1/fitness/score 两条路径访问。
    • 支持的体测字段包括身高、体重、BMI、50米、立定跳远、坐位体前屈、800m/1000m、仰卧起坐、引体向上、肺活量、总分等。
  • 文档

    • 更新并公开了对应的接口文档与请求/响应模型,便于调用与集成。

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

Walkthrough

向 CampusService 添加体测成绩相关三条 gRPC RPC(Store/Update/Delete)及对应消息类型,并在 Swagger 中新增两组 HTTP 路由(/fitness/score 与 /staff/v1/fitness/score)及相应 schema。文件中存在 FitnessScore 相关重复声明片段。

Changes

Cohort / File(s) 变更摘要
gRPC 服务定义
campusapis/staff/v1/campus.proto
新增 RPC:StoreFitnessScoreUpdateFitnessScoreDeleteFitnessScore(含 HTTP 绑定);新增消息:FitnessScoreRequestFitnessScoreResponseDeleteFitnessScoreRequest(含 openapi_schema option)、DeleteFitnessScoreResponseFitnessScore(体测字段集合);注意文件内存在重复声明片段。
Swagger API 文档
docs/swagger/campusapis/staff/v1/campus.swagger.json
新增路径组:/fitness/score/staff/v1/fitness/score,各含 POST(Store)、PATCH(Update)、DELETE(Delete) 操作;新增 schema/definitions:v1FitnessScorev1FitnessScoreRequestv1FitnessScoreResponsev1DeleteFitnessScoreResponse 并导出,响应与参数结构已同步。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 新增三路体测来,
存更删改逐条排,
proto 与 swagger 衔接齐,
字段满仓数据开,
小兔鼓掌庆一杯。

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR标题'chore: fitness data storage'准确总结了主要变更内容,即添加健身成绩存储相关的API接口和数据模型,与changeset的核心目标一致。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/fitnessStorage

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@campusapis/staff/v1/campus.proto`:
- Around line 1017-1035: The new messages use snake_case and an inconsistent
semester type; update FitnessScoreRequest to use camelCase field names (staffId,
schoolYear, semester, gender, grade, height, weight, bmi, run50m,
standingLongJump, sitAndReach, run800m, run1000m, sitUps, pullUps, lungCapacity,
totalScore) and change the semester field type from int32 to string to match
existing requests (e.g., GetStudentExamRequest), and apply the exact same naming
and semester-type changes to DeleteFitnessScoreRequest and FitnessScore so all
three messages are consistent with the existing API style.

In `@docs/swagger/campusapis/staff/v1/campus.swagger.json`:
- Around line 67-87: 将删除接口的关键查询参数 staffId、schoolYear 和 semester 从 required:
false 改为 required: true,并在相应的接口输入校验层(如 proto 定义或 API
网关验证规则)添加必填检查以拒绝缺失任一参数的请求;定位到 swagger 参数定义中对应的 "staffId"、"schoolYear"、"semester"
三个条目并更新其 required 属性,同时在后端处理函数(校验入口的 handler)确保参数存在并返回明确的验证错误。
- Around line 49-230: The POST/PATCH endpoints under /fitness/score were
generated with query parameters because the proto RPCs StoreFitnessScore and
UpdateFitnessScore have additional_bindings without a body mapping; update the
proto definitions for StoreFitnessScore and UpdateFitnessScore to include body:
"*" inside each additional_bindings block (i.e., add body: "*" alongside post:
"/fitness/score" and patch: "/fitness/score" respectively) so gRPC-Gateway emits
request-body schemas for those routes, then regenerate the OpenAPI/Swagger
artifacts.
🧹 Nitpick comments (2)
campusapis/staff/v1/campus.proto (2)

260-280: StoreFitnessScoreUpdateFitnessScore 语义重叠

StoreFitnessScore 注释为"新增或更新",而 UpdateFitnessScore 注释为"更新"。这两个 RPC 功能重叠,可能导致 API 使用者困惑。

建议:

  • 如果 StoreFitnessScore 是 upsert 操作,可以移除 UpdateFitnessScore
  • 或者明确区分:StoreFitnessScore 仅用于新增,UpdateFitnessScore 仅用于更新

1045-1049: 删除请求缺少必要字段说明

DeleteFitnessScoreRequest 中的 staff_idschool_yearsemester 是删除操作的关键标识字段,建议添加注释说明这些字段的作用和格式要求,与文件中其他消息的风格保持一致。

@Jiahe114514 Jiahe114514 merged commit de35451 into main Jan 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant