Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨(api) add create and update endpoints for statique objects #21

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ and this project adheres to

### Added

- Implement `/statique` endpoints and models
- Defined `/statique` endpoints and models

### Changed

Expand Down
35 changes: 34 additions & 1 deletion src/api/qualicharge/api/v1/routers/statique.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Annotated, List

from annotated_types import Len
from fastapi import APIRouter, status
from fastapi import APIRouter, Path, status
from pydantic import BaseModel, computed_field

from qualicharge.conf import settings
Expand Down Expand Up @@ -40,6 +40,39 @@ async def list() -> List[Statique]:
return []


@router.get("/{id_pdc_itinerance}")
async def read(
id_pdc_itinerance: Annotated[
str,
Path(
description=(
"L'identifiant du point de recharge délivré selon les modalités "
"définies à l'article 10 du décret n° 2017-26 du 12 janvier 2017."
),
),
],
) -> Statique:
"""Read statique item (point de charge)."""
raise NotImplementedError


@router.put("/{id_pdc_itinerance}")
async def update(
id_pdc_itinerance: Annotated[
str,
Path(
description=(
"L'identifiant du point de recharge délivré selon les modalités "
"définies à l'article 10 du décret n° 2017-26 du 12 janvier 2017."
),
),
],
statique: Statique,
) -> Statique:
"""Update statique item (point de charge)."""
raise NotImplementedError


@router.post("/", status_code=status.HTTP_201_CREATED)
async def create(statique: Statique) -> StatiqueItemsCreatedResponse:
"""Create a statique item."""
Expand Down