Skip to content

Commit

Permalink
fuck up pyright
Browse files Browse the repository at this point in the history
  • Loading branch information
talvasconcelos committed Oct 24, 2024
1 parent 39dc2a6 commit b68af46
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions views_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ async def api_schedule_update(

@lncalendar_api_router.delete("/api/v1/schedule/{schedule_id}")
async def api_schedule_delete(
schedule_id: str, user: User = Depends(check_user_exists),
schedule_id: str,
user: User = Depends(check_user_exists),
):
schedule = await get_schedule(schedule_id)

Expand Down Expand Up @@ -150,11 +151,11 @@ async def api_appointment_create(data: CreateAppointment):
try:
payment = await create_invoice(
wallet_id=schedule.wallet,
amount=amount, # type: ignore
amount=amount,
memo=f"{schedule.name}",
extra={"tag": "lncalendar", "name": data.name, "email": data.email},
)

await create_appointment(
schedule_id=data.schedule, payment_hash=payment.payment_hash, data=data
)
Expand Down Expand Up @@ -185,7 +186,7 @@ async def api_appointment_update(
raise HTTPException(
status_code=HTTPStatus.FORBIDDEN, detail="Not your schedule."
)

for k, v in data.dict().items():
if v is not None:
setattr(appointment, k, v)
Expand All @@ -204,6 +205,7 @@ async def api_appointment_update(
await nostr_send_msg(pubkey, msg)
return appointment.dict()


@lncalendar_api_router.get("/api/v1/appointment/purge/{schedule_id}")
async def api_purge_appointments(schedule_id: str):
schedule = await get_schedule(schedule_id)
Expand Down Expand Up @@ -328,16 +330,19 @@ async def api_unavailable_delete(
await delete_unavailable_time(unavailable_id)
return "", HTTPStatus.NO_CONTENT


## Currency API
@lncalendar_api_router.get("/api/v1/currencies")
async def api_get_currencies():
return allowed_currencies()


## SETTINGS
@lncalendar_api_router.get("/api/v1/settings", dependencies=[Depends(check_admin)])
async def api_get_settings() -> CalendarSettings:
return await get_or_create_calendar_settings()


@lncalendar_api_router.put("/api/v1/settings", dependencies=[Depends(check_admin)])
async def api_update_settings(settings: CalendarSettings) -> CalendarSettings:
try:
Expand All @@ -348,6 +353,7 @@ async def api_update_settings(settings: CalendarSettings) -> CalendarSettings:
) from exc
return await update_calendar_settings(settings)


@lncalendar_api_router.delete("/api/v1/settings", dependencies=[Depends(check_admin)])
async def api_delete_settings() -> None:
await delete_calendar_settings()
await delete_calendar_settings()

0 comments on commit b68af46

Please sign in to comment.