Skip to content

Commit

Permalink
z
Browse files Browse the repository at this point in the history
  • Loading branch information
everpcpc committed May 27, 2024
1 parent 4fda70b commit d4b6dd2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions web/handler/subject/browse.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,19 @@ func parseBrowseQuery(c echo.Context) (*subject.BrowseFilter, error) {
if year, err := gstr.ParseInt32(yearStr); err != nil {
return nil, res.BadRequest(err.Error())
} else {
if year < 1900 || year > 3000 {
return nil, res.BadRequest("invalid year: " + yearStr)

Check warning on line 113 in web/handler/subject/browse.go

View check run for this annotation

Codecov / codecov/patch

web/handler/subject/browse.go#L108-L113

Added lines #L108 - L113 were not covered by tests
}
filter.Year = null.Int32{Value: year, Set: true}

Check warning on line 115 in web/handler/subject/browse.go

View check run for this annotation

Codecov / codecov/patch

web/handler/subject/browse.go#L115

Added line #L115 was not covered by tests
}
}
if monthStr := c.QueryParam("month"); monthStr != "" {
if month, err := gstr.ParseInt8(monthStr); err != nil {
return nil, res.BadRequest(err.Error())
} else {
if month < 1 || month > 12 {
return nil, res.BadRequest("invalid month: " + monthStr)

Check warning on line 123 in web/handler/subject/browse.go

View check run for this annotation

Codecov / codecov/patch

web/handler/subject/browse.go#L118-L123

Added lines #L118 - L123 were not covered by tests
}
filter.Month = null.Int8{Value: month, Set: true}

Check warning on line 125 in web/handler/subject/browse.go

View check run for this annotation

Codecov / codecov/patch

web/handler/subject/browse.go#L125

Added line #L125 was not covered by tests
}
}
Expand Down

0 comments on commit d4b6dd2

Please sign in to comment.