Changed routs to request types

This commit is contained in:
Ben Arc
2021-08-20 17:15:04 +01:00
parent 22b57d99d5
commit 9ea3c51b92
2 changed files with 29 additions and 34 deletions
+7 -7
View File
@@ -20,7 +20,7 @@ from .crud import (
)
@withdraw_ext.route("/api/v1/links", methods=["GET"])
@withdraw_ext.get("/api/v1/links")
@api_check_wallet_key("invoice")
async def api_links():
wallet_ids = [g.wallet.id]
@@ -51,7 +51,7 @@ async def api_links():
)
@withdraw_ext.route("/api/v1/links/<link_id>", methods=["GET"])
@withdraw_ext.get("/api/v1/links/<link_id>")
@api_check_wallet_key("invoice")
async def api_link_retrieve(link_id):
link = await get_withdraw_link(link_id, 0)
@@ -75,8 +75,8 @@ class CreateData(BaseModel):
wait_time: int = Query(..., ge=1),
is_unique: bool
@withdraw_ext.route("/api/v1/links", methods=["POST"])
@withdraw_ext.route("/api/v1/links/<link_id>", methods=["PUT"])
@withdraw_ext.post("/api/v1/links")
@withdraw_ext.put("/api/v1/links/<link_id>")
@api_check_wallet_key("admin")
async def api_link_create_or_update(data: CreateData, link_id: str = None):
if data.max_withdrawable < data.min_withdrawable:
@@ -118,7 +118,7 @@ async def api_link_create_or_update(data: CreateData, link_id: str = None):
)
@withdraw_ext.route("/api/v1/links/<link_id>", methods=["DELETE"])
@withdraw_ext.delete("/api/v1/links/<link_id>")
@api_check_wallet_key("admin")
async def api_link_delete(link_id):
link = await get_withdraw_link(link_id)
@@ -137,8 +137,8 @@ async def api_link_delete(link_id):
return "", HTTPStatus.NO_CONTENT
@withdraw_ext.route("/api/v1/links/<the_hash>/<lnurl_id>", methods=["GET"])
@withdraw_ext.get("/api/v1/links/<the_hash>/<lnurl_id>")
@api_check_wallet_key("invoice")
async def api_hash_retrieve(the_hash, lnurl_id):
hashCheck = await get_hash_check(the_hash, lnurl_id)
return jsonify(hashCheck), HTTPStatus.OK
return jsonable_encoder(hashCheck), HTTPStatus.OK