cleanup/fix breaking imports

This commit is contained in:
Tiago vasconcelos 2021-10-18 16:23:51 +01:00
parent 4739a0811d
commit cf23e56dc5
4 changed files with 54 additions and 71 deletions

View File

@ -1,19 +1,17 @@
import json
import time
from datetime import datetime
from http import HTTPStatus
from lnbits.decorators import check_user_exists, WalletTypeInfo, get_key_type
from . import jukebox_ext, jukebox_renderer
from .crud import get_jukebox
from fastapi import FastAPI, Request
from fastapi import Request
from fastapi.params import Depends
from fastapi.templating import Jinja2Templates
from starlette.exceptions import HTTPException
from starlette.responses import HTMLResponse
from lnbits.core.models import User, Payment
from .views_api import api_get_jukebox_device_check
from lnbits.core.models import User
from lnbits.decorators import WalletTypeInfo, check_user_exists, get_key_type
from . import jukebox_ext, jukebox_renderer
from .crud import get_jukebox
from .views_api import api_get_jukebox_device_check
templates = Jinja2Templates(directory="templates")

View File

@ -1,34 +1,30 @@
from fastapi import Request
import base64
import json
from http import HTTPStatus
import httpx
from fastapi import Request
from fastapi.param_functions import Query
from fastapi.params import Depends
from starlette.exceptions import HTTPException
from starlette.responses import HTMLResponse, JSONResponse # type: ignore
import base64
from lnbits.core.crud import get_wallet
from lnbits.core.services import create_invoice, check_invoice_status
import json
from typing import Optional
from fastapi.params import Depends
from fastapi.param_functions import Query
from .models import CreateJukeLinkData, CreateJukeboxPayment
from lnbits.decorators import (
check_user_exists,
WalletTypeInfo,
get_key_type,
api_validate_post_request,
)
import httpx
from lnbits.core.services import check_invoice_status, create_invoice
from lnbits.decorators import WalletTypeInfo, get_key_type
from . import jukebox_ext
from .crud import (
create_jukebox,
update_jukebox,
get_jukebox,
get_jukeboxs,
delete_jukebox,
create_jukebox_payment,
delete_jukebox,
get_jukebox,
get_jukebox_payment,
get_jukeboxs,
update_jukebox,
update_jukebox_payment,
)
from .models import CreateJukeboxPayment, CreateJukeLinkData
@jukebox_ext.get("/api/v1/jukebox")

View File

@ -1,35 +1,28 @@
from http import HTTPStatus
from lnurl.exceptions import InvalidUrl as LnurlInvalidUrl # type: ignore
from http import HTTPStatus
from starlette.exceptions import HTTPException
from starlette.responses import HTMLResponse, JSONResponse # type: ignore
from lnbits.core.crud import get_user
from lnbits.decorators import api_validate_post_request
from .models import CreateSatsDiceLink, CreateSatsDiceWithdraws, CreateSatsDicePayment
from . import satsdice_ext
from fastapi import FastAPI, Request
from fastapi.params import Depends
from typing import Optional
from fastapi import Request
from fastapi.param_functions import Query
from fastapi.params import Depends
from lnurl.exceptions import InvalidUrl as LnurlInvalidUrl # type: ignore
from starlette.exceptions import HTTPException
from lnbits.core.crud import get_user
from lnbits.decorators import WalletTypeInfo, get_key_type
from . import satsdice_ext
from .crud import (
create_satsdice_pay,
create_satsdice_withdraw,
delete_satsdice_pay,
delete_satsdice_withdraw,
get_satsdice_pay,
get_satsdice_pays,
update_satsdice_pay,
delete_satsdice_pay,
create_satsdice_withdraw,
get_satsdice_withdraw,
get_satsdice_withdraws,
update_satsdice_pay,
update_satsdice_withdraw,
delete_satsdice_withdraw,
create_withdraw_hash_check,
)
from lnbits.decorators import (
check_user_exists,
WalletTypeInfo,
get_key_type,
api_validate_post_request,
)
from .models import CreateSatsDiceLink, CreateSatsDiceWithdraws
################LNURL pay

View File

@ -1,29 +1,25 @@
import json
import httpx
import base64
from .crud import get_targets, set_targets
from .models import Target, TargetPut
from fastapi import Request
import json
from http import HTTPStatus
from typing import Optional
import httpx
from fastapi import Request
from fastapi.param_functions import Query
from fastapi.params import Depends
from starlette.exceptions import HTTPException
from starlette.responses import HTMLResponse, JSONResponse # type: ignore
from typing import Optional
from fastapi.params import Depends
from fastapi.param_functions import Query
from . import splitpayments_ext
from lnbits.decorators import (
check_user_exists,
WalletTypeInfo,
get_key_type,
api_validate_post_request,
WalletAdminKeyChecker,
WalletInvoiceKeyChecker,
)
from lnbits.core.crud import get_wallet, get_wallet_for_key
from lnbits.decorators import WalletTypeInfo, get_key_type, require_admin_key
from . import splitpayments_ext
from .crud import get_targets, set_targets
from .models import Target, TargetPut
@splitpayments_ext.get("/api/v1/targets")
async def api_targets_get(wallet: WalletTypeInfo = Depends(WalletAdminKeyChecker())):
async def api_targets_get(wallet: WalletTypeInfo = Depends(require_admin_key)):
print(wallet)
targets = await get_targets(wallet.wallet.id)
return [target.dict() for target in targets] or []
@ -31,7 +27,7 @@ async def api_targets_get(wallet: WalletTypeInfo = Depends(WalletAdminKeyChecker
@splitpayments_ext.put("/api/v1/targets")
async def api_targets_set(
data: TargetPut, wallet: WalletTypeInfo = Depends(WalletAdminKeyChecker())
data: TargetPut, wallet: WalletTypeInfo = Depends(require_admin_key)
):
targets = []
for entry in data.targets: