Skip to content

Commit

Permalink
fixup!
Browse files Browse the repository at this point in the history
  • Loading branch information
dni committed Apr 16, 2024
1 parent 219c93a commit 705a128
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
9 changes: 5 additions & 4 deletions models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# from pydantic import BaseModel
from pydantic import BaseModel

# class Example(BaseModel):
# id: str
# wallet: str

class Example(BaseModel):
id: str
wallet: str
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module = [
"lnbits.*",
"loguru.*",
"fastapi.*",
"pydantic.*",
]
ignore_missing_imports = "True"

Expand Down
4 changes: 2 additions & 2 deletions views.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from fastapi import APIRouter, Depends, Request
from fastapi.responses import HTMLResponse
from lnbits.core.models import User
from lnbits.decorators import check_user_exists
from lnbits.helpers import template_renderer
from starlette.responses import HTMLResponse

example_ext_generic = APIRouter()

Expand All @@ -13,5 +13,5 @@ async def index(
user: User = Depends(check_user_exists),
):
return template_renderer(["example/templates"]).TemplateResponse(
"example/index.html", {"request": request, "user": user.dict()}
request, "example/index.html", {"user": user.dict()}
)
6 changes: 4 additions & 2 deletions views_api.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from fastapi import APIRouter

from .models import Example

# views_api.py is for you API endpoints that could be hit by another service

example_ext_api = APIRouter()


@example_ext_api.get("/api/v1/test/{test_data}")
async def api_example(test_data):
async def api_example(test_data: str) -> Example:
# Do some python things and return the data
return test_data
return Example(id="1", wallet=test_data)

0 comments on commit 705a128

Please sign in to comment.