mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-03-13 11:35:56 +01:00
get payment from db
This commit is contained in:
parent
76dda26f65
commit
0b883d02b3
1 changed files with 10 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
from typing import List, Optional, Union
|
||||
|
||||
from lnbits.core.models import Payment
|
||||
from lnbits.helpers import urlsafe_short_hash
|
||||
|
||||
from . import db
|
||||
|
@ -47,3 +48,12 @@ async def get_tposs(wallet_ids: Union[str, List[str]]) -> List[TPoS]:
|
|||
|
||||
async def delete_tpos(tpos_id: str) -> None:
|
||||
await db.execute("DELETE FROM tpos.tposs WHERE id = ?", (tpos_id,))
|
||||
|
||||
|
||||
async def get_tpos_payments(tpos_id: str, limit: int = 5):
|
||||
|
||||
rows = await db.fetchall(
|
||||
f"SELECT * FROM apipayments WHERE extra LIKE '%tposId%' AND extra LIKE '%{tpos_id}%' ORDER BY time DESC LIMIT {limit}"
|
||||
)
|
||||
|
||||
return [Payment.from_row(row) for row in rows]
|
||||
|
|
Loading…
Add table
Reference in a new issue