Fix id token get endpoint
All checks were successful
ci/woodpecker/push/docker Pipeline was successful

This commit is contained in:
Oliver Traber 2025-03-14 00:19:22 +00:00
parent 65183e26c0
commit 486977f828
Signed by: Bluemedia
GPG key ID: C0674B105057136C
2 changed files with 2 additions and 1 deletions

View file

@ -28,6 +28,7 @@ def create_ocpp_app():
def create_app(): def create_app():
app = FastAPI( app = FastAPI(
title="simple-ocpp-cs", title="simple-ocpp-cs",
version="0.2.0",
summary="Simple implementation of a basic OCPP 2.0.1 compliant central system (backend) for EV charging stations", summary="Simple implementation of a basic OCPP 2.0.1 compliant central system (backend) for EV charging stations",
responses={404: {"description": "Not found"}}, responses={404: {"description": "Not found"}},
) )

View file

@ -24,7 +24,7 @@ async def get_id_tokens(
db: Session = Depends(get_db), db: Session = Depends(get_db),
token: AccessToken = Depends(JWTBearer()), token: AccessToken = Depends(JWTBearer()),
): ):
stmt = select(Session) stmt = select(DbIdToken)
if token.role != Role.ADMINISTRATOR: if token.role != Role.ADMINISTRATOR:
stmt = stmt.where(DbIdToken.owner_id == token.subject) stmt = stmt.where(DbIdToken.owner_id == token.subject)
stmt = stmt.order_by(DbIdToken.id).offset(skip).limit(limit) stmt = stmt.order_by(DbIdToken.id).offset(skip).limit(limit)