Update crud.py

This commit is contained in:
Arc 2020-04-18 01:37:31 +01:00 committed by GitHub
parent 5b16bd0224
commit 5c34c23617
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,15 +7,15 @@ from lnbits.db import open_ext_db
from .models import AMilk
def create_amilk(*, wallet_id: str, url: str, memo: str, amount: int) -> AMilk:
def create_amilk(*, wallet_id: str, lnurl: str, atime: int, amount: int) -> AMilk:
with open_ext_db("amilk") as db:
amilk_id = urlsafe_b64encode(uuid4().bytes_le).decode('utf-8')
db.execute(
"""
INSERT INTO amilks (id, wallet, url, memo, amount)
INSERT INTO amilks (id, wallet, lnurl, atime, amount)
VALUES (?, ?, ?, ?, ?)
""",
(amilk_id, wallet_id, url, memo, amount),
(amilk_id, wallet_id, lnurl, atime, amount),
)
return get_amilk(amilk_id)