mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Added PortfolioUsers table
This commit is contained in:
parent
36b18876d6
commit
c48fb674de
2 changed files with 17 additions and 3 deletions
|
|
@ -205,3 +205,13 @@ class PropertyTargetsModel(Base):
|
|||
created_at = Column(DateTime, nullable=False, default=datetime.datetime.now(pytz.utc))
|
||||
epc = Column(Enum(Epc))
|
||||
heat_demand = Column(Text)
|
||||
|
||||
|
||||
class PortfolioUsers(Base):
|
||||
__table_args__ = "portfolioUsers"
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
userId = Column(Integer, ForeignKey('user.id'), nullable=False)
|
||||
portfolioId = Column(Integer, ForeignKey('portfolio.id'), nullable=False)
|
||||
role = Column(Text, nullable=False)
|
||||
created_at = Column(DateTime, nullable=False, default=datetime.datetime.now(pytz.utc))
|
||||
updated_at = Column(DateTime, nullable=False, default=datetime.datetime.now(pytz.utc))
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
from sqlalchemy.orm import sessionmaker
|
||||
from backend.app.db.connection import db_engine
|
||||
from etl.ownership.Ownership import Ownership
|
||||
from etl.ownership.config import OWNERS_WHO_CANT_SELL as EXCLUDED_OWNERS
|
||||
|
||||
|
|
@ -8,7 +10,6 @@ USER_IDS = [
|
|||
5, # Anna
|
||||
30, # Patricia
|
||||
]
|
||||
PORTFOLIO_ID = None
|
||||
|
||||
EPC_PATHS = [
|
||||
"local_data/all-domestic-certificates/domestic-E08000025-Birmingham/certificates.csv",
|
||||
|
|
@ -72,8 +73,11 @@ def app():
|
|||
bucket=DATA_BUCKET,
|
||||
average_property_value=PROPERTY_VALUE_ESTIMATE,
|
||||
portfolio_value=PORTFOLIO_VALUE,
|
||||
EXCLUDED_OWNERS=EXCLUDED_OWNERS
|
||||
excluded_owners=EXCLUDED_OWNERS
|
||||
)
|
||||
ownership_instance.pipeline(column_filters=epc_column_filters)
|
||||
|
||||
# TODO: Create portfolio and payload
|
||||
session = sessionmaker(bind=db_engine)()
|
||||
session.begin()
|
||||
|
||||
# Create the project, if a portfolio doesn't exist for the project name
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue