Fix import/export user factories, update repository/user.py for proper StartSession API call, fix setup.py
This commit is contained in:
parent
b280949451
commit
9209cf624a
@ -4,8 +4,7 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|||||||
Copyright © 2022 Concordia CERC group
|
Copyright © 2022 Concordia CERC group
|
||||||
Project CoderPeter Yefi peteryefi@gmail.com
|
Project CoderPeter Yefi peteryefi@gmail.com
|
||||||
"""
|
"""
|
||||||
from hub.persistence import UserRepo
|
from hub.persistence import User
|
||||||
|
|
||||||
|
|
||||||
class UserFactory:
|
class UserFactory:
|
||||||
"""
|
"""
|
||||||
@ -13,7 +12,7 @@ class UserFactory:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, db_name, app_env, dotenv_path):
|
def __init__(self, db_name, app_env, dotenv_path):
|
||||||
self._user_repo = UserRepo(db_name=db_name, app_env=app_env, dotenv_path=dotenv_path)
|
self._user_repo = User(db_name=db_name, app_env=app_env, dotenv_path=dotenv_path)
|
||||||
|
|
||||||
def login_user(self, email: str, password: str):
|
def login_user(self, email: str, password: str):
|
||||||
"""
|
"""
|
||||||
|
@ -4,7 +4,7 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|||||||
Copyright © 2022 Concordia CERC group
|
Copyright © 2022 Concordia CERC group
|
||||||
Project CoderPeter Yefi peteryefi@gmail.com
|
Project CoderPeter Yefi peteryefi@gmail.com
|
||||||
"""
|
"""
|
||||||
from hub.persistence import UserRepo
|
from hub.persistence import User
|
||||||
from hub.persistence import UserRoles
|
from hub.persistence import UserRoles
|
||||||
|
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ class UserFactory:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, db_name, app_env, dotenv_path):
|
def __init__(self, db_name, app_env, dotenv_path):
|
||||||
self._user_repo = UserRepo(db_name=db_name, app_env=app_env, dotenv_path=dotenv_path)
|
self._user_repo = User(db_name=db_name, app_env=app_env, dotenv_path=dotenv_path)
|
||||||
|
|
||||||
def create_user(self, name: str, email: str, password: str, role: UserRoles):
|
def create_user(self, name: str, email: str, password: str, role: UserRoles):
|
||||||
"""
|
"""
|
||||||
|
@ -114,7 +114,8 @@ class User(Repository):
|
|||||||
).first()
|
).first()
|
||||||
if user:
|
if user:
|
||||||
if Auth.check_password(password, user[0].password):
|
if Auth.check_password(password, user[0].password):
|
||||||
return user[0]
|
#return user[0]
|
||||||
return {'message': 'invalid login information'}
|
return True
|
||||||
|
return False
|
||||||
except SQLAlchemyError as err:
|
except SQLAlchemyError as err:
|
||||||
logger.error(f'Error while fetching user by email: {err}')
|
logger.error(f'Error while fetching user by email: {err}')
|
||||||
|
36
setup.py
36
setup.py
@ -67,7 +67,7 @@ setup(
|
|||||||
'hub.imports',
|
'hub.imports',
|
||||||
'hub.imports.construction',
|
'hub.imports.construction',
|
||||||
'hub.imports.construction.helpers',
|
'hub.imports.construction.helpers',
|
||||||
'hub.imports.construction.data_classes',
|
#'hub.imports.construction.data_classes',
|
||||||
'hub.imports.energy_systems',
|
'hub.imports.energy_systems',
|
||||||
'hub.imports.geometry',
|
'hub.imports.geometry',
|
||||||
'hub.imports.geometry.citygml_classes',
|
'hub.imports.geometry.citygml_classes',
|
||||||
@ -87,23 +87,23 @@ setup(
|
|||||||
('hub/config', glob.glob('hub/config/*.ini')),
|
('hub/config', glob.glob('hub/config/*.ini')),
|
||||||
('hub/catalog_factories/greenery/ecore_greenery', glob.glob('hub/catalog_factories/greenery/ecore_greenery/*.ecore')),
|
('hub/catalog_factories/greenery/ecore_greenery', glob.glob('hub/catalog_factories/greenery/ecore_greenery/*.ecore')),
|
||||||
('hub/data/construction.', glob.glob('hub/data/construction/*')),
|
('hub/data/construction.', glob.glob('hub/data/construction/*')),
|
||||||
('hub/data/customized_imports/', glob.glob('hub/data/customized_imports/*.xml')),
|
('hub/data/customized_imports', glob.glob('hub/data/customized_imports/*.xml')),
|
||||||
('hub/data/energy_systems/', glob.glob('hub/data/energy_systems/*.xml')),
|
('hub/data/energy_systems', glob.glob('hub/data/energy_systems/*.xml')),
|
||||||
('hub/data/energy_systems/', glob.glob('hub/data/energy_systems/*.insel')),
|
('hub/data/energy_systems', glob.glob('hub/data/energy_systems/*.insel')),
|
||||||
('hub/data/energy_systems/', glob.glob('hub/data/energy_systems/*.xlsx')),
|
('hub/data/energy_systems', glob.glob('hub/data/energy_systems/*.xlsx')),
|
||||||
('hub/data/energy_systems/*', glob.glob('hub/data/energy_systems/*.txt')),
|
('hub/data/energy_systems', glob.glob('hub/data/energy_systems/*.txt')),
|
||||||
('hub/data/energy_systems/*', glob.glob('hub/data/energy_systems/*.yaml')),
|
('hub/data/energy_systems', glob.glob('hub/data/energy_systems/*.yaml')),
|
||||||
('hub/data/greenery/', glob.glob('hub/data/greenery/*.xml')),
|
('hub/data/greenery', glob.glob('hub/data/greenery/*.xml')),
|
||||||
('hub/data/life_cycle_assessment/', glob.glob('hub/data/life_cycle_assessment/*.xml')),
|
('hub/data/life_cycle_assessment', glob.glob('hub/data/life_cycle_assessment/*.xml')),
|
||||||
('hub/data/schedules/', glob.glob('hub/data/schedules/*.xml')),
|
('hub/data/schedules', glob.glob('hub/data/schedules/*.xml')),
|
||||||
('hub/data/schedules/', glob.glob('hub/data/schedules/*.xlsx')),
|
('hub/data/schedules', glob.glob('hub/data/schedules/*.xlsx')),
|
||||||
('hub/data/schedules/idf_files/', glob.glob('hub/data/schedules/idf_files/*.idf')),
|
('hub/data/schedules/idf_files', glob.glob('hub/data/schedules/idf_files/*.idf')),
|
||||||
('hub/data/sensors/', glob.glob('hub/data/sensors/*.json')),
|
('hub/data/sensors', glob.glob('hub/data/sensors/*.json')),
|
||||||
('hub/data/usage/', glob.glob('hub/data/usage/*.xml')),
|
('hub/data/usage', glob.glob('hub/data/usage/*.xml')),
|
||||||
('hub/data/usage/', glob.glob('hub/data/usage/*.xlsx')),
|
('hub/data/usage', glob.glob('hub/data/usage/*.xlsx')),
|
||||||
('hub/data/weather/', glob.glob('hub/data/weather/*.dat')),
|
('hub/data/weather', glob.glob('hub/data/weather/*.dat')),
|
||||||
('hub/data/weather/epw/', glob.glob('hub/data/weather/epw/*.epw')),
|
('hub/data/weather/epw', glob.glob('hub/data/weather/epw/*.epw')),
|
||||||
('hub/data/weather/', glob.glob('hub/data/weather/*.dat')),
|
('hub/data/weather', glob.glob('hub/data/weather/*.dat')),
|
||||||
('hub/exports/building_energy/idf_files', glob.glob('hub/exports/building_energy/idf_files/*.idf')),
|
('hub/exports/building_energy/idf_files', glob.glob('hub/exports/building_energy/idf_files/*.idf')),
|
||||||
('hub/exports/building_energy/idf_files', glob.glob('hub/exports/building_energy/idf_files/*.idd')),
|
('hub/exports/building_energy/idf_files', glob.glob('hub/exports/building_energy/idf_files/*.idd')),
|
||||||
('hub/helpers/data', glob.glob('hub/helpers/data/quebec_to_hub.json'))
|
('hub/helpers/data', glob.glob('hub/helpers/data/quebec_to_hub.json'))
|
||||||
|
Loading…
Reference in New Issue
Block a user