Skip to content

Commit

Permalink
feat: add nostr compat
Browse files Browse the repository at this point in the history
  • Loading branch information
dni committed Sep 25, 2024
1 parent c6f4e40 commit 9981764
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
2 changes: 2 additions & 0 deletions crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ async def create_appointment(
end_time=data.end_time,
schedule=schedule_id,
paid=False,
created_at=datetime.now(),
)
await db.execute(
insert_query("lncalendar.appointment", appointment),
Expand Down Expand Up @@ -150,6 +151,7 @@ async def create_unavailable_time(data: CreateUnavailableTime) -> UnavailableTim
start_time=data.start_time,
end_time=data.end_time or data.start_time,
schedule=data.schedule,
created_at=datetime.now(),
)
await db.execute(
insert_query("lncalendar.unavailable", unavailable_time),
Expand Down
18 changes: 18 additions & 0 deletions migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,21 @@ async def m001_initial(db):
);
"""
)


async def m002_rename_time_to_created_at(db):
"""
Rename time to created_at in the unavailability table.
"""
await db.execute(
"""
ALTER TABLE lncalendar.unavailable
RENAME COLUMN time TO created_at;
"""
)
await db.execute(
"""
ALTER TABLE lncalendar.appointment
RENAME COLUMN time TO created_at;
"""
)
4 changes: 3 additions & 1 deletion models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from datetime import datetime
from typing import Optional

from fastapi import Query
Expand Down Expand Up @@ -49,6 +50,7 @@ class UnavailableTime(BaseModel):
start_time: str
end_time: str
schedule: str
created_at: datetime


class Appointment(BaseModel):
Expand All @@ -60,4 +62,4 @@ class Appointment(BaseModel):
end_time: str
schedule: str
paid: bool
time: int
created_at: datetime
2 changes: 0 additions & 2 deletions views_api.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import sched
from http import HTTPStatus

from fastapi import APIRouter, Depends, Query
from fastapi.exceptions import HTTPException

from lnbits.core.crud import get_standalone_payment, get_user
from lnbits.core.models import User, WalletTypeInfo
from lnbits.core.services import create_invoice
Expand Down

0 comments on commit 9981764

Please sign in to comment.