Skip to content

Commit

Permalink
fix: update and tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
dni committed Jan 2, 2025
1 parent 3231d8f commit 285f371
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
3 changes: 1 addition & 2 deletions migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ async def m001_initial(db: Connection):
await db.execute(
f"""
CREATE TABLE pay2print.print (
id TEXT PRIMARY KEY,
payment_hash TEXT PRIMARY KEY,
printer TEXT NOT NULL,
payment_hash TEXT NOT NULL,
payment_status TEXT NOT NULL,
print_status TEXT NOT NULL,
file TEXT NOT NULL,
Expand Down
3 changes: 1 addition & 2 deletions models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from datetime import datetime, timezone
from enum import Enum
from typing import Optional

from lnbits.core.models import PaymentState
from lnbits.helpers import urlsafe_short_hash
Expand Down Expand Up @@ -35,12 +34,12 @@ class Printer(BaseModel):


class CreatePrinter(BaseModel):
name: str
wallet: str
host: str
amount: int
width: int
height: int
name: Optional[str] = None


class Print(BaseModel):
Expand Down
6 changes: 2 additions & 4 deletions views_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,8 @@ async def api_update_printer(
if key_info.wallet.user != printer.user_id:
raise HTTPException(HTTPStatus.FORBIDDEN, "User not allowed to update printer.")

printer.wallet = data.wallet
printer.host = data.host
if data.name:
printer.name = data.name
for key, value in data.dict().items():
setattr(printer, key, value)

return await update_printer(printer)

Expand Down

0 comments on commit 285f371

Please sign in to comment.