Skip to content

Commit

Permalink
mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
arcbtc committed Nov 29, 2024
1 parent a04173b commit da267d2
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 40 deletions.
8 changes: 4 additions & 4 deletions crud.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional
from typing import List

from lnbits.db import Database
from lnbits.helpers import urlsafe_short_hash
Expand All @@ -8,7 +8,7 @@
db = Database("ext_satspot")


async def create_satspot(data: CreateSatspot, wallet, user) -> Optional[Satspot]:
async def create_satspot(data: CreateSatspot, wallet, user) -> List[Satspot]:
satspot = Satspot(**data.dict(), id=urlsafe_short_hash(), wallet=wallet, user=user)
await db.insert("satspot.satspot", satspot)
return await get_satspots(user)
Expand All @@ -19,15 +19,15 @@ async def update_satspot(satspot: Satspot) -> Satspot:
return satspot


async def get_satspot(satspot_id: str) -> Optional[Satspot]:
async def get_satspot(satspot_id: str) -> Satspot:
return await db.fetchone(
"SELECT * FROM satspot.satspot WHERE id = :id",
{"id": satspot_id},
Satspot,
)


async def get_satspots(user: str) -> Optional[Satspot]:
async def get_satspots(user: str) -> List[Satspot]:
return await db.fetchall(
"SELECT * FROM satspot.satspot WHERE user = :user",
{"user": user},
Expand Down
2 changes: 1 addition & 1 deletion models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CreateSatspot(BaseModel):

class Satspot(BaseModel):
id: Optional[str] = None
wallet: Optional[str] = None
wallet: str
user: Optional[str] = None
name: str
closing_date: datetime
Expand Down
71 changes: 36 additions & 35 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ authors = ["Alan Bits <[email protected]>"]
[tool.poetry.dependencies]
python = "^3.10 | ^3.9"
lnbits = {version = "*", allow-prereleases = true}
mypy = "^1.13.0"

[tool.poetry.group.dev.dependencies]
black = "^24.3.0"
Expand Down

0 comments on commit da267d2

Please sign in to comment.