Spaces:
Sleeping
Sleeping
File size: 770 Bytes
6f9f2ac | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | from fastapi import APIRouter , Query
from app.services.bbch_service import get_all_stages , get_stage_by_code , get_crop_list
from app.schemas.bbch import BBCHCategory , BBCHStage
from typing import List , Optional
router = APIRouter()
@router.get("/bbch/stages" , response_model=List[BBCHStage])
async def get_stages(crop_type: Optional[str] = Query(None , description="Filter by crop")):
return get_all_stages(crop_type)
@router.get("/bbch/stages/{code}" , response_model=Optional[BBCHStage])
async def get_stage(code: str, crop_type: Optional[str] = Query(None, description="Crop type")):
return get_stage_by_code(code , crop_type)
@router.get("/bbch/crops" , response_model=List[str])
async def get_crops():
return get_crop_list()
|