Skip to content

Commit 7888e04

Browse files
committed
#566 Add max=10 validation to Rating in import/watched eps and seasons
1 parent bf45f1a commit 7888e04

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

server/import.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type ImportRequest struct {
3030
Name string `json:"name"`
3131
TmdbID int `json:"tmdbId"`
3232
Type ContentType `json:"type"`
33-
Rating int8 `json:"rating"`
33+
Rating int8 `json:"rating" binding:"max=10"`
3434
RatingCustomDate *time.Time `json:"ratingCustomDate"`
3535
Status WatchedStatus `json:"status"`
3636
Thoughts string `json:"thoughts"`

server/watched_episodes.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type WatchedEpisodeAddRequest struct {
3131
SeasonNumber int `json:"seasonNumber"`
3232
EpisodeNumber int `json:"episodeNumber"`
3333
Status WatchedStatus `json:"status"`
34-
Rating int8 `json:"rating"`
34+
Rating int8 `json:"rating" binding:"max=10"`
3535
addActivity ActivityType `json:"-"`
3636
addActivityDate time.Time `json:"-"`
3737
}

server/watched_seasons.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type WatchedSeasonAddRequest struct {
2525
WatchedID uint `json:"watchedId"`
2626
SeasonNumber int `json:"seasonNumber"`
2727
Status WatchedStatus `json:"status"`
28-
Rating int8 `json:"rating"`
28+
Rating int8 `json:"rating" binding:"max=10"`
2929
addActivity ActivityType `json:"-"`
3030
addActivityDate time.Time `json:"-"`
3131
// Data to add to activity if the season is created.

0 commit comments

Comments
 (0)