Fix: login failed as python-jose was removed.

This commit is contained in:
Amritanshu Agrawal 2024-12-17 09:18:33 +05:30
parent 82747c4b89
commit 0b092b5467
3 changed files with 6 additions and 6 deletions

View File

@ -3,10 +3,10 @@ import uuid
from datetime import UTC, datetime, timedelta
from typing import Any
import jwt
from fastapi import Depends, HTTPException, Security, status
from fastapi.security import OAuth2PasswordBearer, SecurityScopes
from jose import jwt
from jose.exceptions import ExpiredSignatureError
from jwt import PyJWTError
from pydantic import BaseModel, ValidationError
from sqlalchemy import select
@ -82,7 +82,7 @@ async def get_current_user(
raise credentials_exception
token_scopes = payload.get("scopes", [])
token_data = TokenData(scopes=token_scopes, username=username)
except (PyJWTError, ValidationError, ExpiredSignatureError):
except (PyJWTError, ValidationError):
raise credentials_exception
user = get_user(
username=token_data.username,

View File

@ -117,5 +117,5 @@ app.include_router(split.router, prefix="/api", tags=["voucher"])
app.include_router(change.router, prefix="/api/voucher", tags=["voucher"])
def init():
def init() -> None:
uvicorn.run(app, host=settings.HOST, port=settings.PORT)

View File

@ -45,7 +45,7 @@ def product_sale_report_view(
}
def product_sale_report(s: date, f: date, id_: uuid.UUID, db: Session):
def product_sale_report(s: date, f: date, id_: uuid.UUID | None, db: Session):
start_date = datetime.combine(s, time()) + timedelta(
minutes=settings.NEW_DAY_OFFSET_MINUTES - settings.TIMEZONE_OFFSET_MINUTES
)
@ -128,7 +128,7 @@ def print_report(
"startDate": start_date.strftime("%d-%b-%Y"),
"finishDate": finish_date.strftime("%d-%b-%Y"),
"sectionId": str(section) if section is not None else None,
"amounts": product_sale_report(start_date, finish_date, db),
"amounts": product_sale_report(start_date, finish_date, section, db),
}
print_product_sale_report(report, device_id, db)
return True