swaps pos id for number
This commit is contained in:
parent
dce50105c9
commit
cd6f4c909f
|
@ -11,8 +11,10 @@ from .models import createLnurldevice, lnurldevicepayment, lnurldevices
|
|||
async def create_lnurldevice(
|
||||
data: createLnurldevice,
|
||||
) -> lnurldevices:
|
||||
if data.device == "pos":
|
||||
if data.device == "pos" or data.device == "atm":
|
||||
lnurldevice_id = str(await get_lnurldeviceposcount())
|
||||
else:
|
||||
lnurldevice_id = urlsafe_short_hash()
|
||||
lnurldevice_key = urlsafe_short_hash()
|
||||
await db.execute(
|
||||
"""
|
||||
|
@ -82,7 +84,7 @@ async def update_lnurldevice(lnurldevice_id: str, **kwargs) -> Optional[lnurldev
|
|||
|
||||
async def get_lnurldeviceposcount() -> int:
|
||||
row = await db.fetchall(
|
||||
"SELECT * FROM lnurldevice.lnurldevices WHERE device"
|
||||
"SELECT * FROM lnurldevice.lnurldevices WHERE device = ? OR device = ?", ("pos", "atm",)
|
||||
)
|
||||
return len(row) + 1
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ class createLnurldevice(BaseModel):
|
|||
wallet: str
|
||||
currency: str
|
||||
device: str
|
||||
profit: float
|
||||
amount: int
|
||||
profit: float = 0
|
||||
amount: Optional[int] = 0
|
||||
pin: int = 0
|
||||
profit1: float = 0
|
||||
amount1: int = 0
|
||||
|
|
Loading…
Reference in New Issue
Block a user