retreiving hits

This commit is contained in:
iWarpBTC
2022-08-14 10:52:58 -06:00
committed by Lee Salminen
parent 3cb62d1899
commit 2f497ac0ee
4 changed files with 36 additions and 21 deletions
+4 -7
View File
@@ -101,16 +101,13 @@ async def get_hit(hit_id: str) -> Optional[Hit]:
return Hit.parse_obj(hit)
async def get_hits(wallet_ids: Union[str, List[str]]) -> List[Hit]:
cards = get_cards(wallet_ids)
q = ",".join(["?"] * len(cards))
async def get_hits(cards_ids: Union[str, List[str]]) -> List[Hit]:
q = ",".join(["?"] * len(cards_ids))
rows = await db.fetchall(
f"SELECT * FROM boltcards.hits WHERE wallet IN ({q})", (*(card.card_id for card in cards),)
f"SELECT * FROM boltcards.hits WHERE card_id IN ({q})", (*cards_ids,)
)
return [Card(**row) for row in rows]
return [Hit(**row) for row in rows]
async def create_hit(
card_id, ip, useragent, old_ctr, new_ctr