This commit is contained in:
2026-04-24 22:20:15 +03:30
parent f7dc05dc9e
commit 569d520a5c
24 changed files with 687 additions and 152 deletions
+4 -4
View File
@@ -29,7 +29,7 @@ FertilizationResponseSerializer = build_envelope_serializer(
class FertilizationRecommendView(APIView):
"""
توصیه کودهی به صورت مستقیم.
POST با sensor_uuid، plant_name، growth_stage.
POST با farm_uuid، plant_name، growth_stage.
اطلاعات گیاه از plant app دریافت می‌شود.
نیازی به دریافت نوع آبیاری نیست.
"""
@@ -62,7 +62,7 @@ class FertilizationRecommendView(APIView):
OpenApiExample(
"نمونه درخواست",
value={
"sensor_uuid": "550e8400-e29b-41d4-a716-446655440000",
"farm_uuid": "550e8400-e29b-41d4-a716-446655440000",
"plant_name": "گوجه‌فرنگی",
"growth_stage": "گلدهی",
},
@@ -81,14 +81,14 @@ class FertilizationRecommendView(APIView):
)
validated = serializer.validated_data
sensor_uuid = validated["sensor_uuid"]
farm_uuid = validated["farm_uuid"]
plant_name = validated.get("plant_name")
growth_stage = validated.get("growth_stage")
query = validated.get("query")
try:
result = get_fertilization_recommendation(
sensor_uuid=sensor_uuid,
farm_uuid=farm_uuid,
plant_name=plant_name,
growth_stage=growth_stage,
query=query,