From 754d46073e5715449c2f251db44c54bbc74d034a Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Mon, 29 Jul 2024 15:01:39 +0100 Subject: [PATCH] added db save --- backend/app/plan/router.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backend/app/plan/router.py b/backend/app/plan/router.py index c1e0b981..221075f9 100644 --- a/backend/app/plan/router.py +++ b/backend/app/plan/router.py @@ -539,6 +539,16 @@ async def trigger_plan(body: PlanTriggerRequest): uprn=p.uprn ) + # Store the data in the database + # TODO: Rather than just doing a straight insert, we should overwrite what's already there if it exists + solar_api_client.save_to_db( + session=session, + uprns_to_location=[ + {"uprn": p.uprn, "longitude": p.spatial["longitude"], "latitude": p.spatial["latitude"]} + ], + scenario_type="unit" + ) + # TODO: Insert the pitched roof area into the property class as we store the solar performance # in the property class print("Implement me")