Boots, errors, needs work
This commit is contained in:
@@ -4,7 +4,7 @@ from typing import List, Optional, Union
|
||||
from lnbits.helpers import urlsafe_short_hash
|
||||
|
||||
from . import db
|
||||
from .models import Card, CreateCardData, Hit
|
||||
from .models import Card, CreateCardData, Hit, Refund
|
||||
|
||||
|
||||
async def create_card(data: CreateCardData, wallet_id: str) -> Card:
|
||||
@@ -143,6 +143,13 @@ async def get_hits(cards_ids: Union[str, List[str]]) -> List[Hit]:
|
||||
|
||||
return [Hit(**row) for row in rows]
|
||||
|
||||
async def get_hits_today(card_id: Union[str, List[str]]) -> List[Hit]:
|
||||
rows = await db.fetchall(
|
||||
f"SELECT * FROM boltcards.hits WHERE card_id = ? AND timestamp >= DATE() AND timestamp < DATE() + INTERVAL ? DAY", (card_id, 1)
|
||||
)
|
||||
|
||||
return [Hit(**row) for row in rows]
|
||||
|
||||
|
||||
async def create_hit(card_id, ip, useragent, old_ctr, new_ctr) -> Hit:
|
||||
hit_id = urlsafe_short_hash()
|
||||
|
||||
Reference in New Issue
Block a user