Merge pull request #438 from lnbits/usermanager_api_fix
Fix UserManager endpoint collision (FastAPI)
This commit is contained in:
commit
1609280f53
4 changed files with 8 additions and 8 deletions
|
|
@ -2,6 +2,7 @@ from sqlite3 import Row
|
||||||
|
|
||||||
from fastapi.param_functions import Query
|
from fastapi.param_functions import Query
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
|
||||||
class CreateUserData(BaseModel):
|
class CreateUserData(BaseModel):
|
||||||
|
|
@ -22,8 +23,8 @@ class Users(BaseModel):
|
||||||
id: str
|
id: str
|
||||||
name: str
|
name: str
|
||||||
admin: str
|
admin: str
|
||||||
email: str
|
email: Optional[str] = None
|
||||||
password: str
|
password: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
class Wallets(BaseModel):
|
class Wallets(BaseModel):
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ from .crud import (
|
||||||
)
|
)
|
||||||
from .models import CreateUserData, CreateUserWallet
|
from .models import CreateUserData, CreateUserWallet
|
||||||
|
|
||||||
### Users
|
# Users
|
||||||
|
|
||||||
|
|
||||||
@usermanager_ext.get("/api/v1/users", status_code=HTTPStatus.OK)
|
@usermanager_ext.get("/api/v1/users", status_code=HTTPStatus.OK)
|
||||||
|
|
@ -63,7 +63,7 @@ async def api_usermanager_users_delete(
|
||||||
raise HTTPException(status_code=HTTPStatus.NO_CONTENT)
|
raise HTTPException(status_code=HTTPStatus.NO_CONTENT)
|
||||||
|
|
||||||
|
|
||||||
###Activate Extension
|
# Activate Extension
|
||||||
|
|
||||||
|
|
||||||
@usermanager_ext.post("/api/v1/extensions")
|
@usermanager_ext.post("/api/v1/extensions")
|
||||||
|
|
@ -79,7 +79,7 @@ async def api_usermanager_activate_extension(
|
||||||
return {"extension": "updated"}
|
return {"extension": "updated"}
|
||||||
|
|
||||||
|
|
||||||
###Wallets
|
# Wallets
|
||||||
|
|
||||||
|
|
||||||
@usermanager_ext.post("/api/v1/wallets")
|
@usermanager_ext.post("/api/v1/wallets")
|
||||||
|
|
@ -98,7 +98,7 @@ async def api_usermanager_wallets(wallet: WalletTypeInfo = Depends(get_key_type)
|
||||||
return [wallet.dict() for wallet in await get_usermanager_wallets(admin_id)]
|
return [wallet.dict() for wallet in await get_usermanager_wallets(admin_id)]
|
||||||
|
|
||||||
|
|
||||||
@usermanager_ext.get("/api/v1/wallets/{wallet_id}")
|
@usermanager_ext.get("/api/v1/transactions/{wallet_id}")
|
||||||
async def api_usermanager_wallet_transactions(
|
async def api_usermanager_wallet_transactions(
|
||||||
wallet_id, wallet: WalletTypeInfo = Depends(get_key_type)
|
wallet_id, wallet: WalletTypeInfo = Depends(get_key_type)
|
||||||
):
|
):
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ class Jinja2Templates(templating.Jinja2Templates):
|
||||||
def get_environment(self, loader: "jinja2.BaseLoader") -> "jinja2.Environment":
|
def get_environment(self, loader: "jinja2.BaseLoader") -> "jinja2.Environment":
|
||||||
@jinja2.contextfunction
|
@jinja2.contextfunction
|
||||||
def url_for(context: dict, name: str, **path_params: typing.Any) -> str:
|
def url_for(context: dict, name: str, **path_params: typing.Any) -> str:
|
||||||
request: Request = context["request"] # type: starlette.requests.Request
|
request: Request = context["request"]
|
||||||
return request.app.url_path_for(name, **path_params)
|
return request.app.url_path_for(name, **path_params)
|
||||||
|
|
||||||
def url_params_update(init: QueryParams, **new: typing.Any) -> QueryParams:
|
def url_params_update(init: QueryParams, **new: typing.Any) -> QueryParams:
|
||||||
|
|
|
||||||
1
mypy.ini
1
mypy.ini
|
|
@ -1,2 +1 @@
|
||||||
[mypy]
|
[mypy]
|
||||||
plugins = trio_typing.plugin
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue