Fixed issue with user persistence
This commit is contained in:
parent
6383a47aa0
commit
db9f286992
|
@ -17,9 +17,9 @@ class DBSetup:
|
|||
:param dotenv_path:
|
||||
"""
|
||||
repo = BaseRepo(db_name=db_name, app_env=app_env, dotenv_path=dotenv_path)
|
||||
User.__table__.create(bind=repo.engine, checkfirst=True)
|
||||
City.__table__.create(bind=repo.engine, checkfirst=True)
|
||||
HeatPumpSimulation.__table__.create(bind=repo.engine, checkfirst=True)
|
||||
User.__table__.create(bind=repo.engine, checkfirst=True)
|
||||
self._user_repo = UserRepo(db_name=db_name, app_env=app_env, dotenv_path=dotenv_path)
|
||||
self._create_admin_user(self._user_repo)
|
||||
|
||||
|
@ -29,7 +29,6 @@ class DBSetup:
|
|||
print('Creating default admin user...')
|
||||
user = user_repo.insert('Administrator', email, password, UserRoles.Admin)
|
||||
if type(user) is dict:
|
||||
print(user)
|
||||
logger.info(user)
|
||||
else:
|
||||
print(f'Created Admin user with email: {email}, password: {password} and role: {UserRoles.Admin}')
|
||||
|
|
|
@ -31,7 +31,7 @@ class City(Base):
|
|||
hub_release = Column(String, nullable=False)
|
||||
city_version = Column(Integer, nullable=False)
|
||||
user_id = Column(Integer, ForeignKey('user.id'))
|
||||
user = relationship("User", back_populates="city")
|
||||
user = relationship("User", back_populates="cities")
|
||||
created = Column(DateTime, default=datetime.datetime.utcnow)
|
||||
updated = Column(DateTime, default=datetime.datetime.utcnow)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user