aboutsummaryrefslogtreecommitdiff
path: root/errhandlers
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@protonmail.ch>2022-02-24 00:40:03 +0530
committerVidhu Kant Sharma <vidhukant@protonmail.ch>2022-02-24 00:40:03 +0530
commitb6235cb6331bac5e1a2d791c78578ebfb298d2eb (patch)
tree4b7bc19f93e80610139407e73a6cb864588867c8 /errhandlers
parent0edca3b2faf545abc065de55a94b87a10ac3f405 (diff)
added validators to check manga status and sort
Diffstat (limited to 'errhandlers')
-rw-r--r--errhandlers/manga_validators.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/errhandlers/manga_validators.go b/errhandlers/manga_validators.go
index fa12e5f..e54107d 100644
--- a/errhandlers/manga_validators.go
+++ b/errhandlers/manga_validators.go
@@ -68,3 +68,29 @@ func IsValidMangaRankingType(rankingType string) bool {
}
return false
}
+
+// Checks if given sort is valid
+func IsValidMangaListSort(sort string) bool {
+ switch sort {
+ case
+ "list_score",
+ "list_updated_at",
+ "manga_title",
+ "manga_start_date",
+ "manga_id": return true
+ }
+ return false
+}
+
+// Checks if given list status is valid
+func IsValidMangaListStatus(status string) bool {
+ switch status {
+ case
+ "reading",
+ "completed",
+ "on_hold",
+ "dropped",
+ "plan_to_read": return true
+ }
+ return false
+}