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):
yield lst[i : i + n]
async def create_hash_check(
the_hash: 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,))
return HashCheck.from_row(row) if row else None
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,))
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")
async def m003_make_hash_check(db):
"""
Creates a hash check table.

View File

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

View File

@ -129,7 +129,6 @@
dense
expand-separator
label="Delete a withdraw link"
>
<q-card>
<q-card-section>
@ -149,53 +148,47 @@
</q-card-section>
</q-card>
</q-expansion-item>
<q-expansion-item group="api" dense expand-separator label="Get Hash Check">
<q-card>
<q-card-section>
<code
><span class="text-blue">GET</span>
/withdraw/api/v1/links/&lt;the_hash&gt;/&lt;lnurl_id&gt;</code
>
<h5 class="text-caption q-mt-sm q-mb-none">Headers</h5>
<code>{"X-Api-Key": &lt;invoice_key&gt;}</code><br />
<h5 class="text-caption q-mt-sm q-mb-none">Body (application/json)</h5>
<h5 class="text-caption q-mt-sm q-mb-none">
Returns 201 CREATED (application/json)
</h5>
<code>{"status": &lt;bool&gt;}</code>
<h5 class="text-caption q-mt-sm q-mb-none">Curl example</h5>
<code
>curl -X GET {{ request.url_root
}}api/v1/links/&lt;the_hash&gt;/&lt;lnurl_id&gt; -H "X-Api-Key: {{
g.user.wallets[0].inkey }}"
</code>
</q-card-section>
</q-card>
</q-expansion-item>
<q-expansion-item
group="api"
dense
expand-separator
label="Get Hash Check"
>
<q-card>
<q-card-section>
<code
><span class="text-blue">GET</span>
/withdraw/api/v1/links/&lt;the_hash&gt;/&lt;lnurl_id&gt;</code
>
<h5 class="text-caption q-mt-sm q-mb-none">Headers</h5>
<code>{"X-Api-Key": &lt;invoice_key&gt;}</code><br />
<h5 class="text-caption q-mt-sm q-mb-none">Body (application/json)</h5>
<h5 class="text-caption q-mt-sm q-mb-none">
Returns 201 CREATED (application/json)
</h5>
<code>{"status": &lt;bool&gt;}</code>
<h5 class="text-caption q-mt-sm q-mb-none">Curl example</h5>
<code
>curl -X GET {{ request.url_root }}api/v1/links/&lt;the_hash&gt;/&lt;lnurl_id&gt; -H
"X-Api-Key: {{ g.user.wallets[0].inkey }}"
</code>
</q-card-section>
</q-card>
group="api"
dense
expand-separator
label="Get image to embed"
class="q-pb-md"
>
<q-card>
<q-card-section>
<code
><span class="text-blue">GET</span>
/withdraw/img/&lt;lnurl_id&gt;</code
>
<h5 class="text-caption q-mt-sm q-mb-none">Curl example</h5>
<code
>curl -X GET {{ request.url_root }}/withdraw/img/&lt;lnurl_id&gt;"
</code>
</q-card-section>
</q-card>
</q-expansion-item>
</q-expansion-item>
<q-expansion-item
group="api"
dense
expand-separator
label="Get image to embed"
class="q-pb-md"
>
<q-card>
<q-card-section>
<code
><span class="text-blue">GET</span>
/withdraw/img/&lt;lnurl_id&gt;</code
>
<h5 class="text-caption q-mt-sm q-mb-none">Curl example</h5>
<code
>curl -X GET {{ request.url_root }}/withdraw/img/&lt;lnurl_id&gt;"
</code>
</q-card-section>
</q-card>
</q-expansion-item>
</q-expansion-item>

View File

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