prettier/black

This commit is contained in:
benarc
2021-03-17 19:27:52 +00:00
parent 66cde0154b
commit ad545e7fe1
5 changed files with 48 additions and 49 deletions

View File

@ -99,6 +99,7 @@ def chunks(lst, n):
for i in range(0, len(lst), n): for i in range(0, len(lst), n):
yield lst[i : i + n] yield lst[i : i + n]
async def create_hash_check( async def create_hash_check(
the_hash: str, the_hash: str,
lnurl_id: str, lnurl_id: str,
@ -120,6 +121,7 @@ async def create_hash_check(
row = await db.fetchone("SELECT * FROM hash_check WHERE id = ?", (the_hash,)) row = await db.fetchone("SELECT * FROM hash_check WHERE id = ?", (the_hash,))
return HashCheck.from_row(row) if row else None return HashCheck.from_row(row) if row else None
async def get_hash_check(the_hash: str, lnurl_id: str) -> Optional[HashCheck]: async def get_hash_check(the_hash: str, lnurl_id: str) -> Optional[HashCheck]:
row = await db.fetchone("SELECT * FROM hash_check WHERE id = ?", (the_hash,)) row = await db.fetchone("SELECT * FROM hash_check WHERE id = ?", (the_hash,))
return HashCheck.from_row(row) if row else None return HashCheck.from_row(row) if row else None

View File

@ -95,6 +95,7 @@ async def m002_change_withdraw_table(db):
) )
await db.execute("DROP TABLE withdraw_links") await db.execute("DROP TABLE withdraw_links")
async def m003_make_hash_check(db): async def m003_make_hash_check(db):
""" """
Creates a hash check table. Creates a hash check table.

View File

@ -60,9 +60,11 @@ class WithdrawLink(NamedTuple):
default_description=self.title, default_description=self.title,
) )
class HashCheck(NamedTuple): class HashCheck(NamedTuple):
id: str id: str
lnurl_id: str lnurl_id: str
@classmethod @classmethod
def from_row(cls, row: Row) -> "Hash": def from_row(cls, row: Row) -> "Hash":
return cls(**dict(row)) return cls(**dict(row))

View File

@ -129,7 +129,6 @@
dense dense
expand-separator expand-separator
label="Delete a withdraw link" label="Delete a withdraw link"
> >
<q-card> <q-card>
<q-card-section> <q-card-section>
@ -149,13 +148,8 @@
</q-card-section> </q-card-section>
</q-card> </q-card>
</q-expansion-item> </q-expansion-item>
<q-expansion-item <q-expansion-item group="api" dense expand-separator label="Get Hash Check">
group="api" <q-card>
dense
expand-separator
label="Get Hash Check"
>
<q-card>
<q-card-section> <q-card-section>
<code <code
><span class="text-blue">GET</span> ><span class="text-blue">GET</span>
@ -170,20 +164,21 @@ label="Get Hash Check"
<code>{"status": &lt;bool&gt;}</code> <code>{"status": &lt;bool&gt;}</code>
<h5 class="text-caption q-mt-sm q-mb-none">Curl example</h5> <h5 class="text-caption q-mt-sm q-mb-none">Curl example</h5>
<code <code
>curl -X GET {{ request.url_root }}api/v1/links/&lt;the_hash&gt;/&lt;lnurl_id&gt; -H >curl -X GET {{ request.url_root
"X-Api-Key: {{ g.user.wallets[0].inkey }}" }}api/v1/links/&lt;the_hash&gt;/&lt;lnurl_id&gt; -H "X-Api-Key: {{
g.user.wallets[0].inkey }}"
</code> </code>
</q-card-section> </q-card-section>
</q-card> </q-card>
</q-expansion-item> </q-expansion-item>
<q-expansion-item <q-expansion-item
group="api" group="api"
dense dense
expand-separator expand-separator
label="Get image to embed" label="Get image to embed"
class="q-pb-md" class="q-pb-md"
> >
<q-card> <q-card>
<q-card-section> <q-card-section>
<code <code
><span class="text-blue">GET</span> ><span class="text-blue">GET</span>
@ -194,8 +189,6 @@ class="q-pb-md"
>curl -X GET {{ request.url_root }}/withdraw/img/&lt;lnurl_id&gt;" >curl -X GET {{ request.url_root }}/withdraw/img/&lt;lnurl_id&gt;"
</code> </code>
</q-card-section> </q-card-section>
</q-card> </q-card>
</q-expansion-item>
</q-expansion-item> </q-expansion-item>
</q-expansion-item>

View File

@ -114,6 +114,7 @@ async def api_link_delete(link_id):
return "", HTTPStatus.NO_CONTENT return "", HTTPStatus.NO_CONTENT
@withdraw_ext.route("/api/v1/links/<the_hash>/<lnurl_id>", methods=["GET"]) @withdraw_ext.route("/api/v1/links/<the_hash>/<lnurl_id>", methods=["GET"])
@api_check_wallet_key("invoice") @api_check_wallet_key("invoice")
async def api_hash_retrieve(the_hash, lnurl_id): async def api_hash_retrieve(the_hash, lnurl_id):