diff --git a/__init__.py b/__init__.py index 3f7044f..502e806 100644 --- a/__init__.py +++ b/__init__.py @@ -12,18 +12,18 @@ from fastapi.responses import JSONResponse db = Database("ext_tempextension") temp_ext: APIRouter = APIRouter( - prefix="/tempextension", tags=["Temp"] + prefix="/temp", tags=["Temp"] ) temp_static_files = [ { - "path": "/tempextension/static", - "name": "tempextension_static", + "path": "/temp/static", + "name": "temp_static", } ] def template_renderer(): - return template_renderer(["tempextension/templates"]) + return template_renderer(["temp/templates"]) from .lnurl import * from .tasks import wait_for_paid_invoices diff --git a/crud.py b/crud.py index 6c3ab76..aae73c0 100644 --- a/crud.py +++ b/crud.py @@ -11,7 +11,7 @@ async def create_temp(wallet_id: str, data: CreateTempData) -> Temp: temp_id = urlsafe_short_hash() await db.execute( """ - INSERT INTO tempextension.tempextension (id, wallet, name, total) + INSERT INTO tempextension.temp (id, wallet, name, total) VALUES (?, ?, ?, ?) """, ( @@ -29,7 +29,7 @@ async def create_temp(wallet_id: str, data: CreateTempData) -> Temp: async def get_temp(temp_id: str) -> Optional[Temp]: - row = await db.fetchone("SELECT * FROM tempextension.tempextension WHERE id = ?", (temp_id,)) + row = await db.fetchone("SELECT * FROM tempextension.temp WHERE id = ?", (temp_id,)) return Temp(**row) if row else None async def get_temps(wallet_ids: Union[str, List[str]]) -> List[Temp]: @@ -38,18 +38,18 @@ async def get_temps(wallet_ids: Union[str, List[str]]) -> List[Temp]: q = ",".join(["?"] * len(wallet_ids)) rows = await db.fetchall( - f"SELECT * FROM tempextension.tempextension WHERE wallet IN ({q})", (*wallet_ids,) + f"SELECT * FROM tempextension.temp WHERE wallet IN ({q})", (*wallet_ids,) ) return [Temp(**row) for row in rows] async def update_temp(temp_id: str, **kwargs) -> Temp: q = ", ".join([f"{field[0]} = ?" for field in kwargs.items()]) await db.execute( - f"UPDATE tempextension.tempextension SET {q} WHERE id = ?", (*kwargs.values(), temp_id) + f"UPDATE tempextension.temp SET {q} WHERE id = ?", (*kwargs.values(), temp_id) ) temp = await get_temp(temp_id) assert temp, "Newly updated temp couldn't be retrieved" return temp async def delete_temp(temp_id: str) -> None: - await db.execute("DELETE FROM tempextension.tempextension WHERE id = ?", (temp_id,)) \ No newline at end of file + await db.execute("DELETE FROM tempextension.temp WHERE id = ?", (temp_id,)) \ No newline at end of file