mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Added property id to plan creation
This commit is contained in:
parent
557aa108e5
commit
560af9e0cf
2 changed files with 3 additions and 0 deletions
|
|
@ -44,6 +44,7 @@ class Plan(Base):
|
|||
|
||||
id = Column(BigInteger, primary_key=True, autoincrement=True)
|
||||
portfolio_id = Column(BigInteger, ForeignKey(Portfolio.id), nullable=False)
|
||||
property_id = Column(BigInteger, ForeignKey(PropertyModel.id), nullable=False)
|
||||
created_at = Column(TIMESTAMP, nullable=False, server_default=func.now())
|
||||
is_default = Column(Boolean, nullable=False)
|
||||
|
||||
|
|
|
|||
|
|
@ -245,6 +245,7 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
# 2) the property details (epc)
|
||||
# 3) the recommendations
|
||||
|
||||
logger.info("Uploading recommendations to the database")
|
||||
# Upload property data
|
||||
for p in input_properties:
|
||||
property_details_epc = p.get_property_details_epc(portfolio_id=body.portfolio_id, rating_lookup=rating_lookup)
|
||||
|
|
@ -265,6 +266,7 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
new_plan_id = create_plan(
|
||||
{
|
||||
"portfolio_id": body.portfolio_id,
|
||||
"property_id": p.id,
|
||||
"is_default": True
|
||||
}
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue