[feat] fetch all payments for user (#3132)

This commit is contained in:
Vlad Stan
2025-04-29 13:52:07 +03:00
committed by GitHub
parent 2dee26b728
commit e339bb6181
4 changed files with 87 additions and 5 deletions
+14
View File
@@ -135,6 +135,20 @@ async def get_wallets(
)
async def get_wallets_ids(
user_id: str, deleted: Optional[bool] = None, conn: Optional[Connection] = None
) -> list[str]:
where = "AND deleted = :deleted" if deleted is not None else ""
result: list[dict] = await (conn or db).fetchall(
f"""
SELECT id FROM wallets
WHERE "user" = :user {where}
""",
{"user": user_id, "deleted": deleted},
)
return [row["id"] for row in result]
async def get_wallets_count():
result = await db.execute("SELECT COUNT(*) as count FROM wallets")
row = result.mappings().first()