From b6235cb6331bac5e1a2d791c78578ebfb298d2eb Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Thu, 24 Feb 2022 00:40:03 +0530 Subject: added validators to check manga status and sort --- errhandlers/manga_validators.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'errhandlers/manga_validators.go') 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 +} -- cgit v1.2.3