Skip to content

Commit

Permalink
feat: update search course_group default page = 1; update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
JingYiJun committed Oct 16, 2023
1 parent 3f23f0b commit ba74c83
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ const docTemplate = `{
{
"minimum": 0,
"type": "integer",
"example": 0,
"example": 1,
"name": "page",
"in": "query"
},
Expand Down
2 changes: 1 addition & 1 deletion internal/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@
{
"minimum": 0,
"type": "integer",
"example": 0,
"example": 1,
"name": "page",
"in": "query"
},
Expand Down
2 changes: 1 addition & 1 deletion internal/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@ paths:
- application/json
description: search course group, no courses
parameters:
- example: 0
- example: 1
in: query
minimum: 0
name: page
Expand Down
2 changes: 1 addition & 1 deletion internal/schema/course_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (r *CourseGroupHashV1Response) FromModel(hash string) *CourseGroupHashV1Res

type CourseGroupSearchV3Request struct {
Query string `json:"query" form:"query" query:"query" validate:"required" example:"计算机"`
Page int `json:"page" form:"page" query:"page" validate:"min=0" example:"0"`
Page int `json:"page" form:"page" query:"page" validate:"min=0" example:"1"`
PageSize int `json:"page_size" form:"page_size" query:"page_size" validate:"min=0,max=100" example:"10"`
}

Expand Down
1 change: 1 addition & 0 deletions internal/service/course_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ func (c *courseGroupService) SearchCourseGroupV3(
}
db = db.Limit(pageSize).Offset((page - 1) * pageSize)
} else {
page = 1
if pageSize > 0 {
db = db.Limit(pageSize)
}
Expand Down

0 comments on commit ba74c83

Please sign in to comment.