Adjust chargepoint path and creation response code

This commit is contained in:
Oliver Traber 2024-04-13 22:55:43 +02:00
parent 599a60c52b
commit b22bc4e164
Signed by: Bluemedia
GPG key ID: C0674B105057136C

View file

@ -13,10 +13,10 @@ from app.security import get_api_key
router = APIRouter( router = APIRouter(
prefix="/chargepoint", prefix="/chargepoint",
tags=["chargepoint"], tags=["chargepoint (v1)"],
) )
@router.get(path="/", response_model=list[ChargePoint]) @router.get(path="", response_model=list[ChargePoint])
async def get_chargepoints( async def get_chargepoints(
skip: int = 0, skip: int = 0,
limit: int = 20, limit: int = 20,
@ -60,7 +60,7 @@ async def reset_chargepoint_password(
db.commit() db.commit()
return ChargePointPassword(password=chargepoint.password) return ChargePointPassword(password=chargepoint.password)
@router.post(path="/", response_model=ChargePoint) @router.post(path="", status_code=201, response_model=ChargePoint)
async def create_chargepoint( async def create_chargepoint(
chargepoint: ChargePointCreate, chargepoint: ChargePointCreate,
api_key: str = Security(get_api_key), api_key: str = Security(get_api_key),
@ -91,7 +91,7 @@ async def update_chargepoint(
db.commit() db.commit()
return chargepoint return chargepoint
@router.delete(path="/{chargepoint_id}", response_model=[]) @router.delete(path="/{chargepoint_id}", response_model=None)
async def delete_chargepoint( async def delete_chargepoint(
chargepoint_id: UUID, chargepoint_id: UUID,
api_key: str = Security(get_api_key), api_key: str = Security(get_api_key),