From 8fcd227b331bad66f0778b4f05e70d2e41ac53e6 Mon Sep 17 00:00:00 2001 From: EmmyHeart Date: Fri, 20 Oct 2023 03:24:25 +0000 Subject: [PATCH] Added functions for checking if Aime card is locked or banned --- core/data/schema/card.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/core/data/schema/card.py b/core/data/schema/card.py index d8f5fc0..a95684e 100644 --- a/core/data/schema/card.py +++ b/core/data/schema/card.py @@ -64,6 +64,27 @@ class CardData(BaseData): return int(card["user"]) + def get_card_banned(self, access_code: str) -> Optional[bool]: + """ + Given a 20 digit access code as a string, check if the card is banned + """ + card = self.get_card_by_access_code(access_code) + if card is None: + return None + if card["is_banned"]: + return True + return False + def get_card_locked(self, access_code: str) -> Optional[bool]: + """ + Given a 20 digit access code as a string, check if the card is locked + """ + card = self.get_card_by_access_code(access_code) + if card is None: + return None + if card["is_locked"]: + return True + return False + def delete_card(self, card_id: int) -> None: sql = aime_card.delete(aime_card.c.id == card_id)