Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:add skl in salmon base #20

Closed
wants to merge 2 commits into from
Closed

feat:add skl in salmon base #20

wants to merge 2 commits into from

Conversation

whxxxxxxxxxx
Copy link
Collaborator

@whxxxxxxxxxx whxxxxxxxxxx commented Aug 20, 2024

Summary by CodeRabbit

  • New Features

    • Introduced SklInfo API for retrieving detailed student information based on college unit and grade.
    • Added service for accessing student unit information with support for both gRPC and RESTful interactions.
    • Enhanced API documentation for improved usability and discoverability for developers.
  • Bug Fixes

    • Corrected declarations and structures in the student information messages to ensure accurate data representation.

Copy link

coderabbitai bot commented Aug 20, 2024

Walkthrough

The recent changes introduce the skl.proto file, defining the Protocol Buffers specifications for the SklInfo API. This API enables efficient retrieval of student information based on criteria like unit and grade. Key components include structured messages for student and unit data, a service for API interactions, and integrated OpenAPI documentation, enhancing usability and accessibility for developers.

Changes

File Change Summary
campusapis/sklInfo/v1/skl.proto Introduced messages for student history, unit info, and request/response structures. Added service definition for retrieving unit info, including RPC method and OpenAPI documentation options.

Poem

In fields of knowledge, we hop and play,
New paths of learning brighten the way.
With data like carrots, fresh and bright,
We leap through the changes, hearts full of light!
🐰✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bb0490f and e754a2e.

Files selected for processing (1)
  • campusapis/sklInfo/v1/skl.proto (1 hunks)
Additional context used
buf
campusapis/sklInfo/v1/skl.proto

5-5: Import "campusapis/schoolTime/defined.proto" is unused.

(IMPORT_USED)


6-6: Import "campusapis/staff/base.proto" is unused.

(IMPORT_USED)


8-8: Import "google/protobuf/empty.proto" is unused.

(IMPORT_USED)


75-75: RPC request type "SklUnitInfoRequest" should be named "GetSklUnitInfoRequest" or "SklInfoServiceGetSklUnitInfoRequest".

(RPC_REQUEST_STANDARD_NAME)


75-75: RPC response type "SklUnitInfo" should be named "GetSklUnitInfoResponse" or "SklInfoServiceGetSklUnitInfoResponse".

(RPC_RESPONSE_STANDARD_NAME)

Additional comments not posted (3)
campusapis/sklInfo/v1/skl.proto (3)

11-31: Go package and OpenAPI documentation look good.

The Go package and OpenAPI documentation options are well-defined, enhancing usability and accessibility for developers.


36-71: SklStudentHistoryInfo message definition looks good.

The fields are well-defined and appropriately commented, providing clear context for each field.


86-102: Message definitions look good, but verify alignment with renaming.

The field definitions for SklUnitInfo, SklUnitInfoRequest, and SklUnitInfoResponse are appropriate. Ensure that the response message aligns with the suggested renaming of the RPC types.

Comment on lines 5 to 8
import "campusapis/schoolTime/defined.proto";
import "campusapis/staff/base.proto";
import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
Copy link

Choose a reason for hiding this comment

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

Remove unused imports.

The following imports are unused and can be removed to clean up the file:

  • campusapis/schoolTime/defined.proto
  • campusapis/staff/base.proto
  • google/protobuf/empty.proto

Remove the unused imports:

- import "campusapis/schoolTime/defined.proto";
- import "campusapis/staff/base.proto";
- import "google/protobuf/empty.proto";
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import "campusapis/schoolTime/defined.proto";
import "campusapis/staff/base.proto";
import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
import "google/api/annotations.proto";
Tools
buf

5-5: Import "campusapis/schoolTime/defined.proto" is unused.

(IMPORT_USED)


6-6: Import "campusapis/staff/base.proto" is unused.

(IMPORT_USED)


8-8: Import "google/protobuf/empty.proto" is unused.

(IMPORT_USED)

