updated app reachable codes
This commit is contained in:
40
ApiServices/DealerService/init_applications.py
Normal file
40
ApiServices/DealerService/init_applications.py
Normal file
@@ -0,0 +1,40 @@
|
||||
from Schemas import (
|
||||
Applications,
|
||||
Application2Employee,
|
||||
Employees
|
||||
)
|
||||
|
||||
def init_applications_for_super_user(super_user: Employees, db_session=None) -> None:
|
||||
list_of_created_apps = [
|
||||
dict(
|
||||
name="Dashboard1",
|
||||
application_code = "app000001",
|
||||
site_url = "/dashboard",
|
||||
application_type = "info",
|
||||
description = "Dashboard Page"
|
||||
),
|
||||
dict(
|
||||
name="Dashboard2",
|
||||
application_code = "app000002",
|
||||
site_url = "/buildings/list",
|
||||
application_type = "CreateFrom",
|
||||
description = "Dashboard Page"
|
||||
),
|
||||
]
|
||||
|
||||
for list_of_created_app in list_of_created_apps:
|
||||
dashboard_page = Applications.find_or_create(
|
||||
**list_of_created_app, db=db_session,
|
||||
)
|
||||
print('dashboard_page', dashboard_page)
|
||||
if dashboard_page.meta_data.created:
|
||||
dashboard_page.save(db=db_session)
|
||||
Application2Employee.find_or_create(
|
||||
employee_id=super_user.id,
|
||||
employee_uu_id=str(super_user.uu_id),
|
||||
site_url=dashboard_page.site_url,
|
||||
application_code=dashboard_page.application_code,
|
||||
application_id=dashboard_page.id,
|
||||
application_uu_id=str(dashboard_page.uu_id),
|
||||
db=db_session,
|
||||
)
|
||||
Reference in New Issue
Block a user