fix backend python compatibility
This commit is contained in:
parent
8ad7111bc4
commit
f4093bb774
@ -7,7 +7,7 @@ import sqlite3
|
||||
from contextlib import contextmanager
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
from typing import Any, Dict, List
|
||||
from uuid import uuid4
|
||||
|
||||
from fastapi import FastAPI, HTTPException, Request
|
||||
@ -33,7 +33,7 @@ app.add_middleware(
|
||||
allow_headers=["Content-Type"],
|
||||
)
|
||||
|
||||
rate_bucket: dict[str, list[datetime]] = {}
|
||||
rate_bucket: Dict[str, List[datetime]] = {}
|
||||
|
||||
|
||||
class ShareCreateRequest(BaseModel):
|
||||
@ -146,7 +146,7 @@ def startup() -> None:
|
||||
|
||||
|
||||
@app.post("/api/share", response_model=ShareCreateResponse)
|
||||
def create_share(payload: ShareCreateRequest, request: Request) -> dict[str, str]:
|
||||
def create_share(payload: ShareCreateRequest, request: Request) -> Dict[str, str]:
|
||||
cleanup_expired()
|
||||
assert_rate_limit(request)
|
||||
if decoded_size(payload.ciphertext) > MAX_PAYLOAD_BYTES:
|
||||
@ -169,7 +169,7 @@ def create_share(payload: ShareCreateRequest, request: Request) -> dict[str, str
|
||||
|
||||
|
||||
@app.get("/api/share/{export_id}")
|
||||
def get_share(export_id: str) -> dict[str, Any]:
|
||||
def get_share(export_id: str) -> Dict[str, Any]:
|
||||
cleanup_expired()
|
||||
with connect() as db:
|
||||
row = db.execute("SELECT * FROM active_shares WHERE export_id = ?", (export_id,)).fetchone()
|
||||
@ -191,7 +191,7 @@ def get_share(export_id: str) -> dict[str, Any]:
|
||||
|
||||
|
||||
@app.post("/api/share/{export_id}/confirm-import")
|
||||
def confirm_import(export_id: str) -> dict[str, str]:
|
||||
def confirm_import(export_id: str) -> Dict[str, str]:
|
||||
cleanup_expired()
|
||||
with connect() as db:
|
||||
row = db.execute("SELECT export_id, created_at FROM active_shares WHERE export_id = ?", (export_id,)).fetchone()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user