Backend (FastAPI): - REST API: auth, plants, beds, plantings - CRUD layer with CRUDBase - Pydantic v2 schemas for all entities - Alembic migration: complete schema + all enums - Seed data: 28 global plants + 15 compatibilities Frontend (Vue 3 + PrimeVue): - Axios client with JWT interceptor + auto-refresh - Pinia stores: auth, beds, plants - Views: Login, Beds, BedDetail, PlantLibrary - Components: AppLayout, BedForm, PlantingForm, PlantForm Docker: - docker-compose.yml (production) - docker-compose.dev.yml (development with hot-reload) - Nginx config with SPA fallback + API proxy - Multi-stage frontend Dockerfile - .env.example, .gitignore Version: 1.0.0-alpha
64 lines
1.4 KiB
Python
64 lines
1.4 KiB
Python
import uuid
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from app.models.plant import CompatibilityRating, NutrientDemand, WaterDemand
|
|
|
|
|
|
class PlantFamilyRead(BaseModel):
|
|
model_config = {"from_attributes": True}
|
|
|
|
id: uuid.UUID
|
|
name: str
|
|
latin_name: str
|
|
|
|
|
|
class PlantBase(BaseModel):
|
|
name: str
|
|
latin_name: str | None = None
|
|
family_id: uuid.UUID
|
|
nutrient_demand: NutrientDemand
|
|
water_demand: WaterDemand
|
|
spacing_cm: int
|
|
sowing_start_month: int
|
|
sowing_end_month: int
|
|
rest_years: int = 0
|
|
notes: str | None = None
|
|
|
|
|
|
class PlantCreate(PlantBase):
|
|
pass
|
|
|
|
|
|
class PlantUpdate(BaseModel):
|
|
name: str | None = None
|
|
latin_name: str | None = None
|
|
family_id: uuid.UUID | None = None
|
|
nutrient_demand: NutrientDemand | None = None
|
|
water_demand: WaterDemand | None = None
|
|
spacing_cm: int | None = None
|
|
sowing_start_month: int | None = None
|
|
sowing_end_month: int | None = None
|
|
rest_years: int | None = None
|
|
notes: str | None = None
|
|
is_active: bool | None = None
|
|
|
|
|
|
class PlantRead(PlantBase):
|
|
model_config = {"from_attributes": True}
|
|
|
|
id: uuid.UUID
|
|
tenant_id: uuid.UUID | None
|
|
is_active: bool
|
|
family: PlantFamilyRead
|
|
|
|
|
|
class PlantCompatibilityRead(BaseModel):
|
|
model_config = {"from_attributes": True}
|
|
|
|
id: uuid.UUID
|
|
plant_id_a: uuid.UUID
|
|
plant_id_b: uuid.UUID
|
|
rating: CompatibilityRating
|
|
reason: str | None
|