diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..9cde608 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = false +max_line_length = 120 +tab_width = 4 +ij_continuation_indent_size = 8 +ij_formatter_off_tag = @formatter:off +ij_formatter_on_tag = @formatter:on +ij_formatter_tags_enabled = true +ij_smart_tabs = false +ij_visual_guides = +ij_wrap_on_typing = false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..807849c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.venv +/.idea/ diff --git a/README.md b/README.md index 31fa5bb..4a16f2e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -# PythonAppFuelTable +# Python-App-FuelTable -Ausnahme und Anzeige vom Sprit-Verbrauch \ No newline at end of file +Aufnahme und Anzeige vom Sprit-Verbrauch einzelner Fahrzeuge. \ No newline at end of file diff --git a/api/main.py b/api/main.py new file mode 100644 index 0000000..3d4a147 --- /dev/null +++ b/api/main.py @@ -0,0 +1,20 @@ +import datetime + +from fastapi import FastAPI + +from api.models import Car, FuelItem + +app = FastAPI() + + +car = Car(id_string="Auto 1") +fill_item = FuelItem( + car=car, + date=datetime.date.today(), + odometer_reading=101005, + fuel_fill=52.26 + ) + +@app.get("/") +async def root(): + return fill_item \ No newline at end of file diff --git a/api/models.py b/api/models.py new file mode 100644 index 0000000..fb7e6a8 --- /dev/null +++ b/api/models.py @@ -0,0 +1,14 @@ +import datetime + +from pydantic import BaseModel, EmailStr + + +class Car(BaseModel): + id_string: str + + +class FuelItem(BaseModel): + car: Car + date: datetime.date + odometer_reading: float + fuel_fill: float \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..2084b60 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,12 @@ +annotated-doc==0.0.* +annotated-types==0.7.* +anyio==4.11.* +fastapi==0.120.* +uvicorn==0.38.0 +idna==3.11 +pydantic==2.12.* +pydantic_core==2.41.* +sniffio==1.3.* +starlette==0.48.* +typing-inspection==0.4.* +typing_extensions==4.15.*