Comment on lines +73 to +82
service SklInfoService {
// 获取某学院某年级的学生信息
rpc GetSklUnitInfo(SklUnitInfoRequest) returns (SklUnitInfo) {
option (google.api.http) = {
get: "/v1/sklInfo/unitInfo"
additional_bindings {
get: "/sklInfo/unitInfo"
}
};
}
Copy link

Choose a reason for hiding this comment

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

Consider renaming RPC request and response types.

To align with standard naming conventions, consider renaming:

  • SklUnitInfoRequest to GetSklUnitInfoRequest
  • SklUnitInfo to GetSklUnitInfoResponse

Rename the types as follows:

- rpc GetSklUnitInfo(SklUnitInfoRequest) returns (SklUnitInfo) {
+ rpc GetSklUnitInfo(GetSklUnitInfoRequest) returns (GetSklUnitInfoResponse) {
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
service SklInfoService {
// 获取某学院某年级的学生信息
rpc GetSklUnitInfo(SklUnitInfoRequest) returns (SklUnitInfo) {
option (google.api.http) = {
get: "/v1/sklInfo/unitInfo"
additional_bindings {
get: "/sklInfo/unitInfo"
}
};
}
service SklInfoService {
// 获取某学院某年级的学生信息
rpc GetSklUnitInfo(GetSklUnitInfoRequest) returns (GetSklUnitInfoResponse) {
option (google.api.http) = {
get: "/v1/sklInfo/unitInfo"
additional_bindings {
get: "/sklInfo/unitInfo"
}
};
}
Tools
buf

75-75: RPC request type "SklUnitInfoRequest" should be named "GetSklUnitInfoRequest" or "SklInfoServiceGetSklUnitInfoRequest".

(RPC_REQUEST_STANDARD_NAME)


75-75: RPC response type "SklUnitInfo" should be named "GetSklUnitInfoResponse" or "SklInfoServiceGetSklUnitInfoResponse".

(RPC_RESPONSE_STANDARD_NAME)

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: 0

Outside diff range, codebase verification and nitpick comments (1)
campusapis/sklInfo/v1/skl.proto (1)

33-68: Remove commented-out code if not needed.

The commented-out SklStudentHistoryInfo message should be removed if it's not required, to maintain cleanliness and readability.

-//// Skl 数据库中的student_history_info表
-//message SklStudentHistoryInfo {
-//  string StudentName = 1; // 学生姓名
-//  string UnitId = 2; // 学院ID
-//  ...
-//}
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e754a2e and 6fc4cec.

Files selected for processing (1)
  • campusapis/sklInfo/v1/skl.proto (1 hunks)
Additional context used
buf
campusapis/sklInfo/v1/skl.proto

72-72: RPC request type "SklUnitInfoRequest" should be named "GetSklUnitInfoRequest" or "SklInfoServiceGetSklUnitInfoRequest".

(RPC_REQUEST_STANDARD_NAME)


72-72: RPC response type "SklUnitInfo" should be named "GetSklUnitInfoResponse" or "SklInfoServiceGetSklUnitInfoResponse".

(RPC_RESPONSE_STANDARD_NAME)

Additional comments not posted (5)
campusapis/sklInfo/v1/skl.proto (5)

1-3: Syntax and package declaration are correct.

The syntax is set to proto3, and the package is correctly defined.


5-6: Import statements are appropriate.

The imports are relevant for API annotations and OpenAPI documentation.


10-28: OpenAPI options are well-defined.

The options enhance the documentation and usability of the API.


70-79: Consider renaming RPC request and response types.

To align with standard naming conventions, consider renaming:

  • SklUnitInfoRequest to GetSklUnitInfoRequest
  • SklUnitInfo to GetSklUnitInfoResponse

Rename the types as follows:

- rpc GetSklUnitInfo(SklUnitInfoRequest) returns (SklUnitInfo) {
+ rpc GetSklUnitInfo(GetSklUnitInfoRequest) returns (GetSklUnitInfoResponse) {
Tools
buf

72-72: RPC request type "SklUnitInfoRequest" should be named "GetSklUnitInfoRequest" or "SklInfoServiceGetSklUnitInfoRequest".

(RPC_REQUEST_STANDARD_NAME)


72-72: RPC response type "SklUnitInfo" should be named "GetSklUnitInfoResponse" or "SklInfoServiceGetSklUnitInfoResponse".

(RPC_RESPONSE_STANDARD_NAME)


82-99: Consider renaming message types for consistency.

To align with standard naming conventions, consider renaming:

  • SklUnitInfo to GetSklUnitInfoResponse
  • SklUnitInfoRequest to GetSklUnitInfoRequest

This will improve consistency with the RPC method naming.

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