feat: add destroy extension enpoint
This commit is contained in:
parent
612d31eae0
commit
9558181914
1 changed files with 12 additions and 1 deletions
13
views_api.py
13
views_api.py
|
|
@ -9,13 +9,14 @@ from loguru import logger
|
|||
from lnbits.core import create_invoice
|
||||
from lnbits.decorators import (
|
||||
WalletTypeInfo,
|
||||
check_admin,
|
||||
get_key_type,
|
||||
require_admin_key,
|
||||
require_invoice_key,
|
||||
)
|
||||
from lnbits.utils.exchange_rates import currencies
|
||||
|
||||
from . import nostrmarket_ext
|
||||
from . import nostrmarket_ext, scheduled_tasks
|
||||
from .crud import (
|
||||
create_merchant,
|
||||
create_order,
|
||||
|
|
@ -583,6 +584,16 @@ async def api_list_currencies_available():
|
|||
return list(currencies.keys())
|
||||
|
||||
|
||||
@nostrmarket_ext.delete("/api/v1", status_code=HTTPStatus.OK)
|
||||
async def api_stop(wallet: WalletTypeInfo = Depends(check_admin)):
|
||||
for t in scheduled_tasks:
|
||||
try:
|
||||
t.cancel()
|
||||
except Exception as ex:
|
||||
logger.warning(ex)
|
||||
|
||||
return {"success": True}
|
||||
|
||||
######################################## HELPERS ########################################
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue