Add a secondary route with the card_uid appended to it.

This commit is contained in:
Lee Salminen
2022-08-21 08:58:38 -06:00
parent db83d803f8
commit 4242a82029
2 changed files with 25 additions and 12 deletions
+8
View File
@@ -82,6 +82,14 @@ async def get_card(card_id: str) -> Optional[Card]:
return Card.parse_obj(card)
async def get_card_by_uid(card_uid: str) -> Optional[Card]:
row = await db.fetchone("SELECT * FROM boltcards.cards WHERE uid = ?", (card_uid,))
if not row:
return None
card = dict(**row)
return Card.parse_obj(card)
async def get_card_by_otp(otp: str) -> Optional[Card]:
row = await db.fetchone("SELECT * FROM boltcards.cards WHERE otp = ?", (otp,